1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-09 19:11:15 +02:00

tools: restructured

This commit is contained in:
2023-11-10 13:55:20 +01:00
parent 4cf03f336e
commit 1547250832
38 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#!/bin/sh
acpi=$(acpi -b)
if [ "$acpi" = "" ]; then
echo ""
return
fi
total=$(echo $acpi | sed 's/.*:\ //')
status="$(echo $total | cut -d',' -f1)"
capacity="$(echo $total | cut -d',' -f2 | sed 's/%//')"
if [ "$status" = "Discharging" ] && [ $capacity -le 15 ] ; then
notify-send -u critical "Battery" "Below 15%"
fi
case "$status" in
"Discharging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Not charging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Charging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Unknown")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Full")
icon="^b#282828^^c#dfdfdf^ ⚡ ^d^";;
esac
capacity=$(echo "$capacity" | sed -e 's/$//')
capacity=$(printf %3s $capacity | tr ' ' ' ')
echo "$icon $capacity%"

3
.local/bin/etc/statusbar/clock Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
date +"^b#282828^^c#dfdfdf^  ^d^ %d %b %H:%M"

15
.local/bin/etc/statusbar/cpu Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
model=$(cat /proc/cpuinfo | grep "model name" | head -n1)
icon="^b#282828^^c#dfdfdf^  ^d^"
if printf "$model " | grep -Fqe "AMD"; then
temp=$(sensors | awk '/Tctl/ {print $2}')
else
temp=$(sensors | awk '/Package id 0/ {print $4}')
fi
temp=$(printf %3s $(echo ${temp##*+} | sed "s/\..*//") | tr ' ' ' ')
echo "$icon $temp°C"

11
.local/bin/etc/statusbar/disk Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Status bar module for disk space
# $1 should be drive mountpoint
disk="/"
[ ! -z "$1" ] && disk="$1"
icon="$disk"
printf "^b#282828^^c#dfdfdf^ 󰗮 ^d^ %s\n" "$(df -h "$disk" | awk ' /[0-9]/ {print $3 "/" $2}')"

15
.local/bin/etc/statusbar/gpu Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
icon="^b#282828^^c#dfdfdf^  ^d^"
temp=""
if command -v nvidia-smi > /dev/null; then
temp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)
temp=$(printf %3s $(echo ${temp##*+} | sed "s/\..*//") | tr ' ' ' ')
else
echo ""
return
fi
echo "$icon $temp°C"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
wifipercent=" 0"
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="^c#ff0000^ ^d^"
[ ! -n "${wifiicon+var}" ] && wifiicon="^c#dfdfdf^ ^d^" && wifipercent=$(grep "^\s*w" /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
wifipercent=$(printf %3s $wifipercent | tr ' ' ' ')
echo "$(cat /sys/class/net/e*/operstate | sed "s/down/^b#282828^^c#ff0000^  /;s/up/^b#282828^^c#dfdfdf^ 󰈀 /")" "$wifiicon" "$wifipercent%"

View File

@@ -0,0 +1,6 @@
#!/bin/sh
icon="^b#282828^^c#dfdfdf^  ^d^ "
total=$(free -h | awk '/^Mem:/ {print $3/$2}')
percent=$(printf %3s $(printf %-4s $total | tr ' ' '0' | cut -c1-4 | sed -e 's/\.//g' | sed -e 's/^0//g') | tr ' ' ' ')%
echo "$icon$percent"

22
.local/bin/etc/statusbar/volume Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2}' | sed -e 's/\.//g' | sed 's/^0*//')"
if [ "$vol" -eq "0" ]; then
vol_info="^c#dfdfdf^ ^d^"
elif [ "$vol" -gt "70" ]; then
vol_info="^c#dfdfdf^ ^d^"
else
vol_info="^c#dfdfdf^ ^d^"
fi
$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q '\[MUTED\]') && vol_info="^c#ff0000^ ^d^"
if wpctl get-volume @DEFAULT_SOURCE@ | grep -q '\[MUTED\]'; then
mic="^b#282828^^c#ff0000^  "
else
mic="^b#282828^^c#dfdfdf^  "
fi
vol=$(printf %3s $vol | tr ' ' ' ')
printf "%s %s %s %s\\n" "$mic" "$vol_info" "$vol%"