Update to support bspwm 0.9.1

- Fix floating rules
- Fix is_floating (for auto_hide and auto_show)
- Fix for -m option
break
noctuid 9 years ago
parent 23e751d5a8
commit e1c2622301

19
tdrop

@ -181,6 +181,11 @@ update_geometry_settings_for_monitor() {
wm=$(get_window_manager) wm=$(get_window_manager)
if [[ $wm == bspwm ]]; then if [[ $wm == bspwm ]]; then
current_monitor=$(bspc query -m -M) current_monitor=$(bspc query -m -M)
# newest bspwm version retuns an id instead of the name
if [[ $current_monitor =~ ^0x ]]; then
current_monitor=$(bspc query -T -m | grep -Po '^{"name":.*?",' | \
awk -F ":" '{gsub("[\",]", ""); print $2}')
fi
elif [[ $wm == i3 ]]; then elif [[ $wm == i3 ]]; then
# I'd rather not make jq a dependency # I'd rather not make jq a dependency
current_monitor=$(i3-msg -t get_workspaces | sed 's/{"num"/\n/g' | \ current_monitor=$(i3-msg -t get_workspaces | sed 's/{"num"/\n/g' | \
@ -274,9 +279,18 @@ wm_autoset_for_all() {
# bspwm will use previous size when floating already # bspwm will use previous size when floating already
if [[ $wm == bspwm ]]; then if [[ $wm == bspwm ]]; then
map_pre() { map_pre() {
# newest (using "instance" names)
if [[ $(bspwm -v) =~ ^0.9.1 ]]; then
if [[ $1 =~ [A-Z] ]]; then
bspc rule -a "$1" -o state=floating
else
bspc rule -a \*:"$1" -o state=floating
fi
else
# compatability with older syntaxes
bspc rule -a "$1" -o state=floating bspc rule -a "$1" -o state=floating
# maintain compatability with old syntax
bspc rule -a "$1" -o floating=on bspc rule -a "$1" -o floating=on
fi
} }
elif [[ $wm == awesome ]]; then elif [[ $wm == awesome ]]; then
# awesome remembers size, but need to float and then set size first # awesome remembers size, but need to float and then set size first
@ -313,7 +327,8 @@ wm_autoset_for_hide_show() {
is_floating() { is_floating() {
# checking if the window id (converted from decimal to hex) is floating; empty if not floating # checking if the window id (converted from decimal to hex) is floating; empty if not floating
bspc query -T | grep -i "$(printf 0x%x "$1").*f-" || \ bspc query -T | grep -i "$(printf 0x%x "$1").*f-" || \
bspc query -T -w | grep '"state": "floating"' bspc query -T -w | grep '"state": "floating"' || \
bspc query -T -n | grep '"state":"floating"'
} }
elif [[ $wm == i3 ]]; then elif [[ $wm == i3 ]]; then
subtract_when_same=false subtract_when_same=false

Loading…
Cancel
Save