-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrofi-power
executable file
·53 lines (49 loc) · 1.19 KB
/
rofi-power
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
#!/usr/bin/env bash
# Rofi dmenu mode, -i make search case-insensitive, -l is the number of line
rofi_command() {
rofi -dmenu -i -config "$HOME/.config/rofi/power.rasi"
}
shutdown=" | Shutdown"
reboot=" | Restart"
lock=" | Lock"
suspend=" | Suspend"
logout=" | Logout"
options="$shutdown\n$reboot\n$logout\n$suspend\n$lock"
chosen="$(echo -e "$options" | rofi_command)"
echo "$chosen"
case $chosen in
"$shutdown")
systemctl poweroff
;;
"$reboot")
systemctl reboot
;;
"$lock")
# Install swaylock-effects for better configuration
# hyprlock
swaylock -f
;;
"$suspend")
mpc -q pause
amixer set Master mute
systemctl suspend
;;
"$logout")
# For Hyprland, Use Command for your WM/DE
if [[ "$DESKTOP_SESSION" == "hyprland" ]]; then
hyprctl dispatch exit
elif [[ "$DESKTOP_SESSION" == "sway" ]]; then
swaymsg exit
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
i3-msg exit
elif [[ "$DESKTOP_SESSION" == "river" ]]; then
riverctl exit
elif [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
openbox --exit
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
bspc quit
elif [[ "$DESKTOP_SESSION" == "xfce" ]]; then
killall xfce4-session
fi
;;
esac