Introduces eww bar

This commit is contained in:
Michel Fedde 2025-11-11 17:44:06 +01:00
parent 75bc7eb6a7
commit e58899e4ae
30 changed files with 279 additions and 1147 deletions

View file

@ -0,0 +1,22 @@
(defpoll bar-audio-icon :interval "1s" :initial "" `~/.config/eww/widgets/bar/scripts/audio.sh`)
(defpoll bar-audio-volume :interval "1s" :initial "" `pactl --format="json" get-sink-volume $(pactl get-default-sink) | jq '.volume | map(.value) | length as $amount | add / $amount'`)
(defwidget bar-audio []
(eventbox
:onclick "hyprctl dispatch exec pavucontrol"
:onrightclick "hyprctl dispatch exec rofi -show pactl"
(box
:hexpand false
:halign "end"
:space-evenly false
:spacing 20
:class "widget default-padding"
{bar-audio-icon}
(progress
:valign "center"
:value {(bar-audio-volume / 65536) * 100}
)
)
)
)

View file

@ -0,0 +1,8 @@
(defpoll bar-time-display :interval "1s" :initial "" `date +"󰃭 %d  %R"`)
(defwidget bar-time []
(box
:class "widget default-padding"
{bar-time-display}
)
)

View file

@ -0,0 +1,76 @@
(defpoll bar-workspace-data :interval "0.1s" :initial "[]" `~/.config/eww/widgets/bar/scripts/workspaces.sh`)
(defwidget bar-workspaces []
(box
:class "widget workspaces"
:space-evenly false
:hexpand false
:halign "start"
(for workspace in bar-workspace-data
(eventbox
:onclick "${EWW_CMD} open bar-workspace-window --arg workspaceId=${workspace.id}"
:cursor "pointer"
(box
:space-evenly false
:spacing 10
:class "workspace ${workspace.activeOnAnyScreen ? "active": ""} ${workspace.activeOnCurrentScreen ? "current": ""}"
(box
:space-evenly false
:spacing 10
(label
:text {workspace.name}
)
(box
:spacing 10
(for window in {workspace.windows}
(label
:text {window.icon}
)
)
)
)
)
)
)
)
)
(defwindow bar-workspace-window [workspaceId]
:monitor 1
:geometry (geometry
:x "10px"
:y "50px"
:width "512px"
:height "0px"
:anchor "top left")
:stacking "fg"
(box
(for workspace in bar-workspace-data
(box
:orientation "v"
:vexpand false
:valign "start"
:class "widget default-padding"
:space-evenly false
:spacing 10
:visible {workspaceId == workspace.id}
(for window in {workspace.windows}
(eventbox
:cursor "pointer"
:onclick "hyprctl dispatch focuswindow pid:${window.pid} && ${EWW_CMD} close bar-workspace-window"
:onrightclick "${EWW_CMD} close bar-workspace-window"
(label
:halign "start"
:text "${window.icon} ${window.title}"
:truncate false
)
)
)
)
)
)
)