Rice laptop
Some checks failed
pre-commit / pre-commit (push) Failing after 23s
pre-commit / pre-commit (pull_request) Failing after 14m39s

This commit is contained in:
2024-04-21 11:46:33 +02:00
parent 8d151534b1
commit e1049f0a16
16 changed files with 312 additions and 19 deletions

14
home/scripts/batlvl.nix Normal file
View File

@@ -0,0 +1,14 @@
{ config, pkgs, ... }:
let
batlvl = pkgs.writeShellApplication {
name = "batlvl";
runtimeInputs = [
];
text = builtins.readFile ./batlvl.sh;
};
in
{
home.packages = [
batlvl
];
}

12
home/scripts/batlvl.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
ac_status=$(cat /sys/class/power_supply/AC/online)
bat_status=$(cat /sys/class/power_supply/BAT0/status)
bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity)
if (("$ac_status" == 0)); then
echo "$bat_status - $bat_lvl%"
else
if [ "$bat_lvl" -lt "90" ]; then
echo "$bat_status - $bat_lvl%"
fi
fi

View File

@@ -10,7 +10,7 @@ if ! [ -d "$WALLPAPER_DIR" ]; then
exit 1
fi
wallpaper_path=$(find "$WALLPAPER_DIR" -mindepth 1 | sort -R | tail -n 1)
wallpaper_path=$(find "$WALLPAPER_DIR" -mindepth 1 | grep png| sort -R | tail -n 1)
if [ -z "$wallpaper_path" ]; then
echo "Unable to find wallpaper"
@@ -26,6 +26,13 @@ echo "setting $wallpaper_path as wallpaper"
hyprctl hyprpaper unload all
hyprctl hyprpaper preload "$wallpaper_path"
if command -v wal &> /dev/null; then
wal -i "$wallpaper_path"
fi
unlink "$WALLPAPER_DIR/current" || true
ln -s "$wallpaper_path" "$WALLPAPER_DIR/current"
for monitor in $(hyprctl monitors | grep 'Monitor' | awk '{ print $2 }'); do
hyprctl hyprpaper wallpaper "$monitor,$wallpaper_path"
done