all repos — zenUtils @ 6668809aff0eff01aa65f901c0c62e29c25c125c

misc utilities for computing zen

update/cleanup
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmGhxyMACgkQO3+8IhRO
Y5j1mg/+JksAekxm5jD0EYZn3KvyAwutLUEhsflNA+5hqQmLT4oI2YLS+MfvR7v9
Ctw/QCGYL5z5VH5Y6Q5+FKofgX8zG7ExEibYvLYrXS+UHaLPqT35n8RdfPA/Y2WS
YS9NayguSTgFRNc+LCpzL+g61K9zc8cGjQFjgx0k8zP8V+/cByYK36AKCji+kAJy
S0amzwEMksDpZUznxyp5ARBj/pn7IYBbZ7KecUKONEAEyxItk6IZjoOCVmrjXI7M
i+ihOFk1X20XXfOLcfPmP0nI6zl5uxCtd1S+aeEhplcrYWFfl6w+32j8b4If0cYL
3MWqF0h+tSL1u3hno10kotbfjzuH6sJCblKlGz8P0o/MIfPBbcpBGP/3o0U5W1sW
3ec2XoStD7jqrLtbiqvSeyWzYIne4Xf21L+TPo/BceudSh7+O4s4+VSCXCeRs+JU
dRhrGtzWEO7STSe6ztuOsPLDjoPolOJaZIa0dpmZoEwLZrW581e802W3LXnrfAl/
FSLx1K/GMBN/UXR2DEWJQW6hUsfKgkShp6OAOB8OhGZwjDV2oUpuWriZ4HywXXf1
01q6wT6zEfUJLF0R3qC06xh161iU/RrJyVH8z7LPKiWijxmWOC+d3JNP51eyVUTc
VsxzDmhx/ZFUxnAuRRk77/wSEoDl5toYgkuIiBFcarc4vTonXyY=
=sS2E
-----END PGP SIGNATURE-----
commit

6668809aff0eff01aa65f901c0c62e29c25c125c

parent

b44cc9e96896c28a5aa5abebdb8de47791991445

8 files changed, 13 insertions(+), 234 deletions(-)

jump to
M README.mdREADME.md

@@ -1,28 +1,13 @@

# [[ zenUtils ]] ### --refined UI helper scripts-- -#### Derek Stevens <drkste@zoho.com> +#### Derek Stevens <nilix@nilfm.cc> ## About This is a simple collection of helper scripts to round out my two common desktop sessions: - -Plasma 'lite': -* kwin -* alacritty -* plasmashell -* tint2 -* dunst -* xbindkeys - -Ryudo: * ryudo -* alacritty -* nitrogen -* xosview -* xclock -* dunst -* xbindkeys +* fluxbox ### extdisplay

@@ -32,19 +17,6 @@ ### nmtuiWin

Wrapper script around `nmtui` to aid in network configuration in the absence of nm-applet. An alacritty config file hardcodes the colors for the `ncurses` interface. -### t2stats - -Status script to run in an Executor of `tint2` which gives network and battery status. - -* __network__ is given as any of `offline`, `wired`, or `wifi/<network SSID>`. -* __battery__ is given as a progress/HP bar like so ` ` where each block character (``) represents approximately 20% of charge. - -Battery alert notifications are handled by `tint2` natively, even when the native battery applet is hidden, so that functionality is not present in the script. Network connection/disconnection notifications are planned. - -### desks - -Helper script to run in an Executor of `tint2` which allows scrolling of desktops on the executor. - ### logout Dmenu script to provide session/power management menu.

@@ -53,13 +25,10 @@ ### batAlarm

Simple script to tell you when your battery's running out when you don't have a panel. -### sleepy +### sirius -Lightweight ACPI handler to put a laptop to sleep when you close the lid and it's not plugged in. +Background worker to sync an imap mailbox. -### transsetter - -Background script to apply translucency to terminal and editor windows with `transset`, `xshove`, and `xcompmgr` ### ztabelle Generate a timesheet for a given month by manipulating the output from `zeit`
D desks.sh

@@ -1,40 +0,0 @@

-#!/bin/sh - -# this is a simple script to both give some semblance of eye-candy for a tint2 executor -# and to switch virtual desktops programmatically, to be invoked by button click/scroll -# on said executor. -# copyleft 2020 Derek Stevens <drkste@zoho.com> -# MIT License - do whatever you want - -# if we're feeling spartan, just print a simple string for the executor -if [ -z $1 ]; then - echo "" - -# if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy -elif [ "$1" = "-x" ]; then - od -vAn -N2 -x < /dev/urandom - -# otherwise switch desks -else - currentDeskNum=$(wmctrl -d | grep -n [*] | awk '{print $1}' | awk -F : '{print $1}') - numDesks=$(wmctrl -d | wc -l) - - case $1 in - "-n") - if [ ${currentDeskNum} -eq ${numDesks} ]; then - newDesk=$(wmctrl -d | head -n 1 | awk '{print $1}') - else - newDesk=$(wmctrl -d | head -n $((currentDeskNum + 1)) | tail -n 1 | awk '{print $1}') - fi - ;; - "-p") - if [ ${currentDeskNum} -eq 1 ]; then - newDesk=$(wmctrl -d | tail -n 1 | awk '{print $1}') - else - newDesk=$(wmctrl -d | head -n $((currentDeskNum - 1)) | tail -n 1 | awk '{print $1}') - fi - ;; - esac - - wmctrl -s ${newDesk} -fi
M logout.shlogout.sh

@@ -14,7 +14,7 @@ }

printopts() { - printf "shutdown\nreboot\nsuspend\nhibernate\nlogout" + printf "shutdown\nreboot\nsuspend\nlogout" } handler() {

@@ -31,12 +31,10 @@ ;;

logout) if pgrep sddm-helper; then killall sddm-helper - elif pgrep plasmashell; then - killall plasmashell elif pgrep ryudo; then - pkill -9 -P $(pgrep startx) + killall ryudo else - killall -0 Xorg + killall -0 Xorg fi ;; hibernate)
D muttwrapper.sh

@@ -1,2 +0,0 @@

-#!/bin/sh -alacritty -e neomutt "$@"
D plasma-autostart.sh

@@ -1,22 +0,0 @@

-#!/bin/sh - -xset -b -sudo powertop -auto-tune & -redshit -x; redshift -O 6000K & -xbacklight -set 50 & - -if ! pgrep offlineimap; then - offlineimap & -fi - -if ! pgrep pipewire; then - pipewire & sleep 0.3 - pipewire-pulse & -fi - -export WINIT_X11_SCALE_FACTOR=1 -export GTK_THEME=steppenwolf-dark -rm ~/.config/gtkrc* -export WINIT_X11_SCALE_FACTOR=1 -xbindkeys -f ~/.xbindkeysrc.kwin -tint2&
A sirius.sh

@@ -0,0 +1,6 @@

+#!/bin/sh + +while true; do + mbsync -a + sleep 5m +done
D t2stats.sh

@@ -1,79 +0,0 @@

-#!/bin/sh - -# t2stats: -# this is a simple network/battery status indicator to be used with tint2 -# copyleft 2020 Derek Stevens <drkste@zoho.com> -# MIT License -- do whatever you want - -if [ "$1" = "-l" ]; then - load=$(cat /proc/loadavg | awk '{print $1}') - memdata=$(free -h --si | grep Mem) - swapdata=$(free -h --si | grep Swap) - memused=$(echo ${memdata} | awk '{print $3}' ) - swapused=$(echo ${swapdata} | awk '{print $3}') - - echo " ${load} | ${memused} | ${swapused}" -fi - -if [ "$1" = "-r" ]; then - - # network - actives=$(nmcli connection show --active) - possiblywifi=$(echo "${actives}" | grep wifi) - possiblyeth=$(echo "${actives}" | grep Wired) - ORS=" " - - if [ ! -z "${possiblyeth}" ]; then - output=wired - elif [ ! -z "${possiblywifi}" ]; then - output="wifi/$(echo ${possiblywifi} |\ - awk 'BEGIN { ORS=" " }; {for (i=1; i<=(NF-3);i++) print $i}')" - else - output=offline - fi - - echo -n "${output}" - - # battery - powerlevel=$(cat /sys/class/power_supply/BAT*/capacity) - case $powerlevel in - 0) - meter=" " - ;; - 1|2|3|4|5|6|7|8|9) - meter=" " - ;; - 10|11|12|13|14|15|16|17|18|19) - meter=" " - ;; - 20|21|22|23|24|25|26|27|28|29) - meter=" " - ;; - 30|31|32|33|34|35|36|37|38|39) - meter=" " - ;; - 40|41|42|43|44|45|46|47|48|49) - meter=" " - ;; - 50|51|52|53|54|55|56|57|58|59) - meter=" " - ;; - 60|61|62|63|64|65|66|67|68|69) - meter=" " - ;; - 70|71|72|73|74|75|76|77|78|79) - meter=" " - ;; - 80|81|82|83|84|85|86|87|88|89) - meter="" - ;; - *) - meter="" - ;; - esac - - if ! grep Full /sys/class/power_supply/BAT*/status > /dev/null \ - && file /sys/class/power_supply/BAT* > /dev/null; then - echo " ${meter}" - fi -fi
D transsetter.sh

@@ -1,51 +0,0 @@

-#!/bin/sh - -# A background script to provide terminal/editor compositing in a Ryudo -# session. -# Licensed under the MIT License -- do what you want with it. -# Copyleft 2021 Derek Stevens <drkste@zoho.com> - -termprog=Alacritty -geditor=acme -opacity=0.85 - -setter=$(which transset) -if [ -z "$setter" ]; then - setter=$(which transset-df) -fi - -if [ -z "$setter" ]; then - echo "we need transset or transset-df in PATH!" - exit 1 -fi - -#if which xcompmgr > /dev/null; then -# xcompmgr -n& -#else -# ehco "we need xcompmgr in PATH!" -# exit 1 -#fi - -if ! which xshove > /dev/null; then - echo "we need xshove in PATH!" - exit 1 -fi - -wlist=$(mktemp) -oldwlist=$(mktemp) -while true; do - xshove > $wlist - while read wprop; do - wid=$(echo ${wprop} | awk '{print $1}') - if ! grep $wid $oldwlist > /dev/null; then - wclass=$(echo ${wprop} | awk '{print $3}') - if [ "$wclass" = "${geditor}" ]; then - $setter -i 0x$wid ${opacity} > /dev/null - elif [ "${wclass}" = "${termprog}" ]; then - $setter -i 0x$wid ${opacity} > /dev/null - fi - fi - done < $wlist - cat $wlist > $oldwlist; - sleep 0.2 -done