mirror of
https://github.com/adi1090x/rofi.git
synced 2026-02-02 00:50:11 +01:00
add suspend-and-hibernate and hybrid sleep optios
This commit is contained in:
parent
7c6953721b
commit
79f9f9aa59
@ -14,14 +14,17 @@ dir="$HOME/.config/rofi/powermenu/type-1"
|
|||||||
theme='style-1'
|
theme='style-1'
|
||||||
|
|
||||||
# CMDs
|
# CMDs
|
||||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
uptime="$(uptime -p | sed -e 's/up //g')"
|
||||||
host=`hostname`
|
host=$(hostname)
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
shutdown=' Shutdown'
|
shutdown=' Shutdown'
|
||||||
reboot=' Reboot'
|
reboot=' Reboot'
|
||||||
lock=' Lock'
|
lock=' Lock'
|
||||||
suspend=' Suspend'
|
suspend=' Suspend'
|
||||||
|
hibernate=' Hibernate'
|
||||||
|
hybrid=' Hybrid Sleep'
|
||||||
|
susbernate=' Suspend then Hibernate'
|
||||||
logout=' Logout'
|
logout=' Logout'
|
||||||
yes=' Yes'
|
yes=' Yes'
|
||||||
no=' No'
|
no=' No'
|
||||||
@ -54,7 +57,7 @@ confirm_exit() {
|
|||||||
|
|
||||||
# Pass variables to rofi dmenu
|
# Pass variables to rofi dmenu
|
||||||
run_rofi() {
|
run_rofi() {
|
||||||
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
|
echo -e "$lock\n$suspend\n$hibernate\n$reboot\n$shutdown\n$hybrid\n$susbernate\n$logout" | rofi_cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute Command
|
# Execute Command
|
||||||
@ -69,6 +72,12 @@ run_cmd() {
|
|||||||
mpc -q pause
|
mpc -q pause
|
||||||
amixer set Master mute
|
amixer set Master mute
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
|
elif [[ $1 == '--hibernate' ]]; then
|
||||||
|
systemctl hibernate
|
||||||
|
elif [[ $1 == '--hybrid' ]]; then
|
||||||
|
systemctl hybrid-sleep
|
||||||
|
elif [[ $1 == '--susbernate' ]]; then
|
||||||
|
systemctl suspend-then-hibernate
|
||||||
elif [[ $1 == '--logout ' ]]; then
|
elif [[ $1 == '--logout ' ]]; then
|
||||||
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
|
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
|
||||||
openbox --exit
|
openbox --exit
|
||||||
@ -108,6 +117,15 @@ case ${chosen} in
|
|||||||
$suspend)
|
$suspend)
|
||||||
run_cmd --suspend
|
run_cmd --suspend
|
||||||
;;
|
;;
|
||||||
|
$hibernate)
|
||||||
|
run_cmd --hibernate
|
||||||
|
;;
|
||||||
|
$hybrid)
|
||||||
|
run_cmd --hybrid
|
||||||
|
;;
|
||||||
|
$susbernate)
|
||||||
|
run_cmd --susbernate
|
||||||
|
;;
|
||||||
$logout)
|
$logout)
|
||||||
run_cmd --logout
|
run_cmd --logout
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user