mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-07 06:29:00 +01:00
dwm: Add bar script
This commit is contained in:
parent
8172b16f56
commit
8a0153027c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user