Compare commits
2 commits
1d301d8f9f
...
f8ebae68a1
Author | SHA1 | Date | |
---|---|---|---|
f8ebae68a1 | |||
b4ec5ed3bf |
3 changed files with 48 additions and 54 deletions
|
@ -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
16
common/eww/listen/audio
Executable 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
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue