Compare commits

...

8 commits

4 changed files with 75 additions and 11 deletions

View file

@ -0,0 +1,15 @@
#!/usr/bin/env sh
case "$1" in
up)
set -- -i
;;
down)
set -- -d
;;
*)
;;
esac
set -- pamixer "$@" 5
exec "$@"

View file

@ -3,7 +3,6 @@ window, menubar {
} }
window { window {
color: white;
font-weight: bold; font-weight: bold;
} }
@ -15,9 +14,10 @@ window > box > box > * {
border-top: 2px solid white; border-top: 2px solid white;
} }
.workspace-button:hover { :hover {
border-color: #80ff80; border-color: #b0ffb0;
color: #e0ffe0; color: #b0ffb0;
border-top-width: 2px;
} }
.workspace-button > box { .workspace-button > box {

View file

@ -24,10 +24,15 @@
) )
(deflisten notifications (deflisten notifications
:initial '{}' :initial '{"count":0}'
"swaync-client --subscribe" "swaync-client --subscribe"
) )
(deflisten sound
:initial '{"output-volume":0,"input-volume":0,"output-muted":false}'
"listen/sound"
)
(defvar battery-icon '{ (defvar battery-icon '{
"unknown": "", "unknown": "",
"critical": "", "critical": "",
@ -54,6 +59,13 @@
"dnd": "󰂛" "dnd": "󰂛"
}') }')
(defvar sound-icon '{
"absent": "󰕿",
"moderate": "󰖀",
"loud": "󰕾",
"muted": "󰖁"
}')
(defwidget workspaces [] (defwidget workspaces []
(eventbox :onscroll 'action/hyprland/nearby-workspace "{}"' (eventbox :onscroll 'action/hyprland/nearby-workspace "{}"'
(box :class "workspaces" (box :class "workspaces"
@ -83,7 +95,11 @@
)) ))
(defwidget time [] (defwidget time []
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}" (box (eventbox
:onclick 'eww open --toggle calendar'
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
))
) )
(defwidget notifications [] (defwidget notifications []
@ -91,6 +107,7 @@
:class "module" :class "module"
:onclick 'swaync-client --toggle-panel' :onclick 'swaync-client --toggle-panel'
:onrightclick 'swaync-client --toggle-dnd' :onrightclick 'swaync-client --toggle-dnd'
:onmiddleclick 'swaync-client --close-all'
"${ "${
notifications.dnd == true notifications.dnd == true
@ -98,18 +115,30 @@
: notifications.count > 0 : notifications.count > 0
? notifications-icon["new"] ? notifications-icon["new"]
: notifications-icon["nothing"] : notifications-icon["nothing"]
} ${notifications.count}" } ${notifications.count}"
)) ))
) )
; (defwidget sound [] "") (defwidget sound []
(box (eventbox
:onscroll 'action/volume "{}"'
:onclick 'pavucontrol & disown'
"${
sound.output-muted == true ? sound-icon["muted"] :
sound.output-volume < 33 ? sound-icon["absent"] :
sound.output-volume < 67 ? sound-icon["moderate"] :
sound-icon["loud"]
} ${sound.output-volume} %"
))
)
(defwidget network [] (defwidget network []
"${ "${
network.state == "wireless" network.state == "wireless"
? network-icon["wifi-${network.wifi.signal}"] ? network-icon["wifi-${network.wifi.signal}"]
: network-icon[network.state] : network-icon[network.state]
} ${ } ${
network.state == "disconnected" network.state == "disconnected"
? "no network" : ? "no network" :
network.state == "ethernet" network.state == "ethernet"
@ -120,7 +149,7 @@
) )
(defwidget battery [] (defwidget battery []
"${battery-icon[batterystatus]}${EWW_BATTERY.BAT1.status == "Charging" ? " " : ""} ${EWW_BATTERY.BAT1.capacity} %" "${battery-icon[batterystatus]}${EWW_BATTERY.BAT1.status == "Charging" ? " " : ""} ${EWW_BATTERY.BAT1.capacity} %"
) )
(defwindow bar (defwindow bar
@ -155,9 +184,22 @@
:space-evenly false :space-evenly false
:class "right" :class "right"
; (sound) (sound)
(network) (network)
(battery) (battery)
) )
) )
) )
(defwindow calendar
:monitor 0
:geometry (geometry
:anchor "bottom center"
:width "350px"
:height "200px"
)
:exclusive false
; :stacking "fg"
(calendar)
)

View file

@ -0,0 +1,7 @@
#!/usr/bin/env sh
pactl subscribe | grep --line-buffered "'change'" | while read -r _unused; do
printf '{"output-volume":%s,"input-volume":%s,"output-muted":%s}\n' \
"$(pamixer --get-volume)" \
"$(pamixer --get-volume --default-source)" \
"$(pamixer --get-mute)"
done