Skip to content

Instantly share code, notes, and snippets.

@windelicato
Created November 7, 2013 02:45
Show Gist options
  • Save windelicato/7348087 to your computer and use it in GitHub Desktop.
Save windelicato/7348087 to your computer and use it in GitHub Desktop.
rulec / ruled replacement
#!/bin/bash
readarray -t PROPS < <(xwinfo -its $1)
INST=${PROPS[0]}
TYPE=${PROPS[1]}
STATE=(${PROPS[2]})
RULE=()
# Sane defaults
case "$TYPE" in
dock|desktop|notification) RULE+=("manage=off") ;;
toolbar|utility) RULE+=("focus=off") ;;
desktop) RULE+=("lower=on") ;;
esac
for s in $STATE; do
case $s in
sticky) RULE+=("sticky=on") ;;
fullscreen) RULE+=("fullscreen=on") ;;
esac
done
# Custom rules
case "$INST" in
mpv|skype|transmission)
RULE+=("floating=on") ;;
conky)
RULE+=("sticky=on manage=off") ;;
astime)
RULE+=("sticky=on") ;;
feh)
RULE+=("floating=on manage=off") ;;
BSPWM_FRAME|bspwm_frame)
RULE+=("frame=on") ;;
esac
echo "${RULE[*]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment