From 3d9ea5cffecd69f05e3115fd41e171751c00790c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 5 Sep 2019 13:04:18 +0200 Subject: [PATCH] Configure rofi-powermenu and lockscreen script Use rofi-powermenu to show options for suspend,reboot, shutdown, lockscreen, log out. Can be invoked with . Other power option shortcuts have been removed from quick access through sxhkd or i3. Lockscreen can still be quickly set with . Lockscreen now resides in its own script to provide one source of truth, and in case it is further customized in the future. --- .config/sxhkd/sxhkdrc | 19 ++++-------- .local/bin/lockscreen | 8 +++++ .../rofi/modes => .local/bin}/rofi-powermenu | 29 +++++++------------ 3 files changed, 24 insertions(+), 32 deletions(-) create mode 100755 .local/bin/lockscreen rename {.config/rofi/modes => .local/bin}/rofi-powermenu (58%) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 4c92fdf..4f57c15 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -1,31 +1,22 @@ # universal x key bindings # Open terminal emulator (TODO find way to not hard-code alacritty, perhaps ENV vars) -mod4 + Return +super + Return exec alacritty # open quick start menu -mod4 + space +super + space exec i3-dmenu-desktop # System functionality # Enable lock screen (TODO does not stop music, etc yet -# see https://github.com/LukeSmithxyz/voidrice/blob/archi3/.config/sxhkd/sxhkdrc for that) super + x - i3lock -e -f -c 1d2021 + lockscreen -# Shut down system -super + shift + x - dmenuprompt "SHUT DOWN computer?" "sudo -A shutdown -h now" danger - -# Exit X session +# Open System Power Menu super + BackSpace - dmenuprompt "Log out of X Session?" "i3-msg exit" warn - -# Restart system -super + shift + BackSpace - dmenuprompt "Reboot computer?" "sudo reboot" danger + rofi-powermenu # enable function (/media) key functionality # TODO: set up next song, previous song, pause, etc diff --git a/.local/bin/lockscreen b/.local/bin/lockscreen new file mode 100755 index 0000000..f242276 --- /dev/null +++ b/.local/bin/lockscreen @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# In case we want to pause any players +# (see https://github.com/LukeSmithxyz/voidrice/blob/archi3/.config/sxhkd/sxhkdrc for that) +# mpc -q pause +# amixer set Master mute + +i3lock -e -f -c 1d2021 diff --git a/.config/rofi/modes/rofi-powermenu b/.local/bin/rofi-powermenu similarity index 58% rename from .config/rofi/modes/rofi-powermenu rename to .local/bin/rofi-powermenu index 088325e..fdf1049 100755 --- a/.config/rofi/modes/rofi-powermenu +++ b/.local/bin/rofi-powermenu @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/usr/bin/env sh rofi_command="rofi -theme themes/powermenu.rasi" @@ -13,25 +13,18 @@ logout_btn="" chosen="$(printf "%s\n%s\n%s\n%s\n%s" "$power_off" "$reboot" "$lock" "$suspend_btn" "$logout_btn" | $rofi_command -dmenu -selected-row 2)" case $chosen in $power_off) - printf "poweroff" - # systemctl poweroff - ;; + systemctl poweroff + ;; $reboot) - printf "reboot" - # systemctl reboot - ;; + systemctl reboot + ;; $lock) - printf "lock" - # light-locker-command -l - ;; + lockscreen + ;; $suspend_btn) - printf "suspend" - # mpc -q pause - # amixer set Master mute - # systemctl suspend - ;; + systemctl suspend + ;; $logout_btn) - printf "logout_btn" - # i3-msg exit - ;; + i3-msg exit + ;; esac