diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rwxr-xr-x | dmenu-dwm-sessionmanager | 12 | ||||
| -rwxr-xr-x | status | 2 | ||||
| -rwxr-xr-x | status-alpine (renamed from status-void) | 0 | ||||
| -rwxr-xr-x | status-linux | 45 |
5 files changed, 54 insertions, 7 deletions
| @@ -32,8 +32,8 @@ SCRIPTS = 2fa \ | |||
| 32 | share \ | 32 | share \ |
| 33 | spawn \ | 33 | spawn \ |
| 34 | status \ | 34 | status \ |
| 35 | status-linux \ | ||
| 35 | status-openbsd \ | 36 | status-openbsd \ |
| 36 | status-void \ | ||
| 37 | templess \ | 37 | templess \ |
| 38 | terminal \ | 38 | terminal \ |
| 39 | trash \ | 39 | 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 @@ | |||
| 5 | 5 | ||
| 6 | # Usage: dmenu-dwm-sessionmanager [-m menu] | 6 | # Usage: dmenu-dwm-sessionmanager [-m menu] |
| 7 | 7 | ||
| 8 | #sudo=sudo | ||
| 9 | sudo=doas | ||
| 10 | wmname="dwm" | ||
| 11 | shutdown_cmd="$sudo poweroff" | ||
| 12 | reboot_cmd="$sudo reboot" | ||
| 13 | closewm_cmd="pkill $wmname" | ||
| 14 | |||
| 8 | menu="dmenu -i" | 15 | menu="dmenu -i" |
| 9 | prompt="Do you want to quit?" | 16 | prompt="Do you want to quit?" |
| 10 | 17 | ||
| @@ -25,11 +32,6 @@ while getopts "m:" opt; do | |||
| 25 | done | 32 | done |
| 26 | shift $((OPTIND - 1)) | 33 | shift $((OPTIND - 1)) |
| 27 | 34 | ||
| 28 | wmname="dwm" | ||
| 29 | shutdown_cmd="sudo shutdown -h now" | ||
| 30 | reboot_cmd="sudo reboot" | ||
| 31 | closewm_cmd="pkill $wmname" | ||
| 32 | |||
| 33 | value=$(printf 'Shutdown\nReboot\nQuit dwm\n' | $menu -p "$prompt") | 35 | value=$(printf 'Shutdown\nReboot\nQuit dwm\n' | $menu -p "$prompt") |
| 34 | 36 | ||
| 35 | if [ "$value" = "Shutdown" ]; then | 37 | if [ "$value" = "Shutdown" ]; then |
| @@ -8,6 +8,6 @@ OpenBSD) | |||
| 8 | status-openbsd | 8 | status-openbsd |
| 9 | ;; | 9 | ;; |
| 10 | *) | 10 | *) |
| 11 | status-void | 11 | status-linux |
| 12 | ;; | 12 | ;; |
| 13 | esac | 13 | esac |
diff --git a/status-void b/status-alpine index fcc4c28..fcc4c28 100755 --- a/status-void +++ b/status-alpine | |||
diff --git a/status-linux b/status-linux new file mode 100755 index 0000000..8d507c5 --- /dev/null +++ b/status-linux | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Prints some status info to stdout. Includes: | ||
| 4 | # - date and time | ||
| 5 | # - battery | ||
| 6 | # - wifi (requires nmcli) | ||
| 7 | # - past notifications (requires notify) | ||
| 8 | |||
| 9 | # Usage: status [separator] | ||
| 10 | |||
| 11 | sep=${1:-" | "} | ||
| 12 | |||
| 13 | time=$(date +"%H:%M") | ||
| 14 | date=$(date +"%d %B %Y, %A") | ||
| 15 | |||
| 16 | if [ "$(pulsemixer --get-mute)" -eq 1 ]; then | ||
| 17 | volume="Audio muted" | ||
| 18 | else | ||
| 19 | volume="Vol: $(pulsemixer --get-volume | awk '{print $1}')%" | ||
| 20 | fi | ||
| 21 | |||
| 22 | bat="/sys/class/power_supply/BAT0" | ||
| 23 | if [ -d $bat ]; then | ||
| 24 | charge_status="$(cat $bat/status | awk '{print substr ($0, 0, 2)}')" | ||
| 25 | battery="Bat: $(cat $bat/capacity)% $charge_status" | ||
| 26 | else | ||
| 27 | battery="No battery" | ||
| 28 | fi | ||
| 29 | |||
| 30 | # NetworkManager has a dreadful command line interface | ||
| 31 | # It makes cry every time | ||
| 32 | # pls help | ||
| 33 | #nwline="$(nmcli device status | head -n 2 | tail -n 1)" | ||
| 34 | #nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" | ||
| 35 | #network="Network: $nwclean" | ||
| 36 | |||
| 37 | # Thank you iwctl for saving us from this dreadful existence | ||
| 38 | network="WiFi: $(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" | ||
| 39 | |||
| 40 | noticount=$(notify show | wc -l) | ||
| 41 | |||
| 42 | printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" | ||
| 43 | [ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" | ||
| 44 | [ "$noticount" -gt "1" ] && printf '%s' "${sep}Unread items: $noticount" | ||
| 45 | printf '\n' | ||
