From 061bbf62c1af95a8c51f040680c9610537cb3230 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 21 Apr 2026 01:24:52 +0100 Subject: sway: display-toggle re-enables laptop screen when no external present --- dot_config/sway/executable_display-toggle.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dot_config/sway/executable_display-toggle.sh') diff --git a/dot_config/sway/executable_display-toggle.sh b/dot_config/sway/executable_display-toggle.sh index b0e4d17..265ab6b 100755 --- a/dot_config/sway/executable_display-toggle.sh +++ b/dot_config/sway/executable_display-toggle.sh @@ -9,6 +9,12 @@ LAPTOP=$(echo "$OUTPUTS" | jq -r '[.[] | select(.name | test("^eDP")) | .name] | EXTERNAL=$(echo "$OUTPUTS" | jq -r '[.[] | select(.name | test("^eDP") | not) | .name] | first // empty') if [ -z "$EXTERNAL" ]; then + # No external connected: make sure the laptop screen is on. This recovers + # from an earlier "laptop-off" state after the external was unplugged. + if [ -n "$LAPTOP" ]; then + swaymsg output "$LAPTOP" enable pos 0 0 || true + echo "laptop-only" >"$STATE_FILE" + fi [ -z "$1" ] && notify-send "Display" "No external display connected" exit 0 fi -- cgit v1.2.3-70-g09d2