dwm: Add bar script

This commit is contained in:
Donovan Glover 2024-08-23 11:04:38 -04:00
parent 8172b16f56
commit 8a0153027c
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -10,6 +10,8 @@ let
;
osu-backgrounds = pkgs.callPackage ../packages/osu-backgrounds.nix { };
barScript = "dwm/bar.fish";
in
{
home-manager.sharedModules = singleton {
@ -37,14 +39,8 @@ in
xrdb -merge ~/.Xresources
xset r rate 300 50
feh --bg-fill "$(fish -c 'random choice (fd . ${osu-backgrounds}/2024-07-15-Aerial-Antics-Art-Contest-All-Entries --follow -e jpg -e png)')" &
while true; do
xsetroot -name "$(date +"%F %R")"
sleep 1m
done &
~/.config/${barScript} &
picom --daemon
fcitx5 &
while true; do
@ -54,6 +50,46 @@ in
};
};
xdg.configFile = {
${barScript} = {
executable = true;
text = # fish
''
#!/usr/bin/env fish
function get_icon
if test "$argv" -gt 90
echo " "
else if test "$argv" -gt 60
echo " "
else if test "$argv" -gt 30
echo " "
else if test "$argv" -gt 10
echo " "
else
echo " "
end
end
function update_bar
set VOLUME "$(math "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100")%"
set TIME "$(date '+%x%a%R')"
set capacity "$(cat /sys/class/power_supply/BAT0/capacity)"
set BATTERY "$(get_icon $capacity)$capacity%"
xsetroot -name "$VOLUME$BATTERY$TIME"
end
while true
update_bar
sleep 10s
end
'';
};
};
services = {
picom = rec {
enable = true;