mirror of
https://github.com/adi1090x/rofi.git
synced 2025-12-10 04:22:48 +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'
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
host=`hostname`
|
||||
uptime="$(uptime -p | sed -e 's/up //g')"
|
||||
host=$(hostname)
|
||||
|
||||
# Options
|
||||
shutdown=' Shutdown'
|
||||
reboot=' Reboot'
|
||||
lock=' Lock'
|
||||
suspend=' Suspend'
|
||||
hibernate=' Hibernate'
|
||||
hybrid=' Hybrid Sleep'
|
||||
susbernate=' Suspend then Hibernate'
|
||||
logout=' Logout'
|
||||
yes=' Yes'
|
||||
no=' No'
|
||||
@ -54,7 +57,7 @@ confirm_exit() {
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
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
|
||||
@ -69,6 +72,12 @@ run_cmd() {
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
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
|
||||
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
|
||||
openbox --exit
|
||||
@ -108,6 +117,15 @@ case ${chosen} in
|
||||
$suspend)
|
||||
run_cmd --suspend
|
||||
;;
|
||||
$hibernate)
|
||||
run_cmd --hibernate
|
||||
;;
|
||||
$hybrid)
|
||||
run_cmd --hybrid
|
||||
;;
|
||||
$susbernate)
|
||||
run_cmd --susbernate
|
||||
;;
|
||||
$logout)
|
||||
run_cmd --logout
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user