dualmonitors
Table of Contents
Set dual monitors
Find your monitor names
swaymsg -t get_outputs
You'll see names similar to:
- eDP-1 — laptop screen
- HDMI-A-1 — external monitor
Create two scripts
Laptop only — create ~/.local/bin/laptop-only:
#!/bin/sh swaymsg 'output HDMI-A-1 disable' swaymsg 'output eDP-1 enable'
Both monitors — create ~/.local/bin/dual-monitor:
#!/bin/sh # Enable both monitors swaymsg 'output eDP-1 enable' swaymsg 'output HDMI-A-1 enable' # Laptop screen: right swaymsg 'output eDP-1 position 0 0' # Samsung monitor: left swaymsg 'output HDMI-A-1 position -2560 0'
Replace the output names with yours. The 2560 position is just an example; adjust it to match your laptop screen's logical width and preferred arrangement.
Make both scripts executable:
chmod +x ~/.local/bin/laptop-only ~/.local/bin/dual-monitor
Sway supports enabling and disabling individual outputs this way.
Assign shortcuts
Add these lines to ~/.config/sway/config:
bindsym $mod+F5 exec ~/.local/bin/laptop-only bindsym $mod+F6 exec ~/.local/bin/dual-monitor
Reload Sway:
swaymsg reload
Now you can use:
- Super + F5 — laptop screen only
- Super + F6 — laptop and external monitor
dualmonitors.txt · Last modified: by karcio
