refactoring to more granular flakes and modules

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-10-21 22:12:23 -05:00
parent 6570da6f33
commit 50825c9b84
52 changed files with 2501 additions and 9 deletions

View file

@ -0,0 +1,19 @@
{
lib,
pkgs,
...
}:
{
environment.systemPackages = [
pkgs.tmux
];
environment.shellAliases = {
tat = "tmux attach-session";
t = "tmux";
};
environment.shellInit = lib.concatStringsSep "\n\n" [
(builtins.readFile ./tmux_helpers.sh)
];
}

View file

@ -0,0 +1,34 @@
tmux_window () {
cmd=${1:-}
case "${cmd}" in
rename)
if [ -z "${2:-}" ]; then
tmux setw automatic-rename
else
tmux rename-window "$2"
fi
;;
get)
printf '%s' "$(tmux display-message -p '#W')"
;;
status)
out="$(tmux show-window-options automatic-rename 2>/dev/null || true)"
if printf '%s' "$out" | grep -q 'automatic-rename on'; then
printf 'auto'
elif printf '%s' "$out" | grep -q 'automatic-rename off'; then
printf 'manual'
else
# If tmux returns nothing (option not set), default to auto
if [ -z "$out" ]; then
printf 'auto'
else
return 1
fi
fi
;;
*)
printf 'Usage: tmux_window {rename [NAME]|get|status}\n' >&2
return 2
;;
esac
}