Setup Multiple Monitors in Sway (Wayland)

Published 2016-11-02 on Anjan's Homepage

Sway boasts about its close compatibility with your previous i3 config. However, if you used xrandr or arandr to setup the location of your monitors, your monitors will most likely not be in the correct location when you open up sway. There is a simple fix to this:

Get the names of your outputs by running:

swaymsg -t get_outputs

I have two monitors: one 1440p monitor plugged into the dvi port (called `DVI-I-0` in swaymsg) and one 1080p monitor plugged into my HDMI port (called `HDMI-A-1` in swaymsg). Therefore, I would write the following in my config:

output DVI-I-0 resolution 2560x1440 position 0,0
output HDMI-A-1 resolution 1920x1080 position 2560,480

I have the HDMI monitor set at y position of 480 because I have the HDMI monitor on a stack of books. If put y position as 0, my mouse jumps lower to where it was on the DVI monitor when I move across screens. Changing this to 480 makes it so I have consistent movement when moving between monitors. Adjust the y value if you have monitors of different resolutions.

Other things you probably want to fix

If you assigned different workspaces to different monitors, you may want to change this now:

workspace 1 output DVI-0

Would be changed to:

workspace 1 output DVI-I-0

Similarly, throughout the config where you would have used your old display name (in the example DVI-0), you may now use your new display name (in the example DVI-I-0).

Feh no longer works to set wallpaper. Use the following command in your config for sway to set the wallpaper:

output HDMI-A-1 bg ~/wallpaper.png stretch
output DVI-I-0 bg ~/wallpaper2.png stretch

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~anjan/public-inbox@lists.sr.ht [mailing list etiquette]

Articles from blogs I follow around the net

These articles/blogs do not represent my own opinions or views.

Text processing on the Command Line - sharing my tools

Text processing on the command line - sharing my tools Introduction I'm quite fond of the command-line and spend a larger chunk of my life in a terminal emulator than I dare admit. I try to embrace the unix philosophy of using tools that "do one thing…

via Proycon's website July 7, 2024

Linux phones are not automatically secure

A common point in the Linux community is that escaping the walled garden of ecosystems like Android or iOS is already a means to higher security. Having no contact with Google or Apple servers ever again, nor cloud providers ever snooping on your private …

via TuxPhones - Linux phones, tablets and portable devices January 25, 2023

Generated by openring