1
0
Files
dotfiles/.config/eww/eww.yuck
2025-02-07 17:59:10 +01:00

275 lines
6.2 KiB
Plaintext

; https://github.com/trapano-monogamo/my_eww_bar/blob/master/eww-bar/eww.yuck
; https://github.com/natperron/dotfiles/tree/main/.config/eww
; https://github.com/Aylur/dotfiles/tree/eww/.config/eww
; https://github.com/gh0stzk/dotfiles/blob/master/config/bspwm/eww/calendar/calendar.yuck
(defvar output "DP-0")
(defvar workspaces "[]")
(defpoll datetime
:interval "1s"
:initial "{\"weekday\": \"\", \"date\": \"\", \"time\": \"\"}"
`date +'{\"weekday\": \"%a\", \"date\": \"%d.%b\", \"time\": \"%H:%M\"}'`
)
(defvar show-date false)
(defpoll volume
:interval "1s"
:initial "0"
`~/.config/eww/get-volume`
)
(defpoll mute
:interval "1s"
:initial false
`~/.config/eww/get-mute`
)
(defpoll mpd-status
:interval "1s"
:initial "{}"
`~/.config/eww/mpd-status`
)
(deflisten active-window
:initial ""
`~/.config/eww/active-window`
)
(defpoll pulse-sinks
:interval "1s"
:initial "[]"
`~/.config/eww/list-sinks`
)
(defvar dummy "")
(defwindow primary
:monitor "eDP-1"
:windowtype "dock"
:wm-ignore false
:geometry (geometry :width "100%" :anchor "top center")
:reserve (struts :side "top" :distance "10%")
(primary_bar :monitor "eDP-1")
)
(defwindow secondary
:monitor "DP-2-1"
:windowtype "dock"
:wm-ignore false
:geometry (geometry :width "100%" :anchor "top center")
:reserve (struts :side "top" :distance "10%")
(secondary_bar :monitor "DP-2-1")
)
(defwindow third
:monitor "DP-2-2"
:windowtype "dock"
:wm-ignore false
:geometry (geometry :width "100%" :anchor "top center")
:reserve (struts :side "top" :distance "10%")
(secondary_bar :monitor "DP-2-2")
)
(defwidget primary_bar [monitor]
(centerbox
:class "bar bar-primary"
:orientation "horizontal"
:hexpand false
(left :monitor monitor)
(center)
(right :monitor monitor)
)
)
(defwidget secondary_bar [monitor]
(centerbox
:class "bar bar-secondary"
:orientation "horizontal"
:hexpand false
(left :monitor monitor)
(center)
(right :monitor monitor)
)
)
(defwidget left [monitor]
(box
:spacing 20
:space-evenly false
(workspaces :monitor monitor)
(label :text dummy)
; (active-window :monitor monitor)
)
)
(defwidget workspaces [monitor]
(box
:class "workspaces"
:space-evenly false
(for workspace in workspaces
(eventbox
:cursor "pointer"
:visible {workspace.output == monitor}
(button
:class "${workspace.focused ? "active" : ""} ${workspace.visible ? "visible" : ""}"
:onclick "i3-msg workspace ${workspace.name}"
"${workspace.name}"
)
)
)
)
)
(defwidget active-window [monitor]
(box
:class "active-window"
(label :text "${active-window}")
)
)
(defwidget center []
(box
:spacing 20
:space-evenly false
(player)
)
)
(defwidget player []
(box
:visible {mpd-status.status != "[empty]"}
:class "player"
:spacing 6
:space-evenly false
(label :text "${mpd-status.song} (${mpd-status.artist})" )
(box
(button
:onclick "mpc prev"
""
)
(button
:class "play"
:onclick "mpc toggle"
"${mpd-status.status == "[playing]" ? "" : ""}"
)
(button
:onclick "mpc next"
""
)
)
)
)
(defwidget metric [class label value tooltip]
(box
:orientation "h"
:class "metric ${class}"
:space-evenly false
:tooltip tooltip
(box :width 16 label)
(progress :value value)
)
)
(defwidget right [monitor]
(box
:halign "end"
:spacing 20
:space-evenly false
(metric
:class "battery"
:label "${ EWW_BATTERY["BAT0"].status == "Discharging" ? "󱊣" : "󱊦" }"
:value { EWW_BATTERY["BAT0"].capacity }
:tooltip "${ EWW_BATTERY["BAT0"].capacity } % - ${ EWW_BATTERY["BAT0"].status }")
(metric
:class "disk"
:label "󰋊"
:value { EWW_DISK["/"].used_perc }
:tooltip "${ round(EWW_DISK["/"].free / 1024 / 1024 / 1024, 2) } GiB frei")
(metric
:class "memory"
:label ""
:value { EWW_RAM.used_mem_perc }
:tooltip "${ round(EWW_RAM.free_mem / 1024 / 1024 / 1024, 2) } GiB frei")
(metric
:class "cpu"
:label ""
:value { EWW_CPU.avg }
:tooltip "${ round(EWW_CPU.avg, 2) }% benutzt")
(sound)
(systray
:spacing 4
:icon-size 20)
(time)
)
)
(defwidget revealer-on-hover [var varname ?class ?duration ?transition]
(box :class "${class} revealer-on-hover"
:orientation "h"
:space-evenly false
(eventbox :class "eventbox"
:onhover "eww update ${varname}=true"
:onhoverlost "eww update ${varname}=false"
(box :space-evenly false
(children :nth 0)
(revealer :reveal var
:transition {transition ?: "slideright"}
:duration {duration ?: "500ms"}
(children :nth 1)
)
(children :nth 2)
)
)
)
)
(defwidget sound []
(box
:class "volume"
:space-evenly false
:tooltip "${volume}%"
(eventbox
:onclick "~/.config/eww/mute-volume"
:onrightclick "eww open --toggle --arg monitor=${output} sound-control"
(label
:width 16
:text "${mute ? "󰝟" : volume <= 33 ? "󰕿" : volume <= 66 ? "󰖀" : "󰕾"}"
)
)
(scale
:min 0
:max 100
:value {volume}
:onchange "~/.config/eww/set-volume {}"
)
)
)
(defwidget time []
(revealer-on-hover
:var show-date
:varname "show-date"
:transition "slideleft"
(label :text "${datetime.weekday} ")
(label :text "${datetime.date} ")
(label :text "${datetime.time}")
)
)
(defwindow sound-control [monitor]
:monitor monitor
:geometry (geometry :x "40%" :y "40" :anchor "center top")
:wm-ignore true
(box
:class "sound-control"
:orientation "v"
(for sink in pulse-sinks
(button
:halign "start"
:onclick "~/.config/eww/move-sink-inputs ${sink.index}"
(box
:spacing 10
:space-evenly false
(label :style "min-width: 16px" :text "${sink.state == "RUNNING" ? "" : ""}")
(label :text "${sink.description}")
)
)
)
)
)