[zsh/wlogout] Update logout script
This commit is contained in:
parent
74b7c89c25
commit
f7c45ac2ea
2 changed files with 22 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
{
|
||||
"label" : "logout",
|
||||
"action" : "hyprctl dispatch exit",
|
||||
"action" : "~/.config/zsh/.zlogout",
|
||||
"text" : "Logout",
|
||||
"keybind" : "e"
|
||||
}
|
||||
|
|
21
.config/zsh/.zlogout
Normal file → Executable file
21
.config/zsh/.zlogout
Normal file → Executable file
|
@ -1,6 +1,21 @@
|
|||
#!/bin/zsh
|
||||
|
||||
# Clear clipboard
|
||||
if [[ -n $WAYLAND_DISPLAY ]]; then
|
||||
wl-copy -c
|
||||
cliphist wipe
|
||||
fi
|
||||
|
||||
# Kill ssh-agent if it's the only opened session for this user
|
||||
if [[ $(who | grep "$USER" | wc -l) -le 1 ]]; then
|
||||
ssh-add -D
|
||||
pkill -u "$USER" -9 ssh-agent
|
||||
pkill -u "$USER" -9 pipewire
|
||||
pkill -u "$USER" -9 dbus-daemon
|
||||
killall -u "$USER" -9 kill-wine-explorer.sh
|
||||
fi
|
||||
|
||||
if [[ -n $HYPRLAND_INSTANCE_SIGNATURE ]]; then
|
||||
HYPRCMDS=$(hyprctl -j clients | jq -j '.[] | "dispatch closewindow address:\(.address); "')
|
||||
hyprctl -q --batch "$HYPRCMDS"
|
||||
hyprctl dispatch exit
|
||||
fi
|
||||
|
||||
loginctl terminate-session $XDG_SESSION_ID
|
||||
|
|
Loading…
Reference in a new issue