dotfiles/config/eww/eww.yuck

100 lines
3.4 KiB
Text

;;;; (defpoll time :interval "1s" 'date +%s')
(defwidget clock []
(box :orientation "vertical"
:halign "center"
:valign "end"
(box :class "clock" {formattime(EWW_TIME, "%H")})
(box :class "clock" {formattime(EWW_TIME, "%M")})
))
(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}")
))))))
(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 "󱐋"))
(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")
(defwidget volume []
(circle :prog {vol * 7/10}
:sty "font-size: 12; margin-right: 2px;"
:val {vol + 1 - 1}
:char ""))
(defpoll micvol :interval "1m" "wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{print $2}'")
(defwidget mic []
(circle :prog {micvol * 70}
:sty "margin-left: 1px;"
:val {micvol *100}
:char "󰍬"))
(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")
(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))
(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))))
(defwindow bar
:monitor 0
:geometry (geometry :x "4px"
:y "1%"
:height "98%"
:anchor "left center")
:stacking "fg"
:exclusive true
:class "bar"
(bar))