solorice/config/eww/eww.yuck

198 lines
5.0 KiB
Plaintext

(defwidget bar []
(centerbox :orientation "h"
(workspaces)
(window)
(sidestuff)))
(defwidget sidestuff []
(box
:class "sidestuff"
:orientation "h"
:space-evenly false
:halign "end"
:spacing 10
(music)
(metric
:label ""
:value volume
:onchange "pulsemixer --set-volume {}" )
;; (metric_extended
;; :label ""
;; :value brightness
;; :onchange "doas brightnessctl set {}" )
(cpu)
(github)
;; (network)
(battery)
time
date
))
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace")
(defwidget workspaces []
(eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces"
(box :space-evenly true :halign "start" :spacing 5
(label :text "${workspaces}${current_workspace}" :visible false)
(for workspace in workspaces
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
(box :class "workspace-entry ${workspace.window > 0 ? "current" : ""}"
(label :text "${workspace.id}" :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""}" )))))))
;; (box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""}"
;; (label :text "${workspace.id}")))))))
(deflisten window :initial "..." "bash ~/.config/eww/scripts/get-window-title")
(defwidget window []
(box :class "window"
(label :text "${window}")))
(defwidget music []
(box :class "music ${music_status == "Playing" ? "playing" : "paused"}"
:orientation "h"
:space-evenly false
:halign "center"
(button :onclick "sp play" {music != "" ? "${music}" : ""})))
(defwidget icon-module [icon ?class ?visible]
(box :class "${class} icon-module"
:orientation "h"
:halign "end"
:space-evenly false
:visible {visible ?: true} ; because the argument is optional
(label :class "icon-module__icon" :text "${icon}")
(children)))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(defpoll music
:interval "1s"
"scripts/get-music")
(defpoll music_status
:interval "1s"
"sp status")
(defpoll volume
:interval "1s"
"scripts/getvol")
(defwidget metric_extended [label value onchange]
(box
:orientation "h"
:class "metric"
:space-evenly false
(box
:class "label" label)
(scale
:min 0
:max 256
:active {onchange != ""}
:value value
:onchang
:onchange onchange)))
(defpoll brightness
:interval "1s"
:class "brightness"
"brightnessctl get")
;; "format-icons": ["", "", "", "", "", "", "", "", ""],
(defwidget battery []
(icon-module
:icon "${EWW_BATTERY.BAT0.status == "Charging" ? "" :
EWW_BATTERY.BAT0.capacity > 90 ? "" :
EWW_BATTERY.BAT0.capacity > 70 ? "" :
EWW_BATTERY.BAT0.capacity > 40 ? "" :
EWW_BATTERY.BAT0.capacity > 20 ? "" :
""}"
:class "battery ${EWW_BATTERY.BAT0.capacity > 30 ? "good" : EWW_BATTERY.BAT0.capacity > 10 ? "warning" : "critical"} ${EWW_BATTERY.BAT0.status}"
(label
:text "${EWW_BATTERY.BAT0.capacity}%")))
(defpoll time :interval "1s"
"date '+%H:%M:%S'")
(defpoll date :interval "10s"
"date '+%d.%m.%Y'")
(defpoll github_poll
:initial ""
:interval "1m" "sh ~/.config/eww/scripts/github")
(defwidget github []
(button
:onclick "xdg-open https://github.com/notifications"
(box
(icon-module
:class "github"
:icon ""
:visible {github_poll != ""})
github_poll)))
(defwidget cpu []
(icon-module
:icon ""
:class "cpu ${EWW_CPU.avg > 90 ? "danger" : EWW_CPU.avg > 60 ? "warning" : ""}"
(label
:text "${round(EWW_CPU.avg, 0)}%")))
;; (defpoll net_poll
;; :initial "..."
;; :interval "10s" "sh ~/.config/eww/scripts/get-network")
(defwidget network []
(icon-module
:icon ""
:class "network ${EWW_NET.wlan0.NET_DOWN == 0 && EWW_NET.wlan0.NET_UP == 0 ? "disconnected" : ""}"
(label
:text "${EWW_NET.wlan0.NET_DOWN == 0 && EWW_NET.wlan0.NET_UP == 0 ? "Disconnected ⚠" : ""}")))
;; "network": {
;; "format-wifi": "{essid} ({signalStrength}%) ",
;; "format-ethernet": "{ipaddr}/{cidr} ",
;; "tooltip-format": "{ifname} via {gwaddr} ",
;; "format-linked": "{ifname} (No IP) ",
;; "format-disconnected": "",
;; "format-alt": "{ifname}: {ipaddr}/{cidr}"
;; },
(defwindow bar
:monitor 0
:exclusive true
:geometry (geometry
:x "0%"
:y "0%"
:width "133.333%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))
(defwindow bar-1
:monitor 1
:exclusive true
:geometry (geometry
:x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))