You are not logged in.
I am moving from i3 wm to sway wm, and I have almost all I need working. But there is only one thing that is bugging me: multiple monitor configuration.
In i3, I wrote a configuration snippet to create a mode with $mod+x, and then using a key:
- Putting the external monitor to the left with 'l'
- Putting it to the right with 'r'
- Disabling it with 'o'
- Mirroring it with 'm'
The snippet uses xrandr and is as follows:
set $mode_display AUX SCREEN: (l) LEFT (r) RIGHT (o) OFF (m) MIRROR
mode "$mode_display" {
bindsym l exec --no-startup-id xrandr --output $scr_aux --auto --left-of $scr_main --scale 1x1, mode "default"
bindsym r exec --no-startup-id xrandr --output $scr_aux --auto --right-of $scr_main --scale 1x1, mode "default"
bindsym o exec --no-startup-id xrandr --output $scr_aux --auto --off, mode "default"
bindsym m exec --no-startup-id xrandr --output $scr_aux --auto --scale-from $native --same-as $scr_main, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+x mode "$mode_display"
I have tried creating an equivalent solution for sway without success. Replacing the bindsym [lrom] lines with these:
bindsym l output $scr_aux enable, $scr_aux pos -1920 0, mode "default"
bindsym r output $scr_aux enable, output $scr_aux pos $native_width 0, mode "default"
bindsym o output $scr_aux disable, mode "default"
# Mirroring doesn't seem to be supported by sway
bindsym m mode "default"
I can switch on/off the external monitor, but both 'r' and 'l' options configure it to the left of the main laptop screen, I have not yet been able to set it to the right. Also it does not seem mirroring is supported, or at least I cannot find information about it neither on sway wiki nor on the sway-output manpage.
How can I get the external monitor to be placed to the right of the main monitor? Is there a way to mirror the main monitor on the external one?
Last edited by doragasu (2019-10-12 09:54:42)
Offline
I don't know anything about sway, but why don't you just use the same xrandr commands?
Offline
azagthoth: sway is a wayland compositor/wm. xrandr is only for Xorg.
Is there a way to mirror the main monitor on the external one?
Not yet. https://github.com/swaywm/sway/issues/1666
How can I get the external monitor to be placed to the right of the main monitor?
Try to configure everything with swaymsg first, then transfer the correct settings to your config.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Hi!
It seems that your question is answered here: https://www.reddit.com/r/i3wm/comments/ … _multiple/, although the thread is for i3, instead of sway.
There is nothing mentioned in the documentation, but separating commands with semicolon within bindsym works fine for me in sway's config file:
bindsym $mod+f1 output HDMI-A-2 pos 0 0 res 2560x1440; output eDP-1 pos 0 1440 res 1920x1080
Last edited by rolling.robot (2019-06-05 05:32:32)
Offline
I found your post on phoronix, so I thought I can try to give some tips here as an arch user too
I don't know exactly about the mirroring, but if you put both output on the same position all floating windows are mirrored, but every tiling window not, which is a bit weird.
Putting the display left and right is not as simple as with xrandr, but it seems that there are no negative position values possible, so you have to move wanted left screen to 0 0 and the right one to x-width / "scale value". At the bottom I have a working example.
If your screens are not connected then there is probably a gap between their positions.
$laptop = 1920x1080, scale=1.3 (1920/1.3 = 1476.92 -> 1477)
$external = 2560x1080 scale=1.0
bindsym $mod+n output $laptop pos 0 0; output $external pos 1477 0
bindsym $mod+m output $external pos 0 0; output $laptop pos 2560 0
Last edited by Kabbone (2019-08-28 17:39:15)
Offline
Thanks, I'll give it a try!
Offline
Finally I got time to test it, and it works, thanks! And guess what, negative offsets are also working!
The configuration I am finally using is:
# Screen modes. Note mirroring is not yet properly supported by sway :(
set $mode_display AUX SCREEN: (l) LEFT (r) RIGHT (o) OFF (m) MIRROR
mode "$mode_display" {
bindsym l output $scr_aux enable, output $scr_main pos 0 0, output $scr_aux pos -$native_width 0, mode "default"
bindsym r output $scr_aux enable, output $scr_main pos 0 0, output $scr_aux pos $native_width 0, mode "default"
bindsym m output $scr_aux enable, output $scr_main pos 0 0, output $scr_aux pos 0 0, mode "default"
bindsym o output $scr_aux disable, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+x mode "$mode_display"
As expected, mirroring mode does not quite work, but I think I can live with it.
Offline
ah nice, I thought at my test, the negatives weren't working, but perhaps I messed something up with the pixels there.
Offline