File tree 2 files changed +63
-0
lines changed
2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Script: popup-powermenu
3
+ A popup menu made with Yad that provides a window giving options to shutdown, reboot, logout etc..
4
+
5
+
6
+ ## Requirements
7
+
8
+ This script assumes you have the [ yad] ( https://github.com/v1cont/yad ) package installed.
9
+
10
+
11
+ ## Configuration
12
+
13
+
14
+
15
+ Change these commands for your particular system, or add your own custom options as well:
16
+
17
+ ``` sh
18
+ case $action in
19
+ Shutdown* ) cmd=" poweroff" ;;
20
+ Reboot* ) cmd=" reboot" ;;
21
+ Logout* ) cmd=" echo logout" ;;
22
+ Suspend* ) cmd=" echo suspend" ;;
23
+ * ) exit 1 ;;
24
+ esac
25
+
26
+ ```
27
+
28
+ Add this module to your polybar config:
29
+
30
+
31
+ ``` ini
32
+ [module/powermenu]
33
+ type = custom/text
34
+ content = " "
35
+ content-foreground = ${color.alert}
36
+ click-left = /path-where-script-is-saved/powermenu.sh &
37
+
38
+ ```
39
+ Change the path name and the icon as you require.
40
+ Finally add the module to the bar.
41
+
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ action=$( yad --width 300 --entry --undecorated --title " System Logout" \
4
+ --image=gnome-shutdown \
5
+ --button=" ok:0" --button=" cancel:1" \
6
+ --text " Choose action:" \
7
+ --entry-text \
8
+ " Shutdown" " Reboot" " Logout" " Suspend" )
9
+
10
+ ret=$?
11
+ [ $ret -eq 1 ] && exit 0
12
+
13
+
14
+ case $action in
15
+ Shutdown* ) cmd=" poweroff" ;;
16
+ Reboot* ) cmd=" reboot" ;;
17
+ Logout* ) cmd=" bspc quit" ;;
18
+ Suspend* ) cmd=" echo suspend" ;;# change the command for suspend and logging out wrt to your convenience
19
+ * ) exit 1 ;;
20
+ esac
21
+
22
+ eval exec " $cmd "
You can’t perform that action at this time.
0 commit comments