0th commit

This commit is contained in:
Iris Lightshard 2020-08-05 00:57:45 -04:00
commit a234dd7463
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
4 changed files with 161 additions and 0 deletions

34
README.md Normal file
View file

@ -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.

52
extdisplay.sh Executable file
View file

@ -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

11
nmtuiWin.sh Executable file
View file

@ -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

64
t2stats.sh Executable file
View file

@ -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