Added Statusbad Commands (Not in correct location)

This commit is contained in:
Luke Else 2022-09-21 20:51:46 +01:00
parent 8afd56ea27
commit 990568295b
12 changed files with 125 additions and 0 deletions

25
statusbar/dwm_battery Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
bat_capacity=$(</sys/class/power_supply/BAT0/capacity)
bat_status=$(</sys/class/power_supply/BAT0/status)
if [ $bat_status == "Charging" ]
then
battery_icon=""
elif [ $bat_capacity -lt 15 ]
then
battery_icon=" "
elif [ $bat_capacity -lt 35 ] && [ $bat_capacity -ge 15 ]
then
battery_icon=" "
elif [ $bat_capacity -lt 60 ] && [ $bat_capacity -ge 35 ]
then
battery_icon=" "
elif [ $bat_capacity -lt 90 ] && [ $bat_capacity -ge 60 ]
then
battery_icon=" "
else
battery_icon=" "
fi
printf "$battery_icon ^c#f7ca88^$bat_capacity%%^d^"

5
statusbar/dwm_brightness Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
icon=""
printf "$icon ^c#f7ca88^$(/usr/bin/brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}')%%^d^"

4
statusbar/dwm_clock Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
icon=""
printf "$icon ^c#f7ca88^$(date '+%I:%M %p')^d^"

6
statusbar/dwm_cpu_temp Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
icon=""
temp=$(echo "scale=0; $(sort -nr /sys/class/thermal/thermal_zone*/temp | head -n1) / 1000" | bc)
printf "$icon ^c#f7ca88^$((temp))^c#d75f5f^°C^d^"

4
statusbar/dwm_date Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
icon=""
printf "$icon ^c#f7ca88^$(date '+%a, %B %d')^d^"

7
statusbar/dwm_kernel Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
icon=""
kernel_v="$(uname -r)"
kernel_v="${kernel_v%-*}"
printf "$icon ^c#f7ca88^$kernel_v^d^"

6
statusbar/dwm_keyboard_layout Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
k_layout_icon=
k_layout=$(setxkbmap -query | grep layout | awk '{print $NF}')
printf "$k_layout_icon ^c#f7ca88^$k_layout^d^"

4
statusbar/dwm_memory Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
icon=""
printf "$icon $(free -m | awk '/^Mem:/ {print "^c#87af5f^"$3 "mb^d^/" "^c#87afd7^"$2 "mb"}')^d^"

14
statusbar/dwm_network Executable file
View File

@ -0,0 +1,14 @@
#! /bin/bash
if [[ $(tail -n+3 /proc/net/wireless 2>/dev/null) ]]; then
ssid=$(nmcli -t -f name connection show --active | head -n 1)
wireless_icon=" ^c#f7ca88^$ssid^d^"
elif [[ $(grep "" /sys/class/net/eth0/* 2>/dev/null) ]]; then
wired_icon=" ^c#f7ca88^LAN^d^"
fi
if [[ $(nmcli con show --active | grep -i vpn 2>/dev/null) ]]; then
vpn_icon="旅 "
fi
printf "$vpn_icon$wired_icon$wireless_icon"

23
statusbar/dwm_traffic Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
cache_path=~/.cache/.traffic
old_rx=$(head -n 1 $cache_path)
old_tx=$(tail -1 $cache_path)
printf "0\n0\n" > $cache_path
NETWORK_INTERFACE=$(ip route get 1.1.1.1 | grep -Po '(?<=dev\s)\w+' | cut -f1 -d ' ')
new_rx=`</sys/class/net/$NETWORK_INTERFACE/statistics/rx_bytes`
new_tx=`</sys/class/net/$NETWORK_INTERFACE/statistics/tx_bytes`
sed -i "1s/^.*$/$new_rx/" $cache_path
sed -i "2s/^.*$/$new_tx/" $cache_path
tx_bytes=`expr $new_tx - $old_tx`
rx_bytes=`expr $new_rx - $old_rx`
tx_kbs=`expr $tx_bytes / 1024`
rx_kbs=`expr $rx_bytes / 1024`
printf " ^c#87af5f^$rx_kbs"kb^d^"  ^c#87afd7^$tx_kbs"kb^d^""

4
statusbar/dwm_uptime Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
icon=""
printf "$icon ^c#d75f5f^$(uptime -p | cut -d " " -f2- | awk '{print $1 substr($2,1,1) " " $3 substr($4,1,1)}')^d^"

23
statusbar/dwm_volume Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
vol=$(pactl list sinks | perl -000ne 'if(/#1/){/(Volume:.*)/; print "$1\n"}' | tr ' ' '\n' | grep -m1 '%' | tr -d '%')
if [ -z "$vol" ]; then
vol=$(pactl list sinks | tr ' ' '\n' | grep -m1 '%' | tr -d '%')
fi
vol_status=$(pactl list sinks | grep 'Mute: yes')
if [ -n "$vol_status" ]
then
vol_icon=" "
elif [ ${vol::-1} -eq 0 ]
then
vol_icon=" "
elif [ ${vol::-1} -lt 50 ]
then
vol_icon=" "
else
vol_icon=" "
fi
printf "$vol_icon^c#f7ca88^$vol%%^d^"