You are not logged in.
Having some time off during Thanksgiving, I switched from an i3 setup to a sway setup. I am using wayland native apps and have not installed xorg-xwayland package.
I wanted some help regarding switching monitor layouts on the fly. I have 2 monitors connected to my desktop -- but I also use the same monitors to connect to my work laptop via a dock. I'd like to be able to switch the monitor layouts on the fly depending on whether I want to work on my archlinux desktop or my work laptop and accordingly switch on or off the monitors for archlinux
Here's my i3 config which worked perfectly:
bindsym $super+Shift+m exec urxvt -e xrandr --output VGA-1 --auto --output DP-1 --auto --right-of VGA-1
bindsym $super+Shift+1 exec urxvt -e xrandr --output VGA-1 --auto --output DP-1 --off
bindsym $super+Shift+2 exec urxvt -e xrandr --output VGA-1 --off --output DP-1 --autoI would like to replicate the same using the sway output commands. How would I do this other than creating 3 separate scripts and running them on each keybind? I have searched the documentation but only found ways to set dual monitors but nothing related to changing the layout on the fly.
Thanks,
Last edited by Inxsible (2021-12-10 18:46:10)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
As an ex-Admin, I know this is frowned upon, but bump?
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
is this just not possible in Sway ??
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
How would I do this other than creating 3 separate scripts and running them on each keybind? I have searched the documentation but only found ways to set dual monitors but nothing related to changing the layout on the fly.
I'm not sure what you mean with "3 separate scripts" but I have this in my sway config:
bindsym $mod+Shift+m exec swaymsg 'output eDP-1 toggle'
bindsym $mod+Shift+r exec "swaymsg 'output eDP-1 pos 0 0' ; swaymsg 'output DP-1 pos 1920 0'"
bindsym $mod+Shift+o exec "swaymsg 'output eDP-1 pos 1920 0' ; swaymsg 'output DP-1 pos 0 0'"Well, there seems to be no "auto" and "left/right-of" options so you have to hardcode the monitor positions. EDIT: The first line toggles one monitor between "on" and "off" state, the second line puts DP-1 right of eDP-1 and the third line puts DP-1 left of eDP-1.
Last edited by demaio (2021-12-10 16:04:06)
Offline
Inxsible wrote:How would I do this other than creating 3 separate scripts and running them on each keybind? I have searched the documentation but only found ways to set dual monitors but nothing related to changing the layout on the fly.
I'm not sure what you mean with "3 separate scripts" but I have this in my sway config:
bindsym $mod+Shift+m exec swaymsg 'output eDP-1 toggle' bindsym $mod+Shift+r exec "swaymsg 'output eDP-1 pos 0 0' ; swaymsg 'output DP-1 pos 1920 0'" bindsym $mod+Shift+o exec "swaymsg 'output eDP-1 pos 1920 0' ; swaymsg 'output DP-1 pos 0 0'"Well, there seems to be no "auto" and "left/right-of" options so you have to hardcode the monitor positions. EDIT: The first line toggles one monitor between "on" and "off" state, the second line puts DP-1 right of eDP-1 and the third line puts DP-1 left of eDP-1.
Ok, let me try that out real quick
Alright, here's what I have now
bindsym $mod+Shift+m exec swaymsg "'output VGA-1 position 0 0' ; swaymsg 'output DP-1 position 1920 0'"
bindsym $mod+Shift+1 exec swaymsg output DP-1 toggle
bindsym $mod+Shift+2 exec swaymsg output VGA-1 toggleThe 2 commands with the toggle seem to work but the command bound to "m" doesn't work. However, I do have my default multihead setup during boot using
output VGA-1 position 0,0
output DP-1 position 1920,0earlier in the sway config
So even if I just toggle one or the other monitor, it seems to achieve what I had in i3, so I am a happy camper. I will remove the bindsym to m as it's not needed.
Thanks for your help.
Last edited by Inxsible (2021-12-10 18:45:43)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
bindsym $mod+Shift+m exec swaymsg "'output VGA-1 position 0 0' ; swaymsg 'output DP-1 position 1920 0'"... but the command bound to "m" doesn't work.
Perhaps because your quoting seems to be wrong. You could try this:
bindsym $mod+Shift+m exec "swaymsg 'output VGA-1 position 0 0' ; swaymsg 'output DP-1 position 1920 0'"Offline