From f5ad2685ab35ee16967a3e0c5c2f8b71d1559739 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Wed, 14 Feb 2024 17:57:54 -0600 Subject: feat(wmenu): change menu to wmenu (again...) --- sh/.local/bin/powermenu | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sh/.local/bin/powermenu') diff --git a/sh/.local/bin/powermenu b/sh/.local/bin/powermenu index 688ae3b..0166eee 100755 --- a/sh/.local/bin/powermenu +++ b/sh/.local/bin/powermenu @@ -1,15 +1,18 @@ -#!/usr/bin/sh +#!/bin/sh -if [ "$#" -eq 0 ]; then - set -- $(awk '{print tolower($2)}') +if [ ! -t 0 ]; then + set -- "$(awk '{print tolower($2)}')" +elif [ $# -eq 0 ]; then + printf '%s\n' '󰌾 Lock' '󰍃 Logout' '⏾ Suspend' '󰋊 Hibernate' '󰜉 Reboot' '󰐥 Poweroff' + exit 0 fi case "$1" in lock) - loginctl lock-session ${XDG_SESSION_ID-} + loginctl lock-session "${XDG_SESSION_ID-}" ;; logout) - loginctl terminate-session ${XDG_SESSION_ID-} + loginctl terminate-session "${XDG_SESSION_ID-}" ;; suspend) systemctl suspend @@ -23,10 +26,8 @@ reboot) poweroff) systemctl poweroff ;; -*list) - printf '%s\n' '󰌾 Lock' '󰍃 Logout' '󰋊 Hibernate' '󰒲 Suspend' '󰜉 Reboot' '󰐥 Poweroff' - ;; *) - echo "Invalid argument: $@" + echo "Invalid argument: $*" + exit 1 ;; esac -- cgit v1.2.3-70-g09d2