Refactor powermenu to rofi modus
This commit is contained in:
parent
3d9ea5cffe
commit
49cacfe787
3 changed files with 47 additions and 31 deletions
46
.config/rofi/modes/powermenu
Executable file
46
.config/rofi/modes/powermenu
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#### User Options ###
|
||||
|
||||
#### Menu Options ###
|
||||
power_off_btn=""
|
||||
reboot_btn=""
|
||||
lock_btn=""
|
||||
suspend_btn="鈴"
|
||||
logout_btn=""
|
||||
|
||||
# grep -a since it assumes with our nullcodes etc that this is a binary file
|
||||
# grep -o to only leave the things we grep for
|
||||
case $(echo "$*" | grep -a -o -e "Shutdown" -e "Reboot" -e "Lockscreen" -e "Logout" -e "Suspend") in
|
||||
"Shutdown")
|
||||
systemctl poweroff
|
||||
;;
|
||||
"Reboot")
|
||||
systemctl reboot
|
||||
;;
|
||||
"Lockscreen")
|
||||
# Completely detach from the parent script
|
||||
# If in/outputs are not redirected, rofi will wait for the forked process as well.
|
||||
lockscreen rofi </dev/null >/dev/null 2>/dev/null &
|
||||
;;
|
||||
"Logout")
|
||||
i3-msg exit
|
||||
;;
|
||||
"Suspend")
|
||||
lockscreen rofi </dev/null >/dev/null 2>/dev/null &
|
||||
systemctl suspend
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$*" ]; then
|
||||
printf "\x00prompt\x1fPower> \n"
|
||||
# we can use pango markup to hide text which we can then search. Neat!
|
||||
printf "\0markup-rows\x1ftrue\n"
|
||||
printf "\0filter\x1fshutdown\n"
|
||||
|
||||
printf "<!-- Shutdown Poweroff --> %s\n" "$power_off_btn"
|
||||
printf "<!-- Reboot Restart --> %s\n" "$reboot_btn"
|
||||
printf "<!-- Lockscreen --> %s\n" "$lock_btn"
|
||||
printf "<!-- Suspend Sleep --> %s\n" "$suspend_btn"
|
||||
printf "<!-- Exit X Logout --> %s\n" "$logout_btn"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue