Closed Quasitikus closed 4 years ago
echo "desktop=^1" >> /tmp/ext_rules.log echo "desktop='^1'"
Notice the difference between the first one and the second one. The one you're actually echoing to standard output has the desktop index between single quotes.
Try "desktop=^1"
instead.
I guess you took the default configuration from bspwmrc and tried to apply it in external_rules. The thing is, the quoting works in bspwmrc because the shell doesn't pass the literal '
characters to the command. It's a feature of the shell.
On the other hand, in external_rules you're not using a shell, but a simple echo
(you have already quoted echo
s argument with double quotes). This causes the literal '
character to be output to standard output. This is why bspwm ignores your rule.
When I try to assign specific applications to specific desktops with external rules they simply act as if the external rules did not exist.
bspwmrc:
! /bin/sh
sxhkd &
bspc monitor -d 1-www 2-fm 3-work 4-game 5-media 6-misc 7-vim 8-control 9-term 10-sys
colors
bspc config normal_border_color #333333 bspc config active_border_color #333333 bspc config focused_border_color #4c7899 bspc config presel_feedback_color #2e9ef4
add new windows
bspc config automatic_scheme longest_side bspc config initial_polarity second_child bspc config borderless_monocle true bspc config gapless_monocle true bspc config split_ratio 0.5
working with windows(resizing, moving)
bspc config pointer_modifier mod4 bspc config pointer_action1 move bspc config pointer_action2 resize_side bspc config pointer_action3 resize_corner
monitor and desktop
bspc config remove_unplugged_monitors true bspc config window_gap 0
nodes
bspc config honor_size_hints true
bspc config border_width 1
rules
bspc config external_rules_command ${HOME}/.config/bspwm/external_rules bspc rule -a Screenkey manage=off
external_rules:
! /usr/bin/env sh
commands
xtitle() { xwininfo -id $1 | grep "Window id" | cut -d' ' -f5- }
variables
wid=$1 class=$2 instance=$3 consequences=$4
echo $1 $2 $3 $4 >> /tmp/ext_rules.log
assign to specific desktops
case "$class" in "Alacritty"|"st") [ xtitle $wid = "vifm" ] && echo "desktop='^2'" ;; "firefox"|"Thunderbird") echo "desktop=^1" >> /tmp/ext_rules.log echo "desktop='^1'" ;; "Thunderbird") echo "desktop='^2'" ;; "Minecraft") echo "desktop='^4'" ;; "mpv") echo "desktop=^5" >> /tmp/ext_rules.log echo "dekstop=^5" ;; esac
As you may see, I tried to verify wether the scripts gets called. But according to the file /tmp/ext_rules.log everything works: 31457284 Alacritty Alacritty monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= 46137347 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= 46137347 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 18874370 mpv gl monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^5 46137347 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 60817412 Alacritty Alacritty monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= 46137407 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137418 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137468 firefox Firefox monitor= desktop= node= state=floating layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=on follow=off manage=on focus=on border=on rectangle= desktop=^1 46137479 firefox Firefox monitor= desktop= node= state=floating layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=on follow=off manage=on focus=on border=on rectangle= desktop=^1 46137496 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137523 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137554 firefox Places monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137347 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137398 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 58720259 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1 46137347 firefox Navigator monitor= desktop= node= state= layer= split_dir= split_ratio=0.000000 hidden=off sticky=off private=off locked=off marked=off center=off follow=off manage=on focus=on border=on rectangle= desktop=^1