Open dongdongbh opened 7 months ago
since you are using bspc wm -O
to arrange the monitors:
my guess it that that reorder_monitors() is run from update_root() and resets this order back to xrandr's default geometry based order. there are a few paths to update_root() including update_monitors.
if that function is responsible you should see monitor_geometry subscription events.
since you are using
bspc wm -O
to arrange the monitors: my guess it that that reorder_monitors() is run from update_root() and resets this order back to xrandr's default geometry based order. there are a few paths to update_root() including update_monitors. if that function is responsible you should see monitor_geometry subscription events.
So I have to modify the bspwm source code and recompile it to make it work in my intended way?
first, i would just confirm that is the problem you are having.
the way i would deal with it personally - set the desired order in xorg instead of bspwm. I have used dynamic multimonitor for years with bspwm and never have needed to deal with this issue.
alternatively, maybe this patch would work. I've not tested it - at least not recently.
first, i would just confirm that is the problem you are having.
the way i would deal with it personally - set the desired order in xorg instead of bspwm. I have used dynamic multimonitor for years with bspwm and never have needed to deal with this issue.
alternatively, maybe this patch would work. I've not tested it - at least not recently.
I think maybe my setup is a bit strange, I want my HDMI-1 monitor to be physically on the left of DP-3, with DP-3 set as the primary monitor, but HDMI-1 hosting desktops 9 and 10 in BSPWM, not desktops 1 and 2 in BSPWM, that's why I set the desired order in bspwm.
you can still get the desired behavior with sxhkd - can't say anything about polybar though.
my setup is a little simpler in that i only use one desktop per secondary monitor - this makes keybinding simple using primary:^index
and primary#next:^index
to refer to desktops eg:
# focus specific desktop
super + {1-4}
bspc desktop primary:^{1-4} -f
super + 0
bspc desktop primary#next:focused -f || \
bspc desktop primary:^5 -f
but you can also use a script to translate the indexes to desktop id's based on some hardcoded order. ran like: scriptname desktop ^7 -f
mapfile -t d < <( bspc query -D -m HDMI-A-0;
bspc query -D -m DisplayPort-2)
cmd=( "$@" )
for ind in "${!cmd[@]}"; do
case "${cmd[$ind]}" in
^*)
[[ -n "${d["${cmd[$ind]:1}"-1]}" ]] || exit
cmd[$ind]="${d["${cmd[$ind]:1}"-1]}"
;;
esac
done
bspc "${cmd[@]}"
or try that patch and see if it works out.
none of this is to say this isn't a valid bug - if the cause is an unwarranted reorder_monitors(), it has been reported previously.
you can still get the desired behavior with sxhkd - can't say anything about polybar though. my setup is a little simpler in that i only use one desktop per secondary monitor - this makes keybinding simple using
primary:^index
andprimary#next:^index
to refer to desktops eg:# focus specific desktop super + {1-4} bspc desktop primary:^{1-4} -f super + 0 bspc desktop primary#next:focused -f || \ bspc desktop primary:^5 -f
but you can also use a script to translate the indexes to desktop id's based on some hardcoded order. ran like:
scriptname desktop ^7 -f
mapfile -t d < <( bspc query -D -m HDMI-A-0; bspc query -D -m DisplayPort-2) cmd=( "$@" ) for ind in "${!cmd[@]}"; do case "${cmd[$ind]}" in ^*) [[ -n "${d["${cmd[$ind]:1}"-1]}" ]] || exit cmd[$ind]="${d["${cmd[$ind]:1}"-1]}" ;; esac done bspc "${cmd[@]}"
or try that patch and see if it works out.
none of this is to say this isn't a valid bug - if the cause is an unwarranted reorder_monitors(), it has been reported previously.
Thanks, currently I use sxhkd workaround, but the desktop number still changes, the first desktop will change to 2 after a while. The hard code one seems better since it didn't care about the desktop number.
just a note:
Thanks, currently I use sxhkd workaround
https://github.com/dongdongbh/dotfiles/blob/master/sxhkd/.config/sxhkd/bspwm.sxhkdrc#L86-L92
the example i gave above is using primary (and primary#next) monitor as the reference - so, the desktop index is per monitor. it will not change if monitor order changes.
eg primary:^1
and primary#next:^1
refer to two different desktops.
bspc desktop primary:^5 -f
I can not use primary keyword on my setting.
bspc desktop `primary`:^1 -f
zsh: no matches found: primary:^1
ensure that you have set a primary monitor in X - even if you have only a single monitor connected.
already set that, but doesn't work
xrandr --query | grep primary
DP-3 connected primary 3840x2160+2160+0 (normal left inverted right x axis y axis) 597mm x 336mm
bspc desktop `primary`:^1 -f
are those backticks a visual artifact, or are they in the command? they should not be.
bspc desktop primary:^1 -f
other then that i have not a clue. but you can also use monitor names instead eg
bspc desktop DP-3:^1
bspc desktop primary:^1 -f
zsh: no matches found: primary:^1
bspc desktop DP-3:^1
zsh: no matches found: DP-3:^1
oh. it's a zsh error. if you have EXTENDED_GLOB on you need to either quote or \
escape the carat.
bspc desktop primary:\^1 -f
# or
bspc desktop "DP-3:^1"
Now
bspc desktop primary:\^1 -f
# or
bspc desktop "DP-3:^1 -f"
works.
But bspc desktop primary#next:\^1 -f
not work, and bspc desktop "HDMI-1:^1" -f
works.
bspc desktop primary#next:\^1 -f
zsh: no matches found: primary#next:^1
zsh: no matches found: primary#next:^1
that is a zsh error again. with extended glob active you need to also escape hashes. for those types of errors you should check the shell's documentation.
I disabled the glob, and it still does not work
➜ ~ setopt NO_EXTENDED_GLOB
➜ ~ bspc desktop primary#next:^1 -f
desktop: Invalid descriptor found in 'primary#next:^1'.
➜ ~ bspc desktop 'primary#next:^1' -f
desktop: Invalid descriptor found in 'primary#next:^1'.
01107f9 , 4b6f3761b0094fd911de84b1b0ccd2f3721b7a19 - is newer then ver 0.9.10. i'd guess that is the issue. my apologies, i didn't realize that commit isn't in a release.
Seems this repository hasn't update for a long time, it is not actively developing.
there have been a decent amount of commits since last release, but yeah it's been a while.
Issue Description:
I am encountering an issue with desktop assignments swapping between monitors in my dual-monitor setup using BSPWM. Initially, upon system start, desktops are correctly assigned with my main monitor (DP-3) hosting desktops 1 to 8 and my side monitor (HDMI-1), which is set up to the left of the main monitor, hosting desktops 9 and 10. However, after some period of use, the desktop assignment swaps - the side monitor starts showing desktops 1 and 2, and the main monitor shows desktops 3 to 10.
This issue seems to occur without any manual changes to the configuration or physical adjustments to the monitor setup. It appears as though BSPWM might be reordering the desktops based on the physical arrangement of the monitors (left to right) automatically in the background.
Steps to Reproduce:
Expected Behavior:
Desktops should remain on their originally assigned monitors unless manually reconfigured. The main monitor should consistently keep desktops 1 to 8, and the side monitor should keep desktops 9 and 10.
Actual Behavior: Desktops unexpectedly swap between the two monitors after some period of use, disrupting the workflow and desktop organization.
Setup Details:
Operating System: Ubuntu server 22.04 BSPWM Version: 0.9.10 sxhkd Version: 0.6.2 Relevant Configuration Files: my config files can be found here
Additional Information: