2023-04-04 07:45:48 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# ____
|
|
|
|
# | _ \ _____ _____ _ __ _ __ ___ ___ _ __ _ _
|
|
|
|
# | |_) / _ \ \ /\ / / _ \ '__| '_ ` _ \ / _ \ '_ \| | | |
|
|
|
|
# | __/ (_) \ V V / __/ | | | | | | | __/ | | | |_| |
|
|
|
|
# |_| \___/ \_/\_/ \___|_| |_| |_| |_|\___|_| |_|\__,_|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# by Stephan Raabe (2023)
|
|
|
|
# -----------------------------------------------------
|
2023-11-10 16:12:15 -05:00
|
|
|
echo $XDG_SESSION_TYPE
|
|
|
|
if [ $XDG_SESSION_TYPE == "wayland" ]; then
|
|
|
|
lockapp=swaylock
|
|
|
|
else
|
|
|
|
lockapp=slock
|
|
|
|
fi
|
|
|
|
echo "Using $lockapp to lock the screen."
|
2023-04-04 07:45:48 -04:00
|
|
|
|
|
|
|
option1=" lock"
|
|
|
|
option2=" logout"
|
|
|
|
option3=" reboot"
|
|
|
|
option4=" power off"
|
|
|
|
|
|
|
|
options="$option1\n"
|
|
|
|
options="$options$option2\n"
|
|
|
|
options="$options$option3\n$option4"
|
|
|
|
|
2023-11-13 07:37:27 -05:00
|
|
|
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-power.rasi -i -no-show-icons -l 4 -width 30 -p "Powermenu")
|
2023-04-04 07:45:48 -04:00
|
|
|
|
|
|
|
case $choice in
|
|
|
|
$option1)
|
2023-11-10 16:12:15 -05:00
|
|
|
$lockapp ;;
|
2023-04-04 07:45:48 -04:00
|
|
|
$option2)
|
2023-10-17 08:57:21 -04:00
|
|
|
qtile cmd-obj -o cmd -f shutdown ;;
|
2023-04-04 07:45:48 -04:00
|
|
|
$option3)
|
|
|
|
systemctl reboot ;;
|
|
|
|
$option4)
|
|
|
|
systemctl poweroff ;;
|
|
|
|
esac
|
|
|
|
|