From acc08eb7aa16d39a598a8bf8631deda1e79ff477 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 15 Aug 2025 17:46:28 +0200 Subject: Some changes for new system config --- Makefile | 2 +- dmenu-dwm-sessionmanager | 12 +++++++----- status | 2 +- status-alpine | 41 +++++++++++++++++++++++++++++++++++++++++ status-linux | 45 +++++++++++++++++++++++++++++++++++++++++++++ status-void | 41 ----------------------------------------- 6 files changed, 95 insertions(+), 48 deletions(-) create mode 100755 status-alpine create mode 100755 status-linux delete mode 100755 status-void diff --git a/Makefile b/Makefile index 294d055..dabf0e3 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ SCRIPTS = 2fa \ share \ spawn \ status \ + status-linux \ status-openbsd \ - status-void \ templess \ terminal \ trash \ diff --git a/dmenu-dwm-sessionmanager b/dmenu-dwm-sessionmanager index dafe853..03343a0 100755 --- a/dmenu-dwm-sessionmanager +++ b/dmenu-dwm-sessionmanager @@ -5,6 +5,13 @@ # Usage: dmenu-dwm-sessionmanager [-m menu] +#sudo=sudo +sudo=doas +wmname="dwm" +shutdown_cmd="$sudo poweroff" +reboot_cmd="$sudo reboot" +closewm_cmd="pkill $wmname" + menu="dmenu -i" prompt="Do you want to quit?" @@ -25,11 +32,6 @@ while getopts "m:" opt; do done shift $((OPTIND - 1)) -wmname="dwm" -shutdown_cmd="sudo shutdown -h now" -reboot_cmd="sudo reboot" -closewm_cmd="pkill $wmname" - value=$(printf 'Shutdown\nReboot\nQuit dwm\n' | $menu -p "$prompt") if [ "$value" = "Shutdown" ]; then diff --git a/status b/status index 44935cd..66811b0 100755 --- a/status +++ b/status @@ -8,6 +8,6 @@ OpenBSD) status-openbsd ;; *) - status-void + status-linux ;; esac diff --git a/status-alpine b/status-alpine new file mode 100755 index 0000000..fcc4c28 --- /dev/null +++ b/status-alpine @@ -0,0 +1,41 @@ +#!/bin/sh + +# Prints some status info to stdout. Includes: +# - date and time +# - battery +# - wifi (requires nmcli) +# - past notifications (requires notify) + +# Usage: status [separator] + +sep=${1:-" | "} + +time=$(date +"%H:%M") +date=$(date +"%d %B %Y, %A") + +if [ "$(pulsemixer --get-mute)" -eq 1 ]; then + volume="Audio muted" +else + volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%" +fi + +bat="/sys/class/power_supply/BAT0" +if [ -d $bat ]; then + battery="Battery: $(cat $bat/capacity)% $(cat $bat/status)" +else + battery="No battery" +fi + +# NetworkManager has a dreadful command line interface +# It makes cry every time +# pls help +nwline="$(nmcli device status | head -n 2 | tail -n 1)" +nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" +network="Network: $nwclean" + +noticount=$(notify show | wc -l) + +printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" +[ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" +[ "$noticount" -gt "1" ] && printf '%s' "${sep}Unread items: $noticount" +printf '\n' diff --git a/status-linux b/status-linux new file mode 100755 index 0000000..8d507c5 --- /dev/null +++ b/status-linux @@ -0,0 +1,45 @@ +#!/bin/sh + +# Prints some status info to stdout. Includes: +# - date and time +# - battery +# - wifi (requires nmcli) +# - past notifications (requires notify) + +# Usage: status [separator] + +sep=${1:-" | "} + +time=$(date +"%H:%M") +date=$(date +"%d %B %Y, %A") + +if [ "$(pulsemixer --get-mute)" -eq 1 ]; then + volume="Audio muted" +else + volume="Vol: $(pulsemixer --get-volume | awk '{print $1}')%" +fi + +bat="/sys/class/power_supply/BAT0" +if [ -d $bat ]; then + charge_status="$(cat $bat/status | awk '{print substr ($0, 0, 2)}')" + battery="Bat: $(cat $bat/capacity)% $charge_status" +else + battery="No battery" +fi + +# NetworkManager has a dreadful command line interface +# It makes cry every time +# pls help +#nwline="$(nmcli device status | head -n 2 | tail -n 1)" +#nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" +#network="Network: $nwclean" + +# Thank you iwctl for saving us from this dreadful existence +network="WiFi: $(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" + +noticount=$(notify show | wc -l) + +printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" +[ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" +[ "$noticount" -gt "1" ] && printf '%s' "${sep}Unread items: $noticount" +printf '\n' diff --git a/status-void b/status-void deleted file mode 100755 index fcc4c28..0000000 --- a/status-void +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# Prints some status info to stdout. Includes: -# - date and time -# - battery -# - wifi (requires nmcli) -# - past notifications (requires notify) - -# Usage: status [separator] - -sep=${1:-" | "} - -time=$(date +"%H:%M") -date=$(date +"%d %B %Y, %A") - -if [ "$(pulsemixer --get-mute)" -eq 1 ]; then - volume="Audio muted" -else - volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%" -fi - -bat="/sys/class/power_supply/BAT0" -if [ -d $bat ]; then - battery="Battery: $(cat $bat/capacity)% $(cat $bat/status)" -else - battery="No battery" -fi - -# NetworkManager has a dreadful command line interface -# It makes cry every time -# pls help -nwline="$(nmcli device status | head -n 2 | tail -n 1)" -nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" -network="Network: $nwclean" - -noticount=$(notify show | wc -l) - -printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" -[ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" -[ "$noticount" -gt "1" ] && printf '%s' "${sep}Unread items: $noticount" -printf '\n' -- cgit v1.3