128 lines
3.7 KiB
Text
128 lines
3.7 KiB
Text
;; VARIABLE DEFINITIONS
|
|
|
|
|
|
;; Audio
|
|
(deflisten vol "cat ~/.cache/eww/vol && inotifywait -q -m -e close_write ~/.cache/eww/vol | while read -r filename event; do cat ~/.cache/eww/vol; done")
|
|
(defpoll micvol :interval "1m" "wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{print $2}'")
|
|
|
|
;; Workspace Stuff
|
|
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
|
|
(deflisten current_workspace :initial "..." "bash ~/.config/eww/scripts/get-active-workspace")
|
|
(deflisten urgent_workspace :initial "..." "bash ~/.config/eww/scripts/get-urgent-workspaces")
|
|
(defwidget _workspaces []
|
|
(eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget"
|
|
(box :space-evenly false :orientation "vertical"
|
|
(label :text "${workspaces}${current_workspace}${urgent_workspace}" :visible false)
|
|
(for workspace in workspaces
|
|
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
|
|
(box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.id == urgent_workspace ? "urgent" : ""} ${workspace.windows > 0 ? "occupied" : "empty" }"
|
|
(label :text "${workspace.id}")
|
|
))))))
|
|
|
|
;; Screen
|
|
(deflisten backlight "brightnessctl g && inotifywait -q -m -e modify /sys/class/backlight/intel_backlight/actual_brightness | while read -r filename event; do cat /sys/class/backlight/intel_backlight/actual_brightness; done")
|
|
|
|
|
|
;; Widgets
|
|
|
|
(defwidget clock []
|
|
(eventbox
|
|
:onhover "eww open cal"
|
|
(box :orientation "vertical"
|
|
:halign "center"
|
|
:valign "end"
|
|
(box :class "clock" {formattime(EWW_TIME, "%H")})
|
|
(box :class "clock" {formattime(EWW_TIME, "%M")})
|
|
)))
|
|
|
|
(defwidget circle [val prog sty char]
|
|
(box :halign "center"
|
|
:orientation "vertical"
|
|
:valign "end"
|
|
(circular-progress :value prog
|
|
:start-at 10
|
|
:clockwise false
|
|
:thickness 3
|
|
:width 30
|
|
:height 30
|
|
:class "bat"
|
|
:halign "center"
|
|
val )
|
|
(box :class "circle" :style sty char)))
|
|
|
|
(defwidget battery []
|
|
(circle :prog {EWW_BATTERY.BAT1.capacity * (77778 /100000)}
|
|
:sty "color: ${EWW_BATTERY.BAT1.status == 'Charging' ? '#1a1': EWW_BATTERY.BAT1.capacity < 20 ? '#a11': '#cac'};"
|
|
:val {EWW_BATTERY.BAT1.capacity}
|
|
:char ""))
|
|
|
|
(defwidget volume []
|
|
(circle :prog {vol * 7/10}
|
|
:sty "font-size: 12; margin-right: 2px;"
|
|
:val {vol + 1 - 1}
|
|
:char ""))
|
|
|
|
(defwidget mic []
|
|
(circle :prog {micvol * 70}
|
|
:sty "margin-left: 1px;"
|
|
:val {micvol *100}
|
|
:char ""))
|
|
|
|
(defwidget brightness []
|
|
(circle :prog {(backlight / 960) * 7/10}
|
|
:sty "font-size: 12; margin-right: 3px;"
|
|
:val {round( backlight / 960, 0) - 1}
|
|
:char ""))
|
|
|
|
(defwidget power []
|
|
(box :class "power" :valign "end" "⏻"))
|
|
|
|
(defwidget tray []
|
|
(systray :orientation "v" :icon-size 20))
|
|
|
|
|
|
;; Upper Level Widgets
|
|
|
|
|
|
(defwidget bar []
|
|
(centerbox :orientation "vertical"
|
|
:halign "center"
|
|
:space-evenly false
|
|
(_workspaces)
|
|
(clock)
|
|
(box :orientation "vertical" :spacing -25 :valign "end"
|
|
(brightness)
|
|
(mic)
|
|
(volume)
|
|
(battery)
|
|
(tray)
|
|
(power))))
|
|
|
|
(defwidget cal []
|
|
(eventbox
|
|
:onhoverlost "eww close cal"
|
|
(calendar)))
|
|
|
|
|
|
;; Windows
|
|
|
|
(defwindow bar
|
|
:monitor 0
|
|
:geometry (geometry :x "4px"
|
|
:y "1%"
|
|
:height "98%"
|
|
:anchor "left center")
|
|
:stacking "fg"
|
|
:exclusive true
|
|
:class "bar"
|
|
(bar))
|
|
|
|
(defwindow cal
|
|
:monitor 0
|
|
:geometry (geometry :x "1%"
|
|
:y "5%"
|
|
:anchor "left center")
|
|
:stacking "fg"
|
|
:exclusive false
|
|
:class "bar"
|
|
(cal))
|