Switch to niri - Episode 2: The (first?) purge
This commit is contained in:
parent
f28ec1ae8f
commit
c2ebb8d760
54 changed files with 192 additions and 83206 deletions
51
modules/desktop-environment/home/eww/configDir/scripts/bat.nu
Executable file
51
modules/desktop-environment/home/eww/configDir/scripts/bat.nu
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
const ICONS = [
|
||||
[ normal charging];
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
[ ]
|
||||
];
|
||||
|
||||
def main [ path: string ] {
|
||||
loop {
|
||||
let fract = get_bat_charge_fraction $path;
|
||||
let is_charging = get_bat_charging_status $path;
|
||||
let percent = ($fract * 100) | math round;
|
||||
|
||||
print $"<span foreground=\"#d65d0e\">(get_bat_icon $fract $is_charging)</span> ($percent)<span foreground=\"#7c6f64\">%</span>";
|
||||
sleep 2sec;
|
||||
}
|
||||
}
|
||||
|
||||
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" })
|
||||
}
|
38
modules/desktop-environment/home/eww/configDir/scripts/iceTacho.nu
Executable file
38
modules/desktop-environment/home/eww/configDir/scripts/iceTacho.nu
Executable file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue