diff --git a/dot_config/sway/caffeine.sh b/dot_config/sway/caffeine.sh index 2793910..127405d 100755 --- a/dot_config/sway/caffeine.sh +++ b/dot_config/sway/caffeine.sh @@ -30,10 +30,14 @@ if [ -f "$FLAG" ]; then rm -f "$FLAG" killall swayidle 2>/dev/null "$HOME/.config/sway/start-swayidle.sh" & - notify-send -t 2000 "☕ Caffeine OFF" "Idle sleep enabled" 2>/dev/null + # No -t flag → mako's `default-timeout` (currently 5000ms) controls duration. + # Earlier this used -t 2000 (2 seconds) but that vanished faster than the + # user could see it — the click "appeared to do nothing" because the + # notification popped and self-cleared in 2s. mako config owns the timeout. + notify-send "☕ Caffeine OFF" "Idle sleep enabled" 2>/dev/null else # Turn ON caffeine — kill swayidle touch "$FLAG" killall swayidle 2>/dev/null - notify-send -t 2000 "☕ Caffeine ON" "Idle sleep disabled" 2>/dev/null + notify-send "☕ Caffeine ON" "Idle sleep disabled" 2>/dev/null fi diff --git a/dot_config/sway/toggle-dropdown.sh b/dot_config/sway/toggle-dropdown.sh index ac63c9b..c0ed1f3 100755 --- a/dot_config/sway/toggle-dropdown.sh +++ b/dot_config/sway/toggle-dropdown.sh @@ -1,6 +1,13 @@ #!/bin/bash # toggle-dropdown.sh — toggle the dropdown foot terminal # Writes debug info to /tmp/sway-f12.log so we can diagnose from SSH +# +# waybar's on-click context strips WAYLAND_DISPLAY, which swaymsg + foot +# both need. Source restore-wayland-env.sh at the top so the entire +# script runs with the right env (mirrors caffeine.sh's pattern). + +# shellcheck source=restore-wayland-env.sh +source "$HOME/.config/sway/restore-wayland-env.sh" LOG=/tmp/sway-f12.log echo "=== $(date) F12/Super+grave pressed ===" >> "$LOG" @@ -13,7 +20,7 @@ echo "SOCK=$SOCK" >> "$LOG" if [ -z "$SOCK" ]; then echo "ERROR: no sway socket found" >> "$LOG" - notify-send -t 2000 "sway: no IPC socket" 2>>"$LOG" || true + notify-send "sway: no IPC socket" 2>>"$LOG" || true exit 1 fi @@ -42,16 +49,11 @@ if [ "$HIDDEN" = "hidden" ]; then SWAYSOCK=$SOCK swaymsg '[app_id="foot"] scratchpad show' >>"$LOG" 2>&1 echo "toggled: scratchpad show" >> "$LOG" else - # Spawn a new foot. Pass through WAYLAND_DISPLAY explicitly. + # Spawn a new foot. WAYLAND_DISPLAY is now set by restore-wayland-env.sh. if [ -n "$WAYLAND_DISPLAY" ]; then WAYLAND_DISPLAY=$WAYLAND_DISPLAY foot >>"$LOG" 2>&1 & else - # try to find wayland-1 socket - if [ -S "/run/user/$(id -u)/wayland-1" ]; then - WAYLAND_DISPLAY=wayland-1 foot >>"$LOG" 2>&1 & - else - foot >>"$LOG" 2>&1 & - fi + foot >>"$LOG" 2>&1 & fi echo "spawned foot" >> "$LOG" fi diff --git a/dot_config/sway/wifi-menu.sh b/dot_config/sway/wifi-menu.sh index f47a54c..3fbbdfa 100755 --- a/dot_config/sway/wifi-menu.sh +++ b/dot_config/sway/wifi-menu.sh @@ -1,6 +1,13 @@ #!/bin/bash # wifi-menu.sh — wofi-based WiFi network picker using nmcli # Lists available networks, connects on selection. +# +# wofi needs WAYLAND_DISPLAY (it IS a Wayland client itself, so it can +# usually find the socket, but on a non-standard socket it's safer to +# be explicit). Source restore-wayland-env.sh at the top. + +# shellcheck source=restore-wayland-env.sh +source "$HOME/.config/sway/restore-wayland-env.sh" # Get list of networks: SSID, signal, security SELECTED=$(nmcli -t -f SSID,SIGNAL,SECURITY device wifi list --rescan yes 2>/dev/null | \ @@ -23,7 +30,9 @@ SELECTED=$(nmcli -t -f SSID,SIGNAL,SECURITY device wifi list --rescan yes 2>/dev # Extract SSID (everything after the signal bars + spaces) SSID=$(echo "$SELECTED" | sed 's/^[█░ ]* //; s/ 🔒$//') -# Connect +# Connect. No -t flag → mako's default-timeout (5000ms) controls the duration. +# Earlier used -t 3000/-t 5000; the inconsistency meant the user could +# blink and miss the success notification. Let mako config drive the value. nmcli device wifi connect "$SSID" 2>&1 | grep -q "successfully" && \ - notify-send -t 3000 "WiFi" "Connected to $SSID" || \ - notify-send -t 5000 "WiFi" "Failed to connect to $SSID" + notify-send "WiFi" "Connected to $SSID" || \ + notify-send "WiFi" "Failed to connect to $SSID"