dualmonitors
This is an old revision of the document!
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: bash
#!/bin/sh swaymsg 'output HDMI-A-1 disable' swaymsg 'output eDP-1 enable'
Both monitors — create ~/.local/bin/dual-monitor: bash
#!/bin/sh swaymsg 'output eDP-1 enable' swaymsg 'output HDMI-A-1 enable' swaymsg 'output HDMI-A-1 pos 1920 0'
Replace the output names with yours. The 1920 position is just an example; adjust it to match your laptop screen's logical width and preferred arrangement.
Make both scripts executable: bash
chmod +x ~/.local/bin/laptop-only ~/.local/bin/dual-monitor
Sway supports enabling and disabling individual outputs this way. GitHub
- Ordered List Item3. Assign shortcuts
Add these lines to ~/.config/sway/config: bash
bindsym $mod+F5 exec ~/.local/bin/laptop-only bindsym $mod+F6 exec ~/.local/bin/dual-monitor
Reload Sway: bash
swaymsg reload
Now you can use:
- Super + F5 — laptop screen only
- Super + F6 — laptop and external monitor
dualmonitors.1792845498.txt.gz · Last modified: by karcio
