From 56bb277e07bfceb2668b538c76fc488562054f30 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Tue, 4 Apr 2023 13:45:48 +0200 Subject: [PATCH] Add Powermenu script --- polybar/config.ini | 21 ++++++++++++++------- qtile/config.py | 2 +- scripts/powermenu.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 8 deletions(-) create mode 100755 scripts/powermenu.sh diff --git a/polybar/config.ini b/polybar/config.ini index c06246e..1e2fbb3 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -30,19 +30,26 @@ module-margin = 2 separator = "" separator-foreground = ${colors.disabled} font-0 = "Fira Sans SemiBold:size=11;1" -font-1 = "Font Awesome 6 Free Solid:pixelsize=12;2" -modules-left = xworkspaces +font-1 = "Font Awesome 6 Free Solid:pixelsize=11;2" +modules-left = mymenu xworkspaces modules-center = xwindow -modules-right = myarrow filesystem pulseaudio xkeyboard memory cpu date +modules-right = filesystem pulseaudio xkeyboard memory cpu date myexit cursor-click = pointer cursor-scroll = ns-resize enable-ipc = true ; tray-position = right -[module/myarrow] +[module/mymenu] type = custom/text content-foreground = ${colors.primary} -content = "" +content = " " +click-left = "rofi -show drun -icon-theme 'Papirus' -show-icons" + +[module/myexit] +type = custom/text +content-foreground = ${colors.primary} +content = " " +click-left = "~/dotfiles/scripts/powermenu.sh" [module/xworkspaces] type = internal/xworkspaces @@ -61,8 +68,8 @@ label-empty = %name% label-empty-foreground =#FFFFFF label-empty-background=#99000000 label-empty-padding = 2 -format-prefix = "  " -format-prefix-foreground = ${colors.primary} +; format-prefix = "  " +; format-prefix-foreground = ${colors.primary} [module/xwindow] type = internal/xwindow diff --git a/qtile/config.py b/qtile/config.py index 86629d4..b2ea844 100644 --- a/qtile/config.py +++ b/qtile/config.py @@ -129,7 +129,7 @@ keys = [ #System Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), - Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), + Key([mod, "control"], "q", lazy.spawn(home + "/dotfiles/scripts/powermenu.sh"), desc="Open Powermenu"), # Apps Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), diff --git a/scripts/powermenu.sh b/scripts/powermenu.sh new file mode 100755 index 0000000..ecb17f1 --- /dev/null +++ b/scripts/powermenu.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# ____ +# | _ \ _____ _____ _ __ _ __ ___ ___ _ __ _ _ +# | |_) / _ \ \ /\ / / _ \ '__| '_ ` _ \ / _ \ '_ \| | | | +# | __/ (_) \ V V / __/ | | | | | | | __/ | | | |_| | +# |_| \___/ \_/\_/ \___|_| |_| |_| |_|\___|_| |_|\__,_| +# +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +option1=" lock" +option2=" logout" +option3=" reboot" +option4=" power off" + +options="$option1\n" +options="$options$option2\n" +options="$options$option3\n$option4" + +choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -lines 4 -width 30 -p "Powermenu") + +case $choice in + $option1) + mantablockscreen -cc ;; + $option2) + qtile cmd-obj -o cmd -f shutdown ;; + $option3) + systemctl reboot ;; + $option4) + systemctl poweroff ;; +esac +