Compare commits

..

2 commits

Author SHA1 Message Date
f8ebae68a1 fix(eww): don't use deprecated wayland package 2024-11-19 18:37:21 +01:00
b4ec5ed3bf feat: bulk update jsuis pressé 2024-11-19 18:36:23 +01:00
3 changed files with 48 additions and 54 deletions

View file

@ -12,6 +12,10 @@
"swaync-client --subscribe" "swaync-client --subscribe"
) )
(deflisten audio-status
"./listen/audio"
)
(defvar workspaces-icon '{ (defvar workspaces-icon '{
"admin": "", "admin": "",
"everything": "", "everything": "",
@ -24,38 +28,24 @@
"dnd": "" "dnd": ""
}') }')
(defvar battery-icon '{ (defvar battery-icon '[
"Discharging": [ { "Discharging": "󰂎", "Charging": "󰢟" },
"󰁹", { "Discharging": "󰁺", "Charging": "󰢜" },
"󰂂", { "Discharging": "󰁻", "Charging": "󰂆" },
"󰂁", { "Discharging": "󰁼", "Charging": "󰂇" },
"󰂀", { "Discharging": "󰁽", "Charging": "󰂈" },
"󰁿", { "Discharging": "󰁾", "Charging": "󰢝" },
"󰁾", { "Discharging": "󰁿", "Charging": "󰂉" },
"󰁽", { "Discharging": "󰂀", "Charging": "󰢞" },
"󰁼", { "Discharging": "󰂁", "Charging": "󰂊" },
"󰁻", { "Discharging": "󰂂", "Charging": "󰂋" },
"󰁺", { "Discharging": "󰁹", "Charging": "󰂅", "Full": "󱟢" }
"󰂎" ]')
],
"Charging": [ (defvar audio-icon '[
"󰂅", { "muted": "a", "unmuted": "b" },
"󰂋", { "muted": "c", "unmuted": "d" }
"󰂊", ]')
"󰢞",
"󰂉",
"󰢝",
"󰂈",
"󰂇",
"󰂆",
"󰢜",
"󰢟"
],
"Full": [
"󱟢",
"󱟢"
]
}')
(defwidget workspaces [] (defwidget workspaces []
(box (box
@ -109,29 +99,15 @@
)) ))
) )
(defwidget audio []
(label
:text ""
)
)
(defwidget battery [] (defwidget battery []
(label (label
:text "${EWW_BATTERY.BAT0.capacity == 100 :text "${battery-icon[round((EWW_BATTERY.BAT0.capacity - 5) / 10, 0) - 1][EWW_BATTERY.BAT0.status]} ${EWW_BATTERY.BAT0.capacity}"
? "${battery-icon[EWW_BATTERY.BAT0.status][0]}"
: EWW_BATTERY.BAT0.capacity >= 90
? "${battery-icon[EWW_BATTERY.BAT0.status][1]}"
: EWW_BATTERY.BAT0.capacity >= 80
? "${battery-icon[EWW_BATTERY.BAT0.status][2]}"
: EWW_BATTERY.BAT0.capacity >= 70
? "${battery-icon[EWW_BATTERY.BAT0.status][3]}"
: EWW_BATTERY.BAT0.capacity >= 60
? "${battery-icon[EWW_BATTERY.BAT0.status][4]}"
: EWW_BATTERY.BAT0.capacity >= 50
? "${battery-icon[EWW_BATTERY.BAT0.status][5]}"
: EWW_BATTERY.BAT0.capacity >= 40
? "${battery-icon[EWW_BATTERY.BAT0.status][6]}"
: EWW_BATTERY.BAT0.capacity >= 30
? "${battery-icon[EWW_BATTERY.BAT0.status][7]}"
: EWW_BATTERY.BAT0.capacity >= 20
? "${battery-icon[EWW_BATTERY.BAT0.status][8]}"
: EWW_BATTERY.BAT0.capacity >= 10
? "${battery-icon[EWW_BATTERY.BAT0.status][9]}"
: "${battery-icon[EWW_BATTERY.BAT0.status][10]}"} ${EWW_BATTERY.BAT0.capacity}%"
) )
) )
@ -173,6 +149,7 @@
:halign "end" :halign "end"
:space-evenly false :space-evenly false
(audio)
(battery) (battery)
) )
) )

16
common/eww/listen/audio Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
print_audio_status() {
volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
if echo "$volume" | grep -q 'MUTE'; then
mute=muted
else
mute=unmuted
fi
volume=$(echo "$volume" | awk '{ print $2 }')
printf '{"volume": %s, "status": "%s"}\n' "$volume" "$mute"
}
print_audio_status
pactl subscribe | grep --line-buffered "'change'" | while read -r _line; do
print_audio_status
done

View file

@ -7,6 +7,7 @@
home.stateVersion = "24.05"; home.stateVersion = "24.05";
home.packages = with pkgs; [ home.packages = with pkgs; [
pulseaudio
d2 d2
cargo cargo
tinymist tinymist
@ -392,7 +393,7 @@
"Mod+WheelScrollUp".action = focus-column-left; "Mod+WheelScrollUp".action = focus-column-left;
"Mod+Shift+WheelScrollDown".action = move-column-right; "Mod+Shift+WheelScrollDown".action = move-column-right;
"Mod+Shift+WheelScrollUp".action = move-column-left; "Mod+Shift+WheelScrollUp".action = move-column-left;
"Mod+N".action = spawn "swaync" "--toggle-panel"; "Mod+N".action = spawn "swaync-client" "--toggle-panel";
"Mod+Tab".action = focus-workspace-previous; "Mod+Tab".action = focus-workspace-previous;
"Mod+Shift+W".action = maximize-column; "Mod+Shift+W".action = maximize-column;
"Mod+W".action = switch-preset-column-width; "Mod+W".action = switch-preset-column-width;