aboutsummaryrefslogtreecommitdiff
path: root/home/rices/schrottkatze/eww/configDir/scripts
diff options
context:
space:
mode:
authorNatasha Moongrave <natasha@256phi.eu>2026-04-10 12:13:51 +0200
committerNatasha Moongrave <natasha@256phi.eu>2026-04-10 12:13:51 +0200
commit68029c245778f066aff0aad1977b23f6d6f6c561 (patch)
tree9cbfa978795f88c7e7c4ed3d80a903ffaeda9464 /home/rices/schrottkatze/eww/configDir/scripts
parent66888f3eea130323987ca9aa890085057b8ebd34 (diff)
Add schrottkatze rice: Eww status bars
Top bar (CPU, RAM, battery, systray, time, trans flag), bottom bar (workspaces, traveldings transit, Mullvad VPN, lesbian flag). Gruvbox CSS styling, Nushell scripts for battery and ICE train speed.
Diffstat (limited to 'home/rices/schrottkatze/eww/configDir/scripts')
-rwxr-xr-xhome/rices/schrottkatze/eww/configDir/scripts/bat.nu78
-rwxr-xr-xhome/rices/schrottkatze/eww/configDir/scripts/iceTacho.nu38
2 files changed, 116 insertions, 0 deletions
diff --git a/home/rices/schrottkatze/eww/configDir/scripts/bat.nu b/home/rices/schrottkatze/eww/configDir/scripts/bat.nu
new file mode 100755
index 0000000..fd34c50
--- /dev/null
+++ b/home/rices/schrottkatze/eww/configDir/scripts/bat.nu
@@ -0,0 +1,78 @@
+#!/usr/bin/env nu
+
+const ICONS = [
+ [ normal charging];
+ [ 󰂎 󰢟 ]
+ [ 󰁺 󰢜 ]
+ [ 󰁻 󰂆 ]
+ [ 󰁼 󰂇 ]
+ [ 󰁽 󰂈 ]
+ [ 󰁾 󰢝 ]
+ [ 󰁿 󰂉 ]
+ [ 󰂀 󰢞 ]
+ [ 󰂁 󰂊 ]
+ [ 󰂂 󰂋 ]
+ [ 󰁹 󰂅 ]
+];
+
+const DELAY = 2sec;
+
+def "main auto" [] {
+ loop {
+ let paths = ls "/sys/class/power_supply"
+ | each {|it| $it.name | path basename}
+ | filter {|it| $it starts-with "BAT"};
+
+ if ($paths | is-not-empty) {
+ let result = $paths
+ | each {|it| get_and_format $it}
+ | str join " | "
+ | prepend "| "
+ | str join;
+
+ print $result
+ } else {
+ print ""
+ }
+ sleep $DELAY;
+ }
+}
+
+def main [ path: string ] {
+ loop {
+ print (get_and_format $path)
+ sleep $DELAY;
+ }
+}
+
+def get_and_format [ path: string ] {
+ let fract = get_bat_charge_fraction $path;
+ let is_charging = get_bat_charging_status $path;
+ let percent = ($fract * 100) | math round;
+
+ return $"<span foreground=\"#d65d0e\">(get_bat_icon $fract $is_charging)</span> ($percent)<span foreground=\"#7c6f64\">%</span>";
+}
+
+def get_bat_charge_fraction [
+ path: string
+] {
+ let energy_full = open $"/sys/class/power_supply/($path)/energy_full" | into float;
+ let energy_now = open $"/sys/class/power_supply/($path)/energy_now" | into float;
+
+ $energy_now / $energy_full
+}
+
+def get_bat_charging_status [
+ path: string
+] {
+ let status = open $"/sys/class/power_supply/($path)/status";
+
+ $status like Charging
+}
+
+def get_bat_icon [
+ frac: float
+ is_charging = false
+] {
+ $ICONS | get (($frac * 10) | math round) | get (if ($is_charging) { "charging" } else { "normal" })
+}
diff --git a/home/rices/schrottkatze/eww/configDir/scripts/iceTacho.nu b/home/rices/schrottkatze/eww/configDir/scripts/iceTacho.nu
new file mode 100755
index 0000000..5225dc2
--- /dev/null
+++ b/home/rices/schrottkatze/eww/configDir/scripts/iceTacho.nu
@@ -0,0 +1,38 @@
+#!/usr/bin/env nu
+
+const TABLE = {
+ 401: 280
+ 402: 280
+ 403: 330
+ 406: 330
+ 407: 320
+ 408: 320
+ 411: 230
+ 415: 230
+ 412: 265
+ 605: 200
+};
+
+def main [ ] {
+ loop {
+ if ((iw dev wlp4s0 link | lines | filter {|it| $it =~ "WIFIonICE" } | length) == 1) {
+ let iceData = http get https://iceportal.de/api1/rs/status;
+ let tzn = $iceData.tzn;
+ let br = $iceData.series;
+ let speed = $iceData.speed;
+ let speedfrac = $speed / ($TABLE | get $br);
+
+ print ({
+ tzn: $tzn,
+ br: $br,
+ speed: $speed,
+ frac: $speedfrac
+ } | to json -r);
+
+ sleep 2sec;
+ } else {
+ print "null";
+ sleep 5sec;
+ }
+ }
+}