Add Arch Wayland dotfiles: sway/waybar/kitty/nvim/zsh, idempotent installer

Auto-adapts sway workspace routing to however many monitors are
connected (laptop vs. desktop) instead of hardcoding output names.
This commit is contained in:
2026-08-21 22:59:26 -05:00
commit 5c57ee20f7
35 changed files with 870 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -Eeuo pipefail
slot=${1:-}
action=${2:-select}
if [[ ! "$slot" =~ ^([1-9]|10)$ ]]; then
printf 'Usage: %s <1-10> [select|move]\n' "${0##*/}" >&2
exit 2
fi
# Outputs are ordered left-to-right by position, not by name, so this works
# unmodified whether there is one output (laptop) or several (desktop):
# the focused output's rank in that order selects its block of 10 workspaces.
outputs=$(swaymsg -t get_outputs -r | jq -c 'sort_by(.rect.x)')
index=$(jq -r '[.[] | .focused] | index(true)' <<<"$outputs")
if [[ "$index" == null ]]; then
printf 'No focused output found\n' >&2
exit 1
fi
workspace=$((slot + index * 10))
case "$action" in
select) swaymsg workspace number "$workspace" >/dev/null ;;
move)
swaymsg move container to workspace number "$workspace" >/dev/null
;;
*)
printf 'Unknown action: %s\n' "$action" >&2
exit 2
;;
esac