From d13c3a6e87f8fc23e6fb6e92d5d773f1cf9ad7be Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 5 Apr 2019 13:29:23 +0300 Subject: Alternate shutdown method using rofi -dmenu --- .config/i3/config##desktop.Linux.Lowe | 1 + bin/power.sh | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 bin/power.sh diff --git a/.config/i3/config##desktop.Linux.Lowe b/.config/i3/config##desktop.Linux.Lowe index 77f917c..fd1d432 100644 --- a/.config/i3/config##desktop.Linux.Lowe +++ b/.config/i3/config##desktop.Linux.Lowe @@ -172,6 +172,7 @@ mode " (L)ock (S)ignout (R)eboot (P)oweroff" { bindcode 66 mode "default" } bindsym $mod+Shift+e mode " (L)ock (S)ignout (R)eboot (P)oweroff" +bindsym $mod+Shift+Escape exec --no-startup-id ~/bin/power.sh bindsym $mod+r mode "resize" diff --git a/bin/power.sh b/bin/power.sh new file mode 100755 index 0000000..02051f1 --- /dev/null +++ b/bin/power.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.) +# +# Requirements: +# - rofi +# - systemd, but you can replace the commands for OpenRC or anything else +# +# Instructions: +# - Save this file as power.sh or anything +# - Give it exec priviledge, or chmod +x /path/to/power.sh +# - Run it + +chosen=$(echo -e "lock\nshutdown\nrestart" | rofi -dmenu -i) +# Info about some states are available here: +# https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description + +if [[ $chosen = "lock" ]]; then + betterlockscreen -l dimblur -t "Welcome back" +elif [[ $chosen = "shutdown" ]]; then + systemctl poweroff +elif [[ $chosen = "restart" ]]; then + systemctl reboot +fi -- cgit v1.2.3-70-g09d2