mirror of
https://github.com/zoriya/flake.git
synced 2026-05-24 23:45:55 +00:00
Kill tmux session when killing last pane
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user