get app icons for each workspace

This commit is contained in:
samantha42
2026-04-23 05:43:05 +02:00
parent 52fa42698f
commit f7d6f07e3a
9 changed files with 334 additions and 106 deletions

View File

@@ -4,11 +4,11 @@
(deflisten workspaces-dp2
:initial "[]"
"bash ~/.config/eww/scripts/get-workspaces.sh DP-2")
"python3 ~/.config/eww/scripts/get-workspaces.py DP-2")
(deflisten workspaces-hdmi
:initial "[]"
"bash ~/.config/eww/scripts/get-workspaces.sh HDMI-A-1")
"python3 ~/.config/eww/scripts/get-workspaces.py HDMI-A-1")
(deflisten active-window-dp2
:initial ""
@@ -50,43 +50,53 @@
;;; Helper Widgets
;;; ─────────────────────────────────────────────
(defwidget workspace-btn [id label active urgent output]
(button
:class {active ? "workspace-btn active" : urgent ? "workspace-btn urgent" : "workspace-btn"}
:onclick "hyprctl dispatch workspace ${id}"
:width 32
label))
(defwidget workspace-btn [id label active urgent output icons pxwidth]
(box
:orientation "h"
:width pxwidth
(button
:class {active ? "workspace-btn active" : urgent ? "workspace-btn urgent" : "workspace-btn"}
:onclick "hyprctl dispatch workspace ${id}"
:hexpand true
(box
:orientation "h"
:spacing 3
:halign "center"
:valign "center"
(label :text label :class "ws-label")
(for icon in icons
(image
:path icon
:image-width 16
:image-height 16))))))
(defwidget workspaces-widget [workspaces]
(box
:class "workspaces"
:class "workspaces"
:orientation "h"
:spacing 2
:spacing 2
(for ws in workspaces
(workspace-btn
:id {ws.id}
:label {ws.label}
:active {ws.active}
:urgent {ws.urgent}
:output {ws.output}))))
:id {ws.id}
:label {ws.label}
:active {ws.active}
:urgent {ws.urgent}
:output {ws.output}
:icons {ws.icons}
:pxwidth {ws.pxwidth}))))
(defwidget window-widget [title]
(box
:class "window-title"
:orientation "h"
:space-evenly false
(label
:class "window-text"
:text {title}
:limit-width 20)))
;;; add this with your variables
(defvar clock-show-date false)
;;; replace your clock-widget
(defwidget clock-widget []
(box
(button
:class "clock"
:orientation "h"
:spacing 2
(label :text clock-time :class "clock-time")
))
:onclick "eww update clock-show-date=${clock-show-date == 'true' ? 'false' : 'true'}"
(label
:class "clock-time"
:text {clock-show-date == "true" ? clock-date : clock-time})))
(defwidget cpu-widget []
(box
@@ -155,17 +165,15 @@
(defwidget bar-dp2 []
(centerbox
:orientation "h"
(box :class "bar-left" :orientation "h" :spacing 2 :space-evenly false :halign "start"
(workspaces-widget :workspaces workspaces-dp2)
(window-widget :title active-window-dp2))
(box :class "bar-left" :orientation "h" :spacing 8 :space-evenly false :halign "start"
(workspaces-widget :workspaces workspaces-dp2))
(box :class "bar-center" :orientation "h" :spacing 12 :space-evenly false
(logout-btn)
(clock-widget)
(settings-btn))
(box :class "bar-right" :orientation "h" :spacing 6 :space-evenly false :halign "end"
(theme-widget)
(volume-widget :on-click "bash ~/.config/eww/scripts/toggle-mixer.sh")
(network-widget)
)
(box :class "bar-right" :orientation "h" :spacing 8 :space-evenly false :halign "end"
(settings-menu)
(logout-menu)
(cpu-widget)
(mem-widget))))
@@ -174,7 +182,7 @@
:geometry (geometry
:x "10px"
:y "8px"
:width "1900px"
:width "1920px"
:height "24px"
:anchor "top center")
:exclusive true
@@ -189,17 +197,13 @@
(defwidget bar-hdmi []
(centerbox
:orientation "h"
(box :class "bar-left" :orientation "h" :spacing 8 :space-evenly false :max-width 300
(workspaces-widget :workspaces workspaces-hdmi)
(window-widget :title active-window-hdmi))
(box :class "bar-left" :orientation "h" :spacing 8 :space-evenly false
(workspaces-widget :workspaces workspaces-hdmi))
(box :class "bar-center" :orientation "h" :spacing 12 :space-evenly false
(logout-btn)
(clock-widget)
(settings-btn))
(box :class "bar-right" :orientation "h" :spacing 6 :space-evenly false :halign "end"
(theme-widget)
(volume-widget :on-click "pavucontrol")
(network-widget)
(clock-widget))
(box :class "bar-right" :orientation "h" :spacing 2 :space-evenly false :halign "end"
(settings-btn)
(cpu-widget)
(mem-widget))))
@@ -208,10 +212,100 @@
:geometry (geometry
:x "10px"
:y "8px"
:width "1900px"
:width "1920px"
:height "24px"
:anchor "top center")
:exclusive true
:layer "top"
:namespace "eww-bar"
(bar-hdmi))
(defvar logout-menu-open false)
(defvar settings-menu-open false)
(defwidget logout-menu []
(box
:class "center-menu-wrap"
:orientation "h"
:spacing 4
:space-evenly false
(revealer
:reveal {logout-menu-open == "true"}
:transition "slideright"
:duration "200ms"
(box
:class "center-menu"
:orientation "h"
:spacing 4
:space-evenly false
(button
:class "center-btn"
:tooltip "Lock"
:onclick "eww update logout-menu-open=false && hyprlock"
(label :text "󰌾"))
(button
:class "center-btn"
:tooltip "Reboot"
:onclick "eww update logout-menu-open=false && systemctl reboot"
(label :text "󰜉"))
(button
:class "center-btn"
:tooltip "Shutdown"
:onclick "eww update logout-menu-open=false && systemctl poweroff"
(label :text "󰐥"))
(button
:class "center-btn"
:tooltip "Logout"
:onclick "eww update logout-menu-open=false && hyprctl dispatch exit"
(label :text "󰍃"))))
(button
:class "center-btn"
:onclick "eww update logout-menu-open=${logout-menu-open == 'true' ? 'false' : 'true'} && eww update settings-menu-open=false"
(label :text {logout-menu-open == "true" ? "󰅖" : "󰍃"}))
))
(defwidget settings-menu []
(box
:class "center-menu-wrap"
:orientation "h"
:spacing 4
:space-evenly false
(revealer
:reveal {settings-menu-open == "true"}
:transition "slideright"
:duration "200ms"
(box
:class "center-menu"
:orientation "h"
:spacing 4
:space-evenly false
(theme-widget)
(volume-widget :on-click "bash ~/.config/eww/scripts/toggle-mixer.sh")
(network-widget)
(button
:class "center-btn"
:tooltip "Displays"
:onclick "eww update settings-menu-open=false && wdisplays"
(label :text "󰍹"))
))
(button
:class {settings-menu-open == "true" ? "center-btn active" : "center-btn"}
:onclick "eww update settings-menu-open=${settings-menu-open == 'true' ? 'false' : 'true'} && eww update logout-menu-open=false"
(label :text {settings-menu-open == "true" ? "󰅖" : "󰒓"}))
))