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/ [mailing list etiquette]

Articles from blogs I follow around the net

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

Linux development is distributed - profoundly so

The standard introduction to git starts with an explanation of what it means to use a “distributed” version control system. It’s pointed out that every developer has a complete local copy of the repository and can work independently and offline, often contra…

via Blogs on Drew DeVault's blog September 2, 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

Thermoelectric Stoves: Ditch the Solar Panels?

Wood stoves equipped with thermoelectric generators can produce electricity that is more sustainable, more reliable, and less costly than power from solar PV panels.

via LOW←TECH MAGAZINE May 26, 2020

Generated by openring