Multi-Monitor in bspwm

Hello,

I have it working to the point that I have picture on all monitors and polybar is present on each.

But I can only switch workspace/desktop with super + number on one monitor.

Is there a way to make it switch on focused monitor?

Or set it ctrl + number for left monitor, super + number for middle and alt + number for right?
Thats how I have it in sway right now.

I have this in bspwmrc:

bspc monitor DP1-2 -d I II III IV V VI VII VIII IX X
bspc monitor DP2-1 -d I II III IV V VI VII VIII IX X
bspc monitor DP2-2 -d I II III IV V VI VII VIII IX X 

I think the issue with what you are trying to do would be defining the β€œfocused monitor”. I don’t know of a way to bring whatever desktop you choose to the current active monitor (there could be a way though, I’m certainly not a pro). There are certainly set ups where you could have specific desktops on specific monitors though and the moving through those with the set shortcuts would also move you around to different monitors. Hopefully this helps some and if not we can wait for one of the real pros to chime in.

Thought I should answer a bit of my own question.
I have now manage to get it to switch on focused monitor using super + number.
I can also manage to get it to send to other workspace on focused monitor.

What does not work yet is sending to other montior.

This is what I changed so far:

super + {_,shift + }{1-9,0}
	bspc {desktop -f,node -d} '^{1-9,10}'   

To:

super + {_,shift + }{1-9,0}
107   bspc {desktop -f,node -d} focused:'^{1-9,10}'    

Hi guys, this makes it more fun with multiple-monitors

focus or send to the given desktop

{alt,ctrl,super + shift} + {1-9,0}
{ bspc desktop --focus
, bspc desktop --swap
, bspc node --to-desktop
} {I,II,III,IV,V,VI,VII,VIII,IX,X}

and

keep bspwm monitors synced

ctrl + alt + Right
bspc monitor -f DP-0 ; bspc desktop -f next ; bspc monitor -f HDMI-0 ; bspc desktop -f next

ctrl + alt + Left
bspc monitor -f DP-0 ; bspc desktop -f prev; bspc monitor -f HDMI-0 ; bspc desktop -f prev

Anybody here ?

Hi guys check out this script it works great took me a while to build and test it but works really great !

#!/bin/sh

#this script swaps 7 desktops of the first en second monitor and also swaps their names.

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^1’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^1’ --names)” || exit 1
bspc desktop β€˜^1:^1’ -n β€œ$dst_desktop_name” -s β€˜^2:^1’
bspc desktop β€˜^1:^1’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^2’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^2’ --names)” || exit 1
bspc desktop β€˜^1:^2’ -n β€œ$dst_desktop_name” -s β€˜^2:^2’
bspc desktop β€˜^1:^2’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^3’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^3’ --names)” || exit 1
bspc desktop β€˜^1:^3’ -n β€œ$dst_desktop_name” -s β€˜^2:^3’
bspc desktop β€˜^1:^3’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^4’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^4’ --names)” || exit 1
bspc desktop β€˜^1:^4’ -n β€œ$dst_desktop_name” -s β€˜^2:^4’
bspc desktop β€˜^1:^4’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^5’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^5’ --names)” || exit 1
bspc desktop β€˜^1:^5’ -n β€œ$dst_desktop_name” -s β€˜^2:^5’
bspc desktop β€˜^1:^5’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^6’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^6’ --names)” || exit 1
bspc desktop β€˜^1:^6’ -n β€œ$dst_desktop_name” -s β€˜^2:^6’
bspc desktop β€˜^1:^6’ -n β€œ$src_desktop_name”

src_desktop_name=β€œ$(bspc query -D -d β€˜^1:^7’ --names)” || exit 1
dst_desktop_name=β€œ$(bspc query -D -d β€˜^2:^7’ --names)” || exit 1
bspc desktop β€˜^1:^7’ -n β€œ$dst_desktop_name” -s β€˜^2:^7’
bspc desktop β€˜^1:^7’ -n β€œ$src_desktop_name”

Made the script with love hope you guys want to try it out :slight_smile:

3 Likes

Hi Guys if you divide all 7 scripts in each of its own bash file it’s even works better

I have it like this in my sxhkdrc file

ctrl + alt + 1
~/.config/bspwm/scripts/swappy1.sh

ctrl + alt + 2
~/.config/bspwm/scripts/swappy2.sh

ctrl + alt + 3
~/.config/bspwm/scripts/swappy3.sh

ctrl + alt + 4
~/.config/bspwm/scripts/swappy4.sh

ctrl + alt + 5
~/.config/bspwm/scripts/swappy5.sh

ctrl + alt + 6
~/.config/bspwm/scripts/swappy6.sh

ctrl + alt + 7
~/.config/bspwm/scripts/swappy7.sh

I did call it swappy just to keep it short :wink: