1
0
Fork 0

Add sway/wofi/foot Wayland desktop stack with per-host toggle

New opt-in feature for x86_64 desktops: sway + wofi + foot + swaybg +
swaylock + swayidle + grim + slurp + waybar + wl-clipboard. mako on
arch, dunst on debian (mako isn't packaged for debian).

Files:
- .chezmoi.yaml.tmpl: added data.sway flag (true on miche/byte/kaiser,
  false on Pis). Override per host with ~/.config/chezmoi/features/sway
  or ~/.config/chezmoi/features/no-sway marker files.
- run_once_40-install-sway.sh.tmpl: installs packages if .sway=true,
  exits 0 otherwise. Sets up the marker file.
- dot_config/{sway,foot,wofi,waybar,mako}/: existing configs from miche.

Per-host toggle workflow:
  # On any box, enable sway:
  touch ~/.config/chezmoi/features/sway
  chezmoi apply

  # On a sway-enabled box, disable it:
  touch ~/.config/chezmoi/features/no-sway
  rm ~/.config/chezmoi/features/sway
  chezmoi apply

Currently sway packages are already installed on miche (existed before
this commit). Byte will get them via the new run_once_40 script.
Pis (rye, crouton) are unaffected — install script early-returns.
This commit is contained in:
Rain 2026-06-22 14:23:56 -04:00
parent fe73bbecba
commit 6bbaa8f2f5
21 changed files with 965 additions and 1 deletions

View file

@ -0,0 +1,58 @@
#!/bin/bash
# toggle-dropdown.sh — toggle the dropdown foot terminal
# Writes debug info to /tmp/sway-f12.log so we can diagnose from SSH
LOG=/tmp/sway-f12.log
echo "=== $(date) F12/Super+grave pressed ===" >> "$LOG"
echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY" >> "$LOG"
echo "USER=$USER XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >> "$LOG"
# Find the sway socket
SOCK=$(ls -t /run/user/$(id -u)/sway-ipc.*.sock 2>/dev/null | head -1)
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
exit 1
fi
# Check if a foot window is in the scratchpad (hidden)
HIDDEN=$(SWAYSOCK=$SOCK swaymsg -t get_tree 2>>"$LOG" | python3 -c "
import sys, json
try:
tree = json.load(sys.stdin)
def find_app(node, app_id):
if node.get('app_id') == app_id and node.get('name', '').startswith('__i3'):
return node
for c in node.get('nodes', []) + node.get('floating_nodes', []):
r = find_app(c, app_id)
if r is not None:
return r
return None
dd = find_app(tree, 'foot')
print('hidden' if dd is not None else 'none')
except Exception as e:
print(f'err:{e}')
" 2>>"$LOG")
echo "HIDDEN=$HIDDEN" >> "$LOG"
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.
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
fi
echo "spawned foot" >> "$LOG"
fi
echo "=== done ===" >> "$LOG"