From b6dc1280271f2155a92cd7ccd72190f0f4043e35 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 6 Oct 2019 21:21:59 +0100 Subject: [PATCH] Add power menu keyboard shortcut --- files/bin/rofi-powermenu | 33 +++++++++++++++++++++++++++++++++ files/i3.conf | 1 + 2 files changed, 34 insertions(+) create mode 100755 files/bin/rofi-powermenu diff --git a/files/bin/rofi-powermenu b/files/bin/rofi-powermenu new file mode 100755 index 0000000..11592e2 --- /dev/null +++ b/files/bin/rofi-powermenu @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +## Modified from https://gitlab.com/vahnrr/rofi-menus/blob/master/scripts/powermenu.sh + +set -e + +power_off="Power Off" +reboot="Reboot" +lock="Lock" +suspend="Suspend" +log_out="Log Out" + +options="$power_off\n$reboot\n$lock\n$suspend\n$log_out" + +chosen="$(echo -e "$options" | rofi -dmenu -p Shutdown? -no-custom -lines 5)" + +case $chosen in + $power_off) + systemctl poweroff + ;; + $reboot) + systemctl reboot + ;; + $lock) + xdotool key "Super_L+l" + ;; + $suspend) + systemctl suspend + ;; + $log_out) + i3-msg exit + ;; +esac diff --git a/files/i3.conf b/files/i3.conf index 276f318..f1a30ad 100644 --- a/files/i3.conf +++ b/files/i3.conf @@ -38,6 +38,7 @@ bindsym $mod+n exec --no-startup-id nautilus bindsym $mod+Shift+g exec --no-startup-id gvim bindsym Control+Shift+Escape exec --no-startup-id gnome-system-monitor bindsym Control+Q exec --no-startup-id /bin/false +bindsym $mod+Shift+Delete exec --no-startup-id rofi-powermenu # Screenshots