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.

1 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.

A few ways to make money in FOSS

I work on free and open-source software full time, and I make a comfortable living doing it. And I don’t half-ass it: 100% of my code is free and open-source. There’s no proprietary add-ons, no periodic code dumps, just 100% bona-fide free and open source so…

via Drew DeVault's blog November 20, 2020

How to Make Biomass Energy Sustainable Again

From the Neolithic to the beginning of the twentieth century, coppiced woodlands, pollarded trees, and hedgerows provided people with a sustainable supply of energy, materials, and food.

via LOW←TECH MAGAZINE September 20, 2020

Eshell versus M-x shell

I’ve used and defended Eshell for years. Sadly, Eshell has some long standing issues that I grew tired of in the long run. So I’ve decided to switch to M-x shell and see how much of my Eshell workflow I could port. Language and the underlying shell pr…

via Pierre Neidhardt's homepage June 26, 2020

Generated by openring