that's a bunch of cool new stuff

This commit is contained in:
2024-12-19 23:32:30 +01:00
parent ae3d29b0ee
commit ac51a31675
34 changed files with 864 additions and 517 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
sleep 0.2
value=($(cat /sys/class/leds/input*::capslock/brightness | cut -f1 -d,))
# echo ${value[2]}
if [ ${value[2]} == 1 ];
then
icon_name="/usr/share/icons/Tela-purple-dark/symbolic/status/capslock-enabled-symbolic.svg"
output="caps lock on"
else
icon_name="/usr/share/icons/Tela-purple-dark/symbolic/status/capslock-disabled-symbolic.svg"
output="caps lock off"
fi
#notify-send -t 600 -i $icon_name -r 555 $output
# dunstify "$output" -i "$icon_name" -t 600 --replace=555 -h boolean:value:"${value[2]}" -u low
notify-send -e "$output" -i "$icon_name" -h string:x-canonical-private-synchronous:state -h boolean:value:"${value[2]}" -r 555
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
readonly ENABLED=''
readonly DISABLED=''
dbus-monitor path='/org/freedesktop/Notifications',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged' --profile |
while read -r _; do
PAUSED="$(dunstctl is-paused)"
if [ "$PAUSED" == 'false' ]; then
CLASS="enabled"
TEXT="$ENABLED"
TOOLTIP="Notifications are on"
else
CLASS="disabled"
TEXT="$DISABLED"
TOOLTIP="Notifications are off"
COUNT="$(dunstctl count waiting)"
if [ "$COUNT" != '0' ]; then
TEXT="$DISABLED ($COUNT)"
fi
fi
printf '{"text": "%s", "class": "%s", "tooltip": "%s"}\n' "$TEXT" "$CLASS" "$TOOLTIP"
done
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
CURRENT_LANG=$(echo $LANG| cut -d. -f1)
TRANSL_FILE=~/.config/$CURRENT_LANG
echo $TRANSL_FILE
while IFS="," read -r rec_column1 rec_column2 rec_column3 rec_column4
do
echo "Displaying Record-$rec_column1"
echo "Quantity: $rec_column2"
echo "Price: $rec_column3"
echo "Value: $rec_column4"
echo ""
done < <(tail -n +2 $TRANSL_FILE)
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/bash
while :
do
CPU_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
case $CPU_GOV in
performance)
CPU_GOV_SHORT=󰓅
;;
balanced)
CPU_GOV_SHORT=󰾅
;;
powersave)
CPU_GOV_SHORT=󰌪
;;
userspace)
CPU_GOV_SHORT=uspace
;;
ondemand)
CPU_GOV_SHORT=ondmnd
;;
conservative)
CPU_GOV_SHORT=cons
;;
schedutil)
CPU_GOV_SHORT=sutil
;;
*)
STATEMENTS
;;
esac
CPU_GOV_FULL="${CPU_GOV^}"
s="text|alt|tooltip|class
$CPU_GOV_SHORT|$CPU_GOV_FULL|CPU Mode: $CPU_GOV_FULL|cpugov"
jq --unbuffered --compact-output -Rn '
( input | split("|") ) as $keys |
( inputs | split("|") ) as $vals |
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"
sleep 5
done
#echo '{"text": "$(CPU_GOV)", "alt": "$CPU_GOV", "tooltip": "$CPU_GOV", "class": "$cpugov" }'
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/bash
while :
do
GPU_STAT=$(cat /sys/class/hwmon/hwmon5/device/gpu_busy_percent)
ICON="<span color='#69ff94' size='8pt' rise='1.5pt'>▁</span>"
if [ "$GPU_STAT" -lt 10 ]; then
ICON="<span color='#69ff94' size='8pt' rise='1.5pt'>▁</span>"
elif [ "$GPU_STAT" -lt 20 ]; then
ICON="<span color='#2aa9ff' size='8pt' rise='1.5pt'>▂</span>"
elif [ "$GPU_STAT" -lt 40 ]; then
ICON="<span color='#f8f8f2' size='8pt' rise='1.5pt'>▃</span>"
elif [ "$GPU_STAT" -lt 50 ]; then
ICON="<span color='#f8f8f2' size='8pt' rise='1.5pt'>▄</span>"
elif [ "$GPU_STAT" -lt 60 ]; then
ICON="<span color='#ffffa5' size='8pt' rise='1.5pt'>▅</span>"
elif [ "$GPU_STAT" -lt 70 ]; then
ICON="<span color='#ffffa5' size='8pt' rise='1.5pt'>▆</span>"
elif [ "$GPU_STAT" -lt 80 ]; then
ICON="<span color='#ff9977' size='8pt' rise='1.5pt'>▇</span>"
elif [ "$GPU_STAT" -lt 100 ]; then
ICON="<span color='#dd532e' size='8pt' rise='1.5pt'>█</span>"
fi
s="text|alt|tooltip|class|percentage
GPU $ICON|GPU $ICON $GPU_STAT%|GPU $ICON $GPU_STAT%|gpustat|$GPU_STAT"
jq --unbuffered --compact-output -Rn '
( input | split("|") ) as $keys |
( inputs | split("|") ) as $vals |
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"
sleep 5
done
#echo '{"text": "$(CPU_GOV)", "alt": "$CPU_GOV", "tooltip": "$CPU_GOV", "class": "$cpugov" }'
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/bash
set -e
# https://blog.dhampir.no/content/sleeping-without-a-subprocess-in-bash-and-how-to-sleep-forever
snore() {
local IFS
[[ -n "${_snore_fd:-}" ]] || exec {_snore_fd}<> <(:)
read -r ${1:+-t "$1"} -u $_snore_fd || :
}
getter() {
DELAY=0.2
while snore $DELAY; do
SINKS=$(pactl --format=json list sinks)
CURRENT_SINK=$(pactl get-default-sink)
CURRENT_SINK_OBJ=$(pactl --format=json list sinks | jq '.[] | select(.state="$(pactl get-default-sink)")')
echo $CURRENT_SINK_OBJ
exit 1
s="text|alt|tooltip|class
$CPU_GOV_SHORT|$CPU_GOV_FULL|CPU Mode: $CPU_GOV_FULL|cpugov"
jq --unbuffered --compact-output -Rn '
( input | split("|") ) as $keys |
( inputs | split("|") ) as $vals |
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"
done
}
if [[ $1 = "-g" ]] then
getter
fi
exit 0
#echo '{"text": "$(CPU_GOV)", "alt": "$CPU_GOV", "tooltip": "$CPU_GOV", "class": "$cpugov" }'
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
for i in {1..5}
do
text=$(curl -s "https://wttr.in/$1?format=1")
if [[ $? == 0 ]]
then
text=$(echo "$text" | sed -E "s/\s+/ /g")
tooltip=$(curl -s "https://wttr.in/$1?format=4")
if [[ $? == 0 ]]
then
tooltip=$(echo "$tooltip" | sed -E "s/\s+/ /g")
tooltip="${tooltip//+/ }"
echo "{\"text\":\"$text\", \"tooltip\":\"$tooltip\"}"
exit
fi
fi
sleep 2
done
echo "{\"text\":\"error\", \"tooltip\":\"error\"}"
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
while :
do
tooltip=$(hyprshade current)
if [[ -z "$tooltip" ]]; then
tooltip="Off"
fi
text="󰈈"
if [[ -z "$tooltip" ]]; then
text="󰡮"
fi
echo '{"text": "'$text'", "tooltip": "Current shader: '$tooltip'", "class": "hyprshade", "alt": "'$tooltip'"}'
sleep 1
done