From e68ba677432cf0ac70e91347f3dfa20f700c8fd7 Mon Sep 17 00:00:00 2001 From: ozpv <39195175+ozpv@users.noreply.github.com> Date: Sun, 5 Jun 2022 14:32:13 -0500 Subject: add powermenu back --- Makefile | 2 ++ config.h | 4 +++- scripts/powermenu | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 scripts/powermenu diff --git a/Makefile b/Makefile index e361c44..2ada908 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ install: all mkdir -p ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 + cp -f scripts/* ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/powermenu uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm\ diff --git a/config.h b/config.h index 9e3af4d..234d8e2 100644 --- a/config.h +++ b/config.h @@ -60,7 +60,8 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *dmenunmcmd[] = { "networkmanager_dmenu", NULL }; +static const char *dmenunmcmd[] = { "sudo", "networkmanager_dmenu", NULL }; +static const char *dmenupmcmd[] = { "sudo", "powermenu", NULL }; static const char *termcmd[] = { "st", NULL }; static const char *browsercmd[] = { "firefox", NULL }; static const char *volup[] = { "pactl", "set-sink-volume", "1", "+10%", NULL }; @@ -103,6 +104,7 @@ static Key keys[] = { TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) + { MODKEY, XK_q, spawn, {.v = dmenupmcmd} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, }; diff --git a/scripts/powermenu b/scripts/powermenu new file mode 100644 index 0000000..027d513 --- /dev/null +++ b/scripts/powermenu @@ -0,0 +1,8 @@ +#!/bin/sh +case "$(echo "Poweroff \nReboot ﰇ\nSuspend ⏾\nCancel ﰸ" | dmenu)" in + "Poweroff ") sudo poweroff ;; + "Reboot ﰇ") sudo reboot ;; + "Suspend ⏾") sudo ZZZ -z ;; + "Cancel ﰸ") exit ;; + *) exit ;; +esac -- cgit v1.2.3