diff --git a/nix/packages/by-name/tmux-sessionizer/package.nix b/nix/packages/by-name/tmux-sessionizer/package.nix new file mode 100644 index 00000000..121ee8db --- /dev/null +++ b/nix/packages/by-name/tmux-sessionizer/package.nix @@ -0,0 +1,23 @@ +{ + writeShellApplication, + tmux, + symlinkJoin, +}: let + tmux-register-session = writeShellApplication { + name = "__tmux-register-session"; + runtimeInputs = [tmux]; + text = '' + last=/tmp/TMUX_LAST + this="$(tmux display-message -p '#S')" + if [ ! -f "$last" ] || [ "$(cat "$last")" != "$this" ]; then + echo "$this" >"$last" + fi + ''; + }; +in + symlinkJoin { + name = "tmux-sessionizer"; + paths = [ + tmux-register-session + ]; + }