diff options
| author | 2026-04-17 10:54:07 +0100 | |
|---|---|---|
| committer | 2026-04-17 10:54:07 +0100 | |
| commit | f00a83257176cde1c6350a901fca89622938ebc8 (patch) | |
| tree | 8b5e92183233256eba076d25851b6a2db339a59a | |
| parent | b3479fa7eeaff6e6f43c942edcf69a463a53032b (diff) | |
| download | dotfiles-f00a83257176cde1c6350a901fca89622938ebc8.tar.gz dotfiles-f00a83257176cde1c6350a901fca89622938ebc8.tar.bz2 dotfiles-f00a83257176cde1c6350a901fca89622938ebc8.zip | |
fix: simplify display toggle to laptop-off/side-by-side
- Added --no-repeat to F7 binding (key repeat was firing script twice)
- Dropped broken mirror mode (sway has no native mirroring support)
- Removed wl-mirror dependency
- F7 now toggles between laptop-off and side-by-side
| -rw-r--r-- | KEYBINDS.md | 2 | ||||
| -rw-r--r-- | home/.config/sway/config | 3 | ||||
| -rwxr-xr-x | home/.config/sway/display-toggle.sh | 29 | ||||
| -rw-r--r-- | meta/wayland/PKGBUILD | 1 |
4 files changed, 5 insertions, 30 deletions
diff --git a/KEYBINDS.md b/KEYBINDS.md index b02c672..021be03 100644 --- a/KEYBINDS.md +++ b/KEYBINDS.md @@ -293,4 +293,4 @@ Mod key: `Super` (Mod4). Only personal additions beyond sway defaults listed. | `Super+Shift+n` | Dismiss all notifications | | `Super+Tab` | Next workspace | | `Super+Shift+Tab` | Previous workspace | -| `F7` | Cycle display mode (mirror/off/side-by-side) | +| `F7` | Toggle display mode (laptop-off/side-by-side) | diff --git a/home/.config/sway/config b/home/.config/sway/config index 854cb39..bbd2eb0 100644 --- a/home/.config/sway/config +++ b/home/.config/sway/config @@ -42,7 +42,6 @@ output * bg #282828 solid_color for_window [class="feh"] floating enable for_window [app_id="imv"] floating enable for_window [class="Tor Browser"] floating enable -for_window [app_id="at.yrlf.wl_mirror"] fullscreen enable # ── Standard keybinds (sway defaults) ───────────────────────────────────────── bindsym $mod+Return exec $term @@ -144,7 +143,7 @@ bindsym $mod+n exec makoctl dismiss bindsym $mod+Shift+n exec makoctl dismiss --all # Display mode switching -bindsym F7 exec ~/.config/sway/display-toggle.sh +bindsym --no-repeat F7 exec ~/.config/sway/display-toggle.sh # ── Bar ─────────────────────────────────────────────────────────────────────── bar { diff --git a/home/.config/sway/display-toggle.sh b/home/.config/sway/display-toggle.sh index a3a11e7..f39bf9b 100755 --- a/home/.config/sway/display-toggle.sh +++ b/home/.config/sway/display-toggle.sh @@ -1,10 +1,8 @@ #!/bin/sh -# Cycle display mode: laptop-off → side-by-side → mirror -# Usage: display-toggle.sh [init] +# Toggle display mode: laptop-off ↔ side-by-side # Bound to F7 in sway config; also runs at startup with "init" STATE_FILE="${XDG_RUNTIME_DIR:-/tmp}/display-mode" -MIRROR_PID="${XDG_RUNTIME_DIR:-/tmp}/wl-mirror.pid" OUTPUTS=$(swaymsg -t get_outputs -r) LAPTOP=$(echo "$OUTPUTS" | jq -r '[.[] | select(.name | test("^eDP")) | .name] | first // empty') @@ -15,43 +13,22 @@ if [ -z "$EXTERNAL" ]; then exit 0 fi -if [ -z "$LAPTOP" ]; then - exit 0 -fi - -# Stop any running wl-mirror -if [ -f "$MIRROR_PID" ]; then - kill "$(cat "$MIRROR_PID")" 2>/dev/null || true - rm -f "$MIRROR_PID" -fi +[ -z "$LAPTOP" ] && exit 0 -LAPTOP_WIDTH=$(echo "$OUTPUTS" | jq -r ".[] | select(.name == \"$LAPTOP\") | .current_mode.width") +LAPTOP_WIDTH=$(echo "$OUTPUTS" | jq -r ".[] | select(.name == \"$LAPTOP\") | .current_mode.width // .modes[0].width") [ -z "$LAPTOP_WIDTH" ] && LAPTOP_WIDTH=1920 -# On init, go straight to laptop-off; otherwise cycle if [ "$1" = "init" ]; then NEXT="laptop-off" else CURRENT=$(cat "$STATE_FILE" 2>/dev/null || echo "laptop-off") case "$CURRENT" in laptop-off) NEXT="side-by-side" ;; - side-by-side) NEXT="mirror" ;; *) NEXT="laptop-off" ;; esac fi case "$NEXT" in - mirror) - swaymsg output "$LAPTOP" enable || true - swaymsg output "$EXTERNAL" enable || true - swaymsg focus output "$EXTERNAL" || true - wl-mirror "$LAPTOP" & - echo $! > "$MIRROR_PID" - sleep 0.3 - swaymsg focus output "$LAPTOP" || true - echo "mirror" > "$STATE_FILE" - [ -z "$1" ] && notify-send "Display" "Mirror mode" - ;; laptop-off) swaymsg output "$LAPTOP" disable || true swaymsg output "$EXTERNAL" enable || true diff --git a/meta/wayland/PKGBUILD b/meta/wayland/PKGBUILD index 395366c..3d6ffbb 100644 --- a/meta/wayland/PKGBUILD +++ b/meta/wayland/PKGBUILD @@ -30,7 +30,6 @@ depends=( 'grim' 'slurp' 'wf-recorder' - 'wl-mirror' # Image viewer 'imv' |
