new eww
This commit is contained in:
14
home/programs/eww/src/scripts/battery_class.sh
Executable file
14
home/programs/eww/src/scripts/battery_class.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
bat=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
stat=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
class="batteryFull"
|
||||
|
||||
if [[ $stat == "Charging" ]]; then
|
||||
class="batteryCharging"
|
||||
elif [[ $bat -le 10 ]]; then
|
||||
class="batteryEmpty"
|
||||
elif [[ $bat -le 80 ]]; then
|
||||
class="batteryHalf"
|
||||
fi
|
||||
|
||||
echo "$class"
|
||||
16
home/programs/eww/src/scripts/battery_icon.sh
Executable file
16
home/programs/eww/src/scripts/battery_icon.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
bat=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
stat=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
icon=""
|
||||
|
||||
if [[ $stat == "Charging" ]]; then
|
||||
icon=""
|
||||
elif [[ $bat -le 10 ]]; then
|
||||
icon=""
|
||||
elif [[ $bat -le 50 ]]; then
|
||||
icon=""
|
||||
elif [[ $bat -le 80 ]]; then
|
||||
icon=""
|
||||
fi
|
||||
|
||||
echo "$icon"
|
||||
2
home/programs/eww/src/scripts/battery_volume.sh
Executable file
2
home/programs/eww/src/scripts/battery_volume.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
bat=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
echo "$bat"
|
||||
5
home/programs/eww/src/scripts/cpu.sh
Executable file
5
home/programs/eww/src/scripts/cpu.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
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"
|
||||
6
home/programs/eww/src/scripts/memory.sh
Executable file
6
home/programs/eww/src/scripts/memory.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
mem_info=$(free | grep Mem)
|
||||
used=$(echo "$mem_info" | awk '{print $3}')
|
||||
total=$(echo "$mem_info" | awk '{print $2}')
|
||||
mem_used=$(awk "BEGIN {print int($used/$total * 100)}")
|
||||
|
||||
echo "$mem_used"
|
||||
5
home/programs/eww/src/scripts/mic_class.sh
Executable file
5
home/programs/eww/src/scripts/mic_class.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
|
||||
echo "micOff"
|
||||
else
|
||||
echo "micOn"
|
||||
fi
|
||||
5
home/programs/eww/src/scripts/mic_icon.sh
Executable file
5
home/programs/eww/src/scripts/mic_icon.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
|
||||
echo "" # muted
|
||||
else
|
||||
echo "" # unmuted
|
||||
fi
|
||||
11
home/programs/eww/src/scripts/network_down.sh
Executable file
11
home/programs/eww/src/scripts/network_down.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
# 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}"
|
||||
8
home/programs/eww/src/scripts/network_up.sh
Executable file
8
home/programs/eww/src/scripts/network_up.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
# 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}"
|
||||
8
home/programs/eww/src/scripts/speaker_class.sh
Executable file
8
home/programs/eww/src/scripts/speaker_class.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
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
|
||||
10
home/programs/eww/src/scripts/speaker_icon.sh
Executable file
10
home/programs/eww/src/scripts/speaker_icon.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
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
|
||||
4
home/programs/eww/src/scripts/speaker_volume.sh
Executable file
4
home/programs/eww/src/scripts/speaker_volume.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
|
||||
half_volume=$((volume / 2))
|
||||
|
||||
echo "$half_volume"
|
||||
@@ -1,4 +0,0 @@
|
||||
tail -F /tmp/xmonad-eww-log | while read -r line; do
|
||||
clean_line=$(echo "$line" | sed -E 's/<[^>]+>//g')
|
||||
eww update xmonad_log="$clean_line"
|
||||
done
|
||||
19
home/programs/eww/src/scripts/xmonad_logs.sh
Executable file
19
home/programs/eww/src/scripts/xmonad_logs.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
line=$(cat /tmp/xmonad-eww-log)
|
||||
IFS='|' read -r workspaces windows <<<"$line"
|
||||
# Workspaces
|
||||
workspaceArray=($workspaces)
|
||||
i=0
|
||||
for ws in "${workspaceArray[@]}"; do
|
||||
i=$((i + 1))
|
||||
if [[ "$ws" == [\[]* ]]; then
|
||||
eww update ws$i="ws-current"
|
||||
elif [[ "$ws" == [\(]* ]]; then
|
||||
eww update ws$i="ws-visible"
|
||||
elif [[ "$ws" == [\{]* ]]; then
|
||||
eww update ws$i="ws-hidden"
|
||||
else
|
||||
eww update ws$i="ws-empty"
|
||||
fi
|
||||
done
|
||||
# Windows
|
||||
echo "${windows}"
|
||||
Reference in New Issue
Block a user