all repos — zenUtils @ eb51bc0e91e183f41514c56d383cd8bbf4f9f872

misc utilities for computing zen

converted from terminal-based to dmenu-based
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAl+J0iQACgkQO3+8IhRO
Y5jI0w/+NmyGo4vx6pxQ3sOfvB5CnyFbbtENh06x8Vy4M0tV47he53NEvP5ci9+r
0GRja+wpVn9JATZMc0De+owO7/CE38oI4nmy2heihuv+syQlFmmw5EPUDByEKtql
wB/52hBca84Tr+ZOUkJYtCnx8rjGK/UYPkm6I1PchA1z+9XtEeoAVjITJy2hTB23
YClXuteXoBNIq+IGYhMU4oreZ9VlDmQqupBKykv7HHfmkDpQgUaXY/kw9jq34tVi
QNaq3Gk13Lqo3DF3HDmRp+fTL3J4NtQEHvXpPGrecRjMawIslPMjyBC4au+D6CTY
0jWjxhbL2YMHN6xByUGQ/bMi8qG8chqdg49iINNOwXC/oWpiE6GxcTOmEU62Dc7s
CoRHzsVX0GZOKoQ0CxnhBAquMVEM3qvxpv72s7Zz/TF7DlBHuGrTQYZhBmhi8FNd
4AQKCFB/kIp2UkAxZrenz/S8otCHoDUnohMkq4PvqgRwKm/mSh93UITeK0SA3tuV
FFBE0DPI0DsFbj/7Y6hg/WyO0sVSmjWj//Fb2yjg3CbdfDOggO/McpLUDPA3Rsu0
KEW+bhHHKMgD27HBtFpMhJ0ZwkWxfSf+XYyY5OjkBbc9zGPZy3YhV07CzLfV1QCr
wD2/d/H0U5Q9prdNEf6gkKYTv5zCka9ZeOPF165Qo2wmEVWLO/c=
=y8fu
-----END PGP SIGNATURE-----
commit

eb51bc0e91e183f41514c56d383cd8bbf4f9f872

parent

fc24a213d9e5f6eec6ceb246696729e0705acd29

1 files changed, 34 insertions(+), 38 deletions(-)

jump to
M logout.shlogout.sh

@@ -1,50 +1,46 @@

#!/bin/sh # logout.sh -# logout dialogue in three parts to be used with a tint2 executor -# without arguments displays the power symbol in the executor -# -w calls the terminal window with another instance using... -# -p to draw and process the prompt -# use a sudoers rule with NOPASSWD to bypass password entry when using -p -# (c) 2020 Derek Stevens <drkste@zoho.com> +# logout dialogue to be used with a tint2 executor +# no arguments prints the power icon with siji font +# -p runs the prompt in dmenu +# use a sudoers rule with NOPASSWD or a session manager +# copyleft 2020 Derek Stevens <drkste@zoho.com> # MIT License -- do whatever you want -logoutPrompt() { - echo "Power and session controls:" - echo "[s] shutdown" - echo "[r] reboot" - echo "[h] hibernate" - echo "[l] logout" - read operation - case ${operation} in - s|S|shutdown|Shutdown|SHUTDOWN) - poweroff - ;; - r|R|reboot|Reboot|REBOOT) - reboot - ;; - h|H|hibernate|Hibernate|HIBERNATE) - zzz - ;; - l|L|logout|Logout|LOGOUT) - pkill -9 -P $(pgrep .kwin-session) - ;; - *) - clear - logoutPromopt - ;; - esac +menu() { + dmenu "$@" -p "action >>>" -fn lucidatypewriter-9 -l 6 -nb black -nf grey50 -sb "#1f9b92" -sf black + } + + +printopts() { + printf "shutdown\nreboot\nsuspend\nhibernate\nlogout" +} + +handler() { + case $1 in + shutdown) + poweroff;; + reboot) + reboot;; + suspend) + zzz;; + logout) + pkill -9 -P $(pgrep .kwin-session);; + hibernate) + ZZZ;; + *) + : + esac +} + +logoutMenu() { + printopts | menu | handler } if [ -z $1 ]; then echo "" -elif [ "$1" = "-w" ]; then - - if ! wmctrl -l | grep "Session Control"; then - exec alacritty -d 30 5 --position 9999 0 -t "Session Control" -e sudo ${HOME}/src/zenUtils/logout.sh -p & - fi - elif [ "$1" = "-p" ]; then - logoutPrompt + logoutMenu fi