Repository navigation
Expand file tree
/
Copy pathexit
More file actions
executable file
·58 lines (55 loc) · 1.92 KB
/
Copy pathexit
File metadata and controls
executable file
·58 lines (55 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/bash
function reset_ui {
# Cleanup IPC must not delay locking while the compositor is suspending.
u_music pause 2&> /dev/null &
qs -p "$HOME/dotfiles/linux/config/quickshell/shell.qml" ipc call notifications clearVisible 2&> /dev/null || true
}
case "$1" in
lock)
reset_ui
# Ensure Quickshell notifications are dismissed before launching the lock screen.
qs -p "$HOME/dotfiles/linux/config/quickshell/shell.qml" ipc call notifications dismissTag lock-warning 2> /dev/null || true
qs -p "$HOME/dotfiles/linux/config/quickshell/shell.qml" ipc call notifications clearVisible 2> /dev/null || true
play "$HOME/dotfiles/sounds/screen-lock-click.mp3" &> /dev/null &
session_type="${XDG_SESSION_TYPE:-}"
if [[ -z "$session_type" ]]; then
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
session_type=wayland
elif [[ -n "${DISPLAY:-}" ]]; then
session_type=x11
fi
fi
case "$session_type" in
x11) u_blurlock ;;
# Use the repository path directly. A stale, removed u_hyprlock symlink
# can still be returned by a shell command hash, causing a failed lock.
wayland)
if "$HOME/dotfiles/linux/scripts/hyprlock"; then
play "$HOME/dotfiles/sounds/desktop-login2.ogg" &> /dev/null &
fi
;;
esac ;;
logout)
case "$XDG_SESSION_DESKTOP" in
i3|i3wm) i3-msg exit ;;
Hyprland) hyprctl dispatch exit 1 ;;
*) loginctl terminate-session "$(loginctl session-status | awk 'NR==1{print $1}')" ;;
esac ;;
sleep|suspend)
reset_ui
u_lock-before-sleep
systemctl suspend ;;
hibernate)
reset_ui
u_lock-before-sleep
systemctl hibernate ;;
reboot|reset)
systemctl reboot ;;
shutdown|poweroff)
systemctl poweroff ;;
*)
echo "== ! exit: missing or invalid argument ! =="
echo "Try again with: lock | logout | suspend | hibernate | reboot | shutdown"
exit 2 ;;
esac
exit 0