feat: bulk update jsuis pressé

This commit is contained in:
Ahurac 2024-11-19 18:36:23 +01:00
parent 1d301d8f9f
commit b4ec5ed3bf
3 changed files with 49 additions and 54 deletions

View file

@ -12,6 +12,10 @@
"swaync-client --subscribe"
)
(deflisten audio-status
"./listen/audio"
)
(defvar workspaces-icon '{
"admin": "",
"everything": "",
@ -24,38 +28,24 @@
"dnd": ""
}')
(defvar battery-icon '{
"Discharging": [
"󰁹",
"󰂂",
"󰂁",
"󰂀",
"󰁿",
"󰁾",
"󰁽",
"󰁼",
"󰁻",
"󰁺",
"󰂎"
],
"Charging": [
"󰂅",
"󰂋",
"󰂊",
"󰢞",
"󰂉",
"󰢝",
"󰂈",
"󰂇",
"󰂆",
"󰢜",
"󰢟"
],
"Full": [
"󱟢",
"󱟢"
]
}')
(defvar battery-icon '[
{ "Discharging": "󰂎", "Charging": "󰢟" },
{ "Discharging": "󰁺", "Charging": "󰢜" },
{ "Discharging": "󰁻", "Charging": "󰂆" },
{ "Discharging": "󰁼", "Charging": "󰂇" },
{ "Discharging": "󰁽", "Charging": "󰂈" },
{ "Discharging": "󰁾", "Charging": "󰢝" },
{ "Discharging": "󰁿", "Charging": "󰂉" },
{ "Discharging": "󰂀", "Charging": "󰢞" },
{ "Discharging": "󰂁", "Charging": "󰂊" },
{ "Discharging": "󰂂", "Charging": "󰂋" },
{ "Discharging": "󰁹", "Charging": "󰂅", "Full": "󱟢" }
]')
(defvar audio-icon '[
{ "muted": "a", "unmuted": "b" },
{ "muted": "c", "unmuted": "d" }
]')
(defwidget workspaces []
(box
@ -109,29 +99,15 @@
))
)
(defwidget audio []
(label
:text ""
)
)
(defwidget battery []
(label
:text "${EWW_BATTERY.BAT0.capacity == 100
? "${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}%"
:text "${battery-icon[round((EWW_BATTERY.BAT0.capacity - 5) / 10, 0) - 1][EWW_BATTERY.BAT0.status]} ${EWW_BATTERY.BAT0.capacity}"
)
)
@ -173,6 +149,7 @@
:halign "end"
:space-evenly false
(audio)
(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.packages = with pkgs; [
pulseaudio
d2
cargo
tinymist
@ -392,7 +393,7 @@
"Mod+WheelScrollUp".action = focus-column-left;
"Mod+Shift+WheelScrollDown".action = move-column-right;
"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+Shift+W".action = maximize-column;
"Mod+W".action = switch-preset-column-width;
@ -448,5 +449,6 @@
programs.eww = {
enable = true;
configDir = ./eww;
package = pkgs.eww-wayland;
};
}