blob: 87ac92c5ea7814d24d73f99a9aa39041b0242562 (
plain)
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
|
#!/usr/bin/env sh
#
# A rofi powered menu to execute power related action.
# Uses: amixer mpc poweroff reboot rofi rofi-prompt
power_off=''
reboot=''
lock=''
suspend='鈴'
log_out=''
chosen=$(printf '%s;%s;%s;%s;%s\n' "$power_off" "$reboot" "$lock" "$suspend" \
"$log_out" \
| rofi -theme '~/.config/rofi/themes/power.rasi' \
-dmenu \
-sep ';' \
-selected-row 2)
case "$chosen" in
"$power_off")
rofi-prompt --query 'Shutdown?' && poweroff
;;
"$reboot")
rofi-prompt --query 'Reboot?' && reboot
;;
"$lock")
# TODO Add your lockscreen command.
;;
"$suspend")
# Pause music and mute volume before suspending.
mpc --quiet pause
amixer set Master mute
# TODO Add your suspend command.
;;
"$log_out")
# TODO Add your log out command.
;;
*) exit 1 ;;
esac
|