diff --git a/README.md b/README.md index ed67e4c..95970de 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,24 @@ ## About -This is a simple collection of helper scripts to round out an experimental desktop environment: +This is a simple collection of helper scripts to round out my two common desktop sessions: + +Kwin Standalone: * kwin -* rox +* konsole +* xfdesktop * tint2 -* urxvt * dunst +* xbindkeys + +Ryudo: +* ryudo +* alacritty +* nitrogen +* xosview +* xclock +* dunst +* xbindkeys ### extdisplay @@ -18,17 +30,37 @@ 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. +Wrapper script around `nmtui` to aid in network configuration in the absence of nm-applet. An alacritty config file hardcodes the colors for hte ncurses interface. ### t2stats -Status script to run in an Executor of tint2 which gives network and battery status. +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/`. -* __battery__ is given as a progress/HP bar like so `[|||||| ]` where each pipe character (`|`) represents approximately 10% of charge. +* __battery__ is given as a progress/HP bar like so ` ` where each pipe 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. +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. + +## batAlarm + +Simple script to tell you when your battery's running out when you don't have a panel. + +### sleepy + +Lightweight ACPI handler to put a laptop to sleep when you close the lid and it's not plugged in. + +### transsetter + +Background script to apply translucency to terminal and editor windows with `transset`, `xshove`, and `xcompmgr` ## License -This collection is released permissively under the MIT License. You can do whatever you want with it. \ No newline at end of file +This collection is released permissively under the MIT License. You can do whatever you want with it. diff --git a/batAlarm.sh b/batAlarm.sh new file mode 100755 index 0000000..475f221 --- /dev/null +++ b/batAlarm.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Just a background script to tell you when your battery's low if you don't +# have a panel. +# Lisenced under the MIT license -- do what you want +# Copyleft 2021 Derek Stevens + +flag1=0 +flag2=0 + +while true; do + charge=$(cat /sys/class/power_supply/BAT0/capacity) + if [ $charge -lt 11 ]; then + if [ $flag1 -eq 0 ]; then + flag1=1 + notify-send -t 10000 BATTERY ${charge}% + fi + elif [ $charge -lt 21 ]; then + if [ $flag2 -eq 0 ]; then + flag2=1 + notify-send -t 10000 BATTERY ${charge}% + fi + fi + + if [ $charge -gt 20 ]; then + flag2=0 + fi + if [ $charge -gt 10 ]; then + flag1=0 + fi + + sleep 30 +done + diff --git a/desks.sh b/desks.sh index 0d72f30..8df6abd 100755 --- a/desks.sh +++ b/desks.sh @@ -8,7 +8,7 @@ # if we're feeling spartan, just print a simple string for the executor if [ -z $1 ]; then - echo "缾" + echo "" # if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy elif [ "$1" = "-x" ]; then diff --git a/logout.sh b/logout.sh index 724607b..569b9bc 100755 --- a/logout.sh +++ b/logout.sh @@ -29,7 +29,11 @@ handler() { zzz ;; logout) - pkill -9 -P $(pgrep .kwin-session) + if pgrep kwin; then + pkill -9 -P $(pgrep .kwin-session) + elif pgrep ryudo; then + kill $(pgrep ryudo) + else killall Xorg; fi ;; hibernate) ZZZ diff --git a/sleepy.sh b/sleepy.sh index 9a17de3..0c263a0 100755 --- a/sleepy.sh +++ b/sleepy.sh @@ -15,7 +15,6 @@ acpi_listen | { if [ ! -z "$(acpi -a | grep off-line)" ]; then if [ "${event}" = "button/lid LID close" ]; then - slock & sleep 1 zzz fi fi diff --git a/t2stats.sh b/t2stats.sh index a866d06..c4916a2 100755 --- a/t2stats.sh +++ b/t2stats.sh @@ -21,7 +21,7 @@ while true; do output=offline fi - echo -n "${output} " + echo -n "${output} " # battery diff --git a/transsetter.sh b/transsetter.sh new file mode 100755 index 0000000..14fbbe9 --- /dev/null +++ b/transsetter.sh @@ -0,0 +1,48 @@ +#!/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 + +termprog=Alacritty +geditor=kate +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) + +while true; do + xshove > $wlist + while read wprop; do + wid=$(echo ${wprop} | awk '{print $1}') + 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 + done < $wlist + sleep 0.2 +done