big refactoring

This commit is contained in:
2025-05-07 20:35:17 +02:00
parent 23010ee036
commit 1f045cdf5c
92 changed files with 378 additions and 1324 deletions

View File

@@ -0,0 +1,27 @@
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
# /-- Mic -->
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
eww update micClass="micOff"
eww update micIcon="󰍭"
else
eww update micClass="micOn"
eww update micIcon="󰍬"
fi
# /-- Speaker -->
if [[ "$mute" == "yes" ]]; then
eww update speakerClass="speakerOff"
eww update speakerIcon=""
elif [[ "$volume" -le 100 ]]; then
eww update speakerClass="speakerOn"
eww update speakerIcon=""
else
eww update speakerClass="speakerOn"
eww update speakerIcon=""
fi
echo "$volume"

View File

@@ -0,0 +1,25 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/AC/online)
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
bat="100"
eww update batteryClass="batteryFull"
eww update batteryIcon=""
elif [[ $stat == 1 ]]; then
eww update batteryClass="batteryCharging"
eww update batteryIcon=""
elif [[ $bat -le 10 ]]; then
eww update batteryClass="batteryEmpty"
eww update batteryIcon=""
elif [[ $bat -le 50 ]]; then
eww update batteryClass="batteryHalf"
eww update batteryIcon=""
elif [[ $bat -le 80 ]]; then
eww update batteryClass="batteryHalf"
eww update batteryIcon=""
else
eww update batteryClass="batteryFull"
eww update batteryIcon=""
fi
echo "$bat"

View File

@@ -1,16 +0,0 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/AC/online)
class="batteryFull"
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
class="batteryFull"
elif [[ $stat == 1 ]]; then
class="batteryCharging"
elif [[ $bat -le 10 ]]; then
class="batteryEmpty"
elif [[ $bat -le 80 ]]; then
class="batteryHalf"
fi
echo "$class"

View File

@@ -1,18 +0,0 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/AC/online)
icon=""
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
icon=""
elif [[ $stat == 1 ]]; then
icon=""
elif [[ $bat -le 10 ]]; then
icon=""
elif [[ $bat -le 50 ]]; then
icon=""
elif [[ $bat -le 80 ]]; then
icon=""
fi
echo "$icon"

View File

@@ -1,7 +0,0 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
bat="100"
fi
echo "$bat"

View File

@@ -1 +0,0 @@
betterlockscreen --lock blur

View File

@@ -1,5 +1,4 @@
cpu_idle=$(top -bn1 | awk '/Cpu\(s\)/ {print $8}')
cpu_used=$(awk "BEGIN {print 100 - $cpu_idle}")
# Print only the numeric result
printf "%.0f\n" "$cpu_used"

View File

@@ -1 +0,0 @@
pkill river

View File

@@ -1,5 +0,0 @@
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
echo "micOff"
else
echo "micOn"
fi

View File

@@ -1,5 +0,0 @@
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
echo "󰍭" # muted
else
echo "󰍬" # unmuted
fi

View File

@@ -0,0 +1,16 @@
# You can change this if your interface is named differently (e.g., eth0, enp3s0)
INTERFACE=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
# /-- Uprate -->
TX_PREV=$(cat /sys/class/net/"$INTERFACE"/statistics/tx_bytes)
sleep 1
TX_CUR=$(cat /sys/class/net/"$INTERFACE"/statistics/tx_bytes)
TX_RATE=$(((TX_CUR - TX_PREV) / 1024))
# /-- Downrate -->
RX_PREV=$(cat /sys/class/net/"$INTERFACE"/statistics/rx_bytes)
sleep 1
RX_CUR=$(cat /sys/class/net/"$INTERFACE"/statistics/rx_bytes)
eww update networkDown=$(((RX_CUR - RX_PREV) / 1024))
echo "${TX_RATE}"

View File

@@ -1,11 +0,0 @@
# You can change this if your interface is named differently (e.g., eth0, enp3s0)
INTERFACE=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
RX_PREV=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)
sleep 1
RX_CUR=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)
# Calculate download/upload in KiB/s
RX_RATE=$(((RX_CUR - RX_PREV) / 1024))
# Output formatted for Eww
echo "${RX_RATE}"

View File

@@ -1,8 +0,0 @@
# You can change this if your interface is named differently (e.g., eth0, enp3s0)
INTERFACE=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
TX_PREV=$(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)
sleep 1
TX_CUR=$(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)
TX_RATE=$(((TX_CUR - TX_PREV) / 1024))
echo "${TX_RATE}"

View File

@@ -1,8 +0,0 @@
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
if [[ "$mute" == "yes" ]]; then
echo "speakerOff" # muted icon
else
echo "speakerOn" # high volume
fi

View File

@@ -1,10 +0,0 @@
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
if [[ "$mute" == "yes" ]]; then
echo "" # muted icon
elif [[ "$volume" -le 100 ]]; then
echo "" # low volume
else
echo "" # high volume
fi

View File

@@ -1,4 +0,0 @@
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
half_volume=$((volume / 2))
echo "$half_volume"