add batman beyond config

This commit is contained in:
2026-05-16 13:01:39 -04:00
parent 2bd06da3ed
commit 1b3849ccd3
38 changed files with 3077 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(paru -Qum | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
#if [ "$updates" -gt 0 ]; then
# echo "# $updates"
#else
# echo ""
#fi
re='^[0-9]+$'
if ! [[ $updates_arch =~ $re ]] ; then
updates_aur=999; exit 1
fi
if ! [[ $updates_arch =~ $re ]] ; then
updates_aur=999; exit 1
fi
echo "P:$updates_arch Y:$updates_aur"
+2
View File
@@ -0,0 +1,2 @@
#awk '{printf " %.1f°F\n", ($1/1000)*9/5+32}' /sys/class/hwmon/hwmon*/temp1_input 2>/dev/null | head -n1
awk '{printf " %.1f°F\n", ($1/1000)*9/5+32; exit}' /sys/class/hwmon/hwmon*/temp1_input 2>/dev/null
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# not useful unless exec commands can be placed in internal polybar modules
# or I can do the low discharging animation from here
BATRAW=$( cat /sys/class/power_supply/BAT0/capacity )
#STATUS=$( cat /sys/class/power_supply/BAT0/status )
STATUS="Charging"
BATADJ=$(( 9 + 100 * $BATRAW / 80 ))
STEP=$(( $BATADJ / 10 ))
CHARGING=( "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂄" )
DISCHARGING=( "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" )
if test $STATUS = "Discharging"; then
echo ${DISCHARGING[$STEP]}
elif test $STATUS = "Charging"; then
echo ${CHARGING[$STEP]}
fi
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh
# shellcheck disable=SC2016,SC2059
KEYBOARD_ID="Keyboard K380 Keyboard"
# cpm: characters per minute
# wpm: words per minute (1 word = 5 characters)
METRIC=cpm
FORMAT="# %d $METRIC"
INTERVAL=20
# If you have a keyboard layout that is not listed here yet, create a condition
# yourself. $3 is the key index. Use `xinput test "AT Translated Set 2 keyboard"`
# to see key codes in real time. Be sure to open a pull request for your
# layout's condition!
LAYOUT=qwerty
case "$LAYOUT" in
qwerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 53) || ($3 >= 52 && $3 <= 58)'; ;;
azerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 54) || ($3 >= 52 && $3 <= 57)'; ;;
dontcare) CONDITION='1'; ;; # Just register all key presses, not only letters and numbers
*) echo "# Unsupported layout \"$LAYOUT\""; exit 1; ;;
esac
# We have to account for the fact we're not listening a whole minute
multiply_by=60
divide_by=$INTERVAL
case "$METRIC" in
wpm) divide_by=$((divide_by * 5)); ;;
cpm) ;;
*) echo "Unsupported metric \"$METRIC\""; exit 1; ;;
esac
hackspeed_cache="$(mktemp -p '' hackspeed_cache.XXXXX)"
trap 'rm "$hackspeed_cache"' EXIT
# Write a dot to our cache for each key press
printf '' > "$hackspeed_cache"
xinput test "$KEYBOARD_ID" | \
stdbuf -o0 awk '$1 == "key" && $2 == "press" && ('"$CONDITION"') {printf "."}' >> "$hackspeed_cache" &
while true; do
# Ask the kernel how big the file is with the command `stat`. The number we
# get is the file size in bytes, which equals the amount of dots the file
# contains, and hence how much keys were pressed since the file was last
# cleared.
lines=$(stat --format %s "$hackspeed_cache")
# Truncate the cache file so that in the next iteration, we count only new
# keypresses
printf '' > "$hackspeed_cache"
# The shell only does integer operations, so make sure to first multiply and
# then divide
value=$((lines * multiply_by / divide_by))
printf "$FORMAT\\n" "$value"
sleep $INTERVAL
done
+13
View File
@@ -0,0 +1,13 @@
#test-fonts.pl
use strict;
use warnings;
use Font::FreeType;
my ($char) = @ARGV;
foreach my $font_def (`fc-list`) {
my ($file, $name) = split(/: /, $font_def);
my $face = Font::FreeType->new->face($file);
my $glyph = $face->glyph_from_char($char);
if ($glyph) {
print $font_def;
}
}
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env bash
set -euo pipefail
get_icon() {
case $1 in
01d) icon="🟠";;
01n) icon="⚫";;
02d) icon="⛅";;
02n) icon="⛅";;
04d) icon="🌥️";;
04n) icon="🌥️";;
09d) icon="🌧️";;
09n) icon="🌧️";;
10d) icon="🌦️";;
10n) icon="🌦️";;
11d) icon="🌩️";;
11n) icon="🌩️";;
13d) icon="❄️";;
13n) icon="❄️";;
50d) icon="🌫️";;
50n) icon="🌫️";;
*) icon="☁️";
esac
echo $icon
}
get_duration() {
osname=$(uname -s)
case $osname in
*BSD) date -r "$1" -u +%H:%M;;
*) date --date="@$1" -u +%H:%M;;
esac
}
KEY=""
CITY=""
UNITS="metric"
SYMBOL="°"
API="https://api.openweathermap.org/data/2.5"
if [ ! -z $CITY ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
current=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
#curl -s "https://api.openweathermap.org/data/2.5/onecall?lat=0&lon=0&appid=TOKEN&units=metric" | jq -r '.daily[1].temp.day'
forecast=$(curl -sf "$API/forecast?appid=$KEY&$CITY_PARAM&units=$UNITS&cnt=1")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ ! -z "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
current=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
forecast=$(curl -sf "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1")
fi
fi
if [ ! -z "$current" ] && [ ! -z "$forecast" ]; then
current_temp=$(printf "%.0f" $(echo "$current" | jq ".main.temp"))
current_icon=$(echo "$current" | jq -r ".weather[0].icon")
forecast_temp=$(printf "%.0f" $(echo "$forecast" | jq ".list[].main.temp"))
forecast_icon=$(echo "$forecast" | jq -r ".list[].weather[0].icon")
sun_rise=$(echo "$current" | jq ".sys.sunrise")
sun_set=$(echo "$current" | jq ".sys.sunset")
now=$(date +%s)
if [ "$sun_rise" -gt "$now" ]; then
daytime="🌅 $(get_duration "$((sun_rise-now))")"
elif [ "$sun_set" -gt "$now" ]; then
daytime="🌇 $(get_duration "$((sun_set-now))")"
else
daytime="🌅 $(get_duration "$((sun_rise-now))")"
fi
echo "$(get_icon "$current_icon") $current_temp$SYMBOL $(get_icon "$forecast_icon") $forecast_temp$SYMBOL $daytime"
fi