Rice laptop
This commit is contained in:
14
home/scripts/batlvl.nix
Normal file
14
home/scripts/batlvl.nix
Normal 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
12
home/scripts/batlvl.sh
Normal 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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user