fix(eww): add support for multiple screens to status bar

This commit is contained in:
Kiana Sheibani 2025-03-03 16:41:05 -05:00
parent 7933cd829b
commit 0275dcacdd
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -236,14 +236,13 @@
(defpoll idleinhibit :interval "10s" :initial "0" (defpoll idleinhibit :interval "10s" :initial "0"
"pgrep -c -f wayland\"\"-idle-inhibitor || true") "pgrep -c -f wayland\"\"-idle-inhibitor || true")
(defwidget bar_power [] (defwidget bar_power [screen]
(eventbox :onclick "${EWW_CMD} active-windows | grep -q power \ (eventbox :onclick "${EWW_CMD} active-windows | grep -q power_${screen} \
&& ${EWW_CMD} close power || ${EWW_CMD} open power" && ${EWW_CMD} close power_${screen} || ${EWW_CMD} open power --id power_${screen} --screen ${screen}"
(box :class "bar-power" (box :class "bar-power"
"⏻"))) "⏻")))
(defwindow power (defwindow power [screen]
:monitor 0
:geometry (geometry :geometry (geometry
:width "375px" :width "375px"
:height "150px" :height "150px"
@ -252,27 +251,27 @@
:stacking "fg" :stacking "fg"
:exclusive false :exclusive false
:focusable false :focusable false
(eventbox :onhoverlost "${EWW_CMD} close power" (eventbox :onhoverlost "${EWW_CMD} close power_${screen}"
(box :class "power" (box :class "power"
:orientation "v" :orientation "v"
(box :orientation "h" (box :orientation "h"
(button :onclick "${EWW_CMD} close power; systemctl suspend" (button :onclick "${EWW_CMD} close power_${screen}; systemctl suspend"
:tooltip "Sleep" :tooltip "Sleep"
(box :style "color: #9aa5ce;" (box :style "color: #9aa5ce;"
"󰤄")) "󰤄"))
(button :onclick "${EWW_CMD} close power; hyprlock --immediate &" (button :onclick "${EWW_CMD} close power_${screen}; hyprlock --immediate &"
:tooltip "Lock" :tooltip "Lock"
(box :style "color: #cfc9c2;" (box :style "color: #cfc9c2;"
"")) ""))
(button :onclick "${EWW_CMD} close power; hyprctl dispatch exit" (button :onclick "${EWW_CMD} close power_${screen}; hyprctl dispatch exit"
:tooltip "Log Out" :tooltip "Log Out"
(box :style "color: #7dcfff; padding-left: 0.3ex;" (box :style "color: #7dcfff; padding-left: 0.3ex;"
"")) ""))
(button :onclick "${EWW_CMD} close power; reboot" (button :onclick "${EWW_CMD} close power_${screen}; reboot"
:tooltip "Reboot" :tooltip "Reboot"
(box :style "color: #e0af68;" (box :style "color: #e0af68;"
"")) ""))
(button :onclick "${EWW_CMD} close power; poweroff" (button :onclick "${EWW_CMD} close power_${screen}; poweroff"
:tooltip "Shutdown" :tooltip "Shutdown"
(box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;"
"⏼"))) "⏼")))
@ -324,7 +323,7 @@
:artist-limit 30 :artist-limit 30
:title-limit 25))) :title-limit 25)))
(defwidget fire_bar_right_edge [] (defwidget fire_bar_right_edge [screen]
(box :orientation "h" (box :orientation "h"
:space-evenly false :space-evenly false
:halign "end" :halign "end"
@ -339,9 +338,9 @@
(bar_ram) (bar_ram)
(bar_battery) (bar_battery)
(bar_sep) (bar_sep)
(bar_power))) (bar_power :screen screen)))
(defwidget fire_bar_layout [] (defwidget fire_bar_layout [screen]
(centerbox :class "bar" (centerbox :class "bar"
:orientation "h" :orientation "h"
(box :orientation "h" (box :orientation "h"
@ -353,7 +352,7 @@
(box :orientation "h" (box :orientation "h"
:space-evenly false :space-evenly false
(fire_bar_right_wing) (fire_bar_right_wing)
(fire_bar_right_edge)))) (fire_bar_right_edge :screen screen))))
(defwidget earth_bar_left_edge [] (defwidget earth_bar_left_edge []
@ -397,7 +396,7 @@
(bar_sep) (bar_sep)
(bar_idleinhibit))) (bar_idleinhibit)))
(defwidget earth_bar_layout [] (defwidget earth_bar_layout [screen]
(centerbox :class "bar" (centerbox :class "bar"
:orientation "h" :orientation "h"
(box :orientation "h" (box :orientation "h"
@ -412,8 +411,7 @@
(earth_bar_right_edge)))) (earth_bar_right_edge))))
(defwindow fire_bar (defwindow fire_bar [screen]
:monitor 0
:geometry (geometry :width "100%" :geometry (geometry :width "100%"
:height "35px" :height "35px"
:anchor "top center") :anchor "top center")
@ -421,10 +419,9 @@
:stacking "fg" :stacking "fg"
:exclusive true :exclusive true
:focusable false :focusable false
(fire_bar_layout)) (fire_bar_layout :screen screen))
(defwindow earth_bar (defwindow earth_bar [screen]
:monitor 0
:geometry (geometry :width "100%" :geometry (geometry :width "100%"
:height "35px" :height "35px"
:anchor "top center") :anchor "top center")
@ -432,4 +429,4 @@
:stacking "fg" :stacking "fg"
:exclusive true :exclusive true
:focusable false :focusable false
(earth_bar_layout)) (earth_bar_layout :screen screen))