Kill tmux session when killing last pane

This commit is contained in:
2024-12-04 18:54:43 +01:00
parent c76c1909f1
commit a2c9d90243
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -43,7 +43,7 @@
}
];
# use swap only when strictly needed
boot.kernel.sysctl = { "vm.swappiness" = 1; };
boot.kernel.sysctl = { "vm.swappiness" = 0; };
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
+8
View File
@@ -237,6 +237,14 @@
# Create a new tmux session (with a random name) and attach.
if [[ -z "$TMUX" ]]; then
exec tmux -u new-session -s "#$(hexdump -n 4 -v -e '/1 "%02X"' /dev/urandom)"
else
# kill current sesion if we are quiting the only pane
function __onExit {
if [[ $(tmux list-panes -s | wc -l) == 1 ]]; then
tmux kill-session
fi
}
trap __onExit EXIT
fi
'';
initExtraBeforeCompInit = builtins.readFile ./comp.zsh;