all repos — zenUtils @ a234dd74634a08245809086d52d051a46e412737

misc utilities for computing zen

0th commit
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAl8qPEkACgkQO3+8IhRO
Y5ikgw//c9IRRf0nbtbkd2QCpAuDnodBw4BE3pbTOV2HQzVtzlELs/V46xKd1sQb
MTEAgEDfadc8DyW1gr15qnHmhZXFtyfKuiPSMYhlPwUnzjgCVksaOg7kWIPGp+CB
loZm/8c8bfQX5fBGIf6NocNYXqEV1TDZ124bda5SbfT2F9tyXmOtid80Vdw0Upce
TtIoKaBO67dbRKMrHKc3tpN14qUrJFKJaJrwksq4RXkk9FLhAKpDqHq+2k2YcIDa
k95cqFmdqk4rOQXUh1VSncH/NQXof21i4NLKsGSmkjLZT6uRq+4e7ZZUgGiFRGjA
UX0Tbn6oBZ/gLyG3FOmVbfiGrPgbO73HWGJf9Uw633Qs7dw0mtLpjYvtFwkSCaJO
TH78XQOSqn0FXe8TbXBzqv/DPQr6GcBcfkv25drScwO2CQObtZ+9OppArscRV1hC
Y5UO7NisnveMcEqHtPTB8L5QufQvU5veeSDpdi7uxK9WEgDv2dXfVvcTMlMA18Mp
sIRcHxYl4POOFVMKl/tzccj2u/F8T1C+rgvn8ECStMOpC1nNxrvPkJv3rC7JoQ97
TDR6ocXv/BgG0g0L5tin8Zv1EqDHU16G6DqLvZF9nVt9kr9aakryyuVbLybLilmz
zlEe1OcL2PjqsDfR0ObYpmhRvWpfZdCui7biHgbnuObuaC6eUB4=
=//DE
-----END PGP SIGNATURE-----
commit

a234dd74634a08245809086d52d051a46e412737

4 files changed, 161 insertions(+), 0 deletions(-)

jump to
A README.md

@@ -0,0 +1,34 @@

+# [[ zenUtils ]] + +### --refined UI helper scripts-- +#### Derek Stevens <drkste@zoho.com> + +## About + +This is a simple collection of helper scripts to round out an experimental desktop environment: +* kwin +* rox +* tint2 +* urxvt +* dunst + +### extdisplay + +Wrapper script around xrandr to handle a second monitor on a laptop. + +### nmtuiWin + +Wrapper script around nmtui to aid in network configuration in the absence of nm-applet. + +### 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 pipe character (`|`) represents approximately 10% 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. + +## License + +This collection is released permissively under the MIT License. You can do whatever you want with it.
A extdisplay.sh

@@ -0,0 +1,52 @@

+#!/bin/sh + +# extdisplay: +# this is a wrapper around xrandr to handle one external monitor on a laptop +# (c) 2020 Derek Stevens <drkste@zoho.com> +# MIT License -- do whatever you want + +helpme() +{ + echo "$0, wrapper for using xrandr to handle an external on a laptop" + echo "" + echo "USAGE: $0 solo|off|left-of|right-of|above|below [res]" + echo " solo\n activates the plugged monitor, deactivates the native display" + echo " off\n activates the native display, deactivates the plugged monitor" + echo " left-of, right-of, above, below\n activates the plugged monitor in the given" + echo " relation to the native display" + echo " res\n if included, sets the resolution of the plugged monitor" +} + +if [ -z $1 ]; then + helpme +fi + +native=xrandr | grep LVDS | awk '{print $1}' +plugged=xrandr | grep connected | grep -v $native | awk '{print $1}' + +if [ "$1" = solo ]; then + xrandr --output ${plugged} --primary + xrandr --output ${native} --off + xrandr --output ${plugged} --auto + if [ ! -z $2 ]; then + xrandr -s $2 + fi + +elif [ "$1" = off ]; then + xrandr --output ${native} --primary + xrandr --output ${plugged} --off + xrandr --output ${native} --auto + +else + case $1 in + right-of|left-of|above|below) + xrandr --output ${native} --auto --output ${plugged} --auto --$1 ${native} + if [ ! -z $2 ]; then + xrandr --output ${plugged} -s $2 + ;; + *) + helpme + ;; + esac +fi +
A nmtuiWin.sh

@@ -0,0 +1,11 @@

+#!/bin/sh + +# nmtuiWin: +# this is a wrapper around urxvt+nmtui to provide easy access to network configuration +# colors are hardcoded into the urxvt instance to give it a grey+green colorscheme +# (c) 2020 Derek Stevens <drkste@zoho.com> +# MIT License -- do whatever you want + +if [ $(pgrep nmtui) -gt 0 ]; then + exec urxvt -geometry 80x30 +sb --depth 24 --background black --color4 black --color7 grey20 --color1 seagreen --color0 grey50 -e nmtui & +fi
A t2stats.sh

@@ -0,0 +1,64 @@

+#!/bin/sh + +# t2stats: +# this is a simple network/battery status indicator to be used with tint2 +# (c) 2020 Derek Stevens <drkste@zoho.com> +# MIT License -- do whatever you want + +while true; do +# 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 + 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 + + echo "${meter}" + + sleep 10 +done