2024-06-02 14:57:12 -07:00
|
|
|
(defvar amixer "amixer -D pulse")
|
2024-06-02 23:51:55 -07:00
|
|
|
(defvar temperature-monitor "psensor")
|
2023-08-28 15:31:02 -07:00
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwindow vbar
|
2023-08-28 15:31:02 -07:00
|
|
|
:exclusive true
|
|
|
|
:monitor 0
|
|
|
|
:windowtype "dock"
|
|
|
|
:geometry (geometry
|
|
|
|
:x "0%"
|
|
|
|
:y "0%"
|
2024-06-03 00:03:45 -07:00
|
|
|
:width "25px"
|
2024-06-02 07:11:20 -07:00
|
|
|
:height "99%"
|
2023-08-28 15:31:02 -07:00
|
|
|
:anchor "center left"
|
|
|
|
)
|
|
|
|
:reserve (struts :side "left" :distance "20px")
|
2024-05-31 14:33:53 -07:00
|
|
|
(centerbox
|
|
|
|
:orientation "v"
|
2024-06-02 23:51:55 -07:00
|
|
|
(box
|
|
|
|
:orientation "v" :space-evenly false :valign "start"
|
2024-06-02 06:14:20 -07:00
|
|
|
(label
|
2024-06-02 23:51:55 -07:00
|
|
|
:class "launcher"
|
|
|
|
:valign "start"
|
|
|
|
:width "20px" :height "20px"
|
2024-06-02 06:14:20 -07:00
|
|
|
:unindent true
|
|
|
|
:tooltip active-window-title
|
|
|
|
:text "☯")
|
2024-05-31 14:33:53 -07:00
|
|
|
(widget-workspaces)
|
|
|
|
)
|
|
|
|
(widget-media)
|
2024-06-02 14:57:12 -07:00
|
|
|
(box
|
|
|
|
:class "status"
|
|
|
|
:orientation "v" :space-evenly false :valign "end"
|
2024-05-31 14:33:53 -07:00
|
|
|
(widget-tray)
|
2024-06-02 14:57:12 -07:00
|
|
|
(widget-volume)
|
|
|
|
(widget-microphone)
|
2024-06-02 23:51:55 -07:00
|
|
|
(widget-temperature)
|
2024-05-31 14:33:53 -07:00
|
|
|
(widget-cpu)
|
|
|
|
(widget-memory)
|
|
|
|
(widget-clock)
|
2023-08-28 15:31:02 -07:00
|
|
|
)
|
|
|
|
))
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-workspaces []
|
2023-08-28 15:31:02 -07:00
|
|
|
(box
|
|
|
|
:class "workspaces"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly true
|
2024-06-02 23:51:55 -07:00
|
|
|
:spacing 10
|
|
|
|
:valign "start"
|
2023-08-28 15:31:02 -07:00
|
|
|
:halign "center"
|
|
|
|
(for workspace in workspaces
|
|
|
|
(button
|
|
|
|
:class "${workspace.class}"
|
2024-06-02 06:21:36 -07:00
|
|
|
:onclick "scripts/compositor-control set-workspace ${workspace.id}"
|
2023-08-28 15:31:02 -07:00
|
|
|
"${workspace.text}"))
|
|
|
|
))
|
|
|
|
(deflisten workspaces :initial "[]"
|
2024-06-02 06:14:20 -07:00
|
|
|
"scripts/compositor-control workspaces")
|
|
|
|
(deflisten active-window-title :initial ""
|
|
|
|
"scripts/compositor-control active-title")
|
2023-08-28 15:31:02 -07:00
|
|
|
|
|
|
|
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-media []
|
|
|
|
(box
|
|
|
|
:class "media"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly false
|
|
|
|
:valign "center"
|
2024-06-02 23:51:55 -07:00
|
|
|
:tooltip {media-position-text}
|
2024-06-02 07:11:20 -07:00
|
|
|
(eventbox
|
|
|
|
:onclick "playerctl play-pause"
|
|
|
|
(circular-progress
|
|
|
|
:class { media-status == "Paused" ? "media-paused" : "media-playing" }
|
|
|
|
:width 20
|
|
|
|
:height 20
|
|
|
|
:thickness 5
|
|
|
|
:value {100.0 * media-position / (media-length / 1000000.0)}
|
|
|
|
:visible {media-current != "" && media-length != 1}
|
|
|
|
))
|
2024-05-31 14:33:53 -07:00
|
|
|
(label
|
2024-06-02 14:57:12 -07:00
|
|
|
:class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" }
|
2024-06-02 06:14:20 -07:00
|
|
|
:angle 270
|
2024-05-31 14:33:53 -07:00
|
|
|
:xalign 0.5
|
|
|
|
:yalign 0.5
|
2024-06-02 06:14:20 -07:00
|
|
|
:justify "center"
|
2024-06-02 14:57:12 -07:00
|
|
|
:limit-width 120
|
2024-06-02 07:11:20 -07:00
|
|
|
:text {media-current != "" ? "『${media-current}』" : "『』"})
|
2024-05-31 14:33:53 -07:00
|
|
|
))
|
|
|
|
|
2024-06-02 07:11:20 -07:00
|
|
|
|
|
|
|
(deflisten media-current :initial ""
|
2024-05-31 14:33:53 -07:00
|
|
|
"playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true")
|
2024-06-02 07:11:20 -07:00
|
|
|
(deflisten media-position-text :initial ""
|
2024-05-31 14:33:53 -07:00
|
|
|
"playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true")
|
2024-06-02 07:11:20 -07:00
|
|
|
(defpoll media-position :interval "1s"
|
2024-06-02 06:14:20 -07:00
|
|
|
"playerctl position")
|
2024-06-02 07:11:20 -07:00
|
|
|
(deflisten media-length :initial 1
|
2024-06-02 06:14:20 -07:00
|
|
|
"playerctl --follow metadata mpris:length")
|
2024-06-02 07:11:20 -07:00
|
|
|
(deflisten media-status :initial "Stopped"
|
|
|
|
"playerctl --follow status")
|
2023-08-28 15:31:02 -07:00
|
|
|
|
2024-06-02 14:57:12 -07:00
|
|
|
(defwidget widget-volume []
|
2024-05-31 14:33:53 -07:00
|
|
|
(eventbox
|
2024-06-02 18:23:39 -07:00
|
|
|
:onhover "${EWW_CMD} update show-volume=true"
|
|
|
|
:onhoverlost "${EWW_CMD} update show-volume=false"
|
2024-06-02 14:57:12 -07:00
|
|
|
:onclick "${amixer} sset Master toggle"
|
2024-05-31 14:33:53 -07:00
|
|
|
(box
|
2024-06-02 18:23:39 -07:00
|
|
|
:class "volume"
|
2024-05-31 14:33:53 -07:00
|
|
|
:orientation "v"
|
|
|
|
:space-evenly "false"
|
|
|
|
:spacing "2"
|
2024-06-02 15:05:58 -07:00
|
|
|
:tooltip "Volume: ${current-volume}% [${current-volume-state}]"
|
2024-06-02 14:57:12 -07:00
|
|
|
(revealer :transition "slideup" :reveal show-volume
|
2024-05-31 14:33:53 -07:00
|
|
|
(scale
|
2024-06-02 14:57:12 -07:00
|
|
|
:class "scale"
|
2024-05-31 14:33:53 -07:00
|
|
|
:value current-volume
|
|
|
|
:orientation "v"
|
|
|
|
:flipped true
|
2024-06-02 06:14:20 -07:00
|
|
|
:marks true
|
2024-05-31 14:33:53 -07:00
|
|
|
:max 101
|
|
|
|
:min 0
|
2024-06-02 14:57:12 -07:00
|
|
|
:onchange "${amixer} sset Master {}%" ))
|
2024-06-02 07:11:20 -07:00
|
|
|
(label
|
2024-06-02 14:57:12 -07:00
|
|
|
:class "icon"
|
2024-06-03 00:03:45 -07:00
|
|
|
:width 25 :height 20
|
2024-06-02 07:11:20 -07:00
|
|
|
:xalign 0.5 :yalign 0.5
|
|
|
|
:noindent true
|
2024-06-02 18:23:39 -07:00
|
|
|
:text { current-volume-state == "off" ? "" : (current-volume > 50 ? "" : "") }))))
|
2024-06-02 14:57:12 -07:00
|
|
|
(defwidget widget-microphone []
|
|
|
|
(eventbox
|
2024-06-02 18:23:39 -07:00
|
|
|
:onhover "${EWW_CMD} update show-microphone=true"
|
|
|
|
:onhoverlost "${EWW_CMD} update show-microphone=false"
|
2024-06-02 14:57:12 -07:00
|
|
|
:onclick "${amixer} sset Capture toggle"
|
|
|
|
(box
|
2024-06-02 18:23:39 -07:00
|
|
|
:class "microphone"
|
2024-06-02 14:57:12 -07:00
|
|
|
:orientation "v"
|
|
|
|
:space-evenly "false"
|
|
|
|
:spacing "2"
|
2024-06-02 15:05:58 -07:00
|
|
|
:tooltip "Capture : ${current-microphone}% [${current-microphone-state}]"
|
2024-06-02 14:57:12 -07:00
|
|
|
(revealer :transition "slideup" :reveal show-microphone
|
|
|
|
(scale
|
|
|
|
:class "scale"
|
|
|
|
:value current-microphone
|
|
|
|
:orientation "v"
|
|
|
|
:flipped true
|
|
|
|
:marks true
|
|
|
|
:max 101
|
|
|
|
:min 0
|
|
|
|
:onchange "${amixer} sset Capture {}%" ))
|
|
|
|
(label
|
|
|
|
:class "icon"
|
2024-06-03 00:03:45 -07:00
|
|
|
:width 25 :height 20
|
2024-06-02 14:57:12 -07:00
|
|
|
:xalign 0.5 :yalign 0.5
|
|
|
|
:noindent true
|
|
|
|
:text { current-microphone-state == "off" ? "" : "" }))))
|
2024-06-02 23:51:55 -07:00
|
|
|
(defpoll current-volume :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
|
|
|
|
(defpoll current-volume-state :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'")
|
|
|
|
(defpoll current-microphone :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
|
2024-06-02 18:23:39 -07:00
|
|
|
(defpoll current-microphone-state :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $4 }'")
|
2024-06-02 14:57:12 -07:00
|
|
|
(defvar show-volume false)
|
|
|
|
(defvar show-microphone false)
|
2024-05-31 14:33:53 -07:00
|
|
|
|
2024-06-02 23:51:55 -07:00
|
|
|
; FIXME: Maybe use a env var here instead
|
|
|
|
(defvar cpu-temp-key "ASUS_WMI_SENSORS_CPU_TEMPERATURE")
|
|
|
|
(defvar gpu-temp-key "AMDGPU_MEM")
|
|
|
|
(defvar temperature-threshold 80)
|
|
|
|
|
2024-06-02 14:57:12 -07:00
|
|
|
(defwidget widget-temperature []
|
2024-06-02 23:51:55 -07:00
|
|
|
(eventbox
|
|
|
|
:onclick temperature-monitor
|
|
|
|
(box
|
|
|
|
:class "temperature"
|
|
|
|
:orientation "h"
|
|
|
|
:tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}C; GPU ${EWW_TEMPS[gpu-temp-key]}C"
|
|
|
|
:space-evenly true
|
2024-06-03 00:03:45 -07:00
|
|
|
:width 25
|
2024-06-02 23:51:55 -07:00
|
|
|
:halign "" :valign "center"
|
|
|
|
(progress
|
|
|
|
:class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" }
|
|
|
|
:halign "center" :valign "center"
|
|
|
|
:flipped "true"
|
|
|
|
:width 3
|
|
|
|
:orientation "v"
|
|
|
|
:value {EWW_TEMPS[cpu-temp-key]}
|
|
|
|
)
|
|
|
|
(progress
|
2024-06-03 00:03:45 -07:00
|
|
|
:class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-gpu" }
|
2024-06-02 23:51:55 -07:00
|
|
|
:halign "center" :valign "center"
|
|
|
|
:flipped "true"
|
|
|
|
:width 3
|
|
|
|
:orientation "v"
|
|
|
|
:value {EWW_TEMPS[gpu-temp-key]}
|
|
|
|
)
|
|
|
|
)))
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-cpu []
|
2024-06-02 14:57:12 -07:00
|
|
|
(box
|
|
|
|
:class "cpu"
|
|
|
|
:orientation "v"
|
|
|
|
(circular-progress
|
|
|
|
:class "progress"
|
2024-06-03 00:03:45 -07:00
|
|
|
:width 25
|
|
|
|
:height 25
|
2024-05-31 14:33:53 -07:00
|
|
|
:thickness 4
|
2024-06-02 14:57:12 -07:00
|
|
|
:tooltip " ${round(EWW_CPU.avg, 2)}%"
|
2024-05-31 14:33:53 -07:00
|
|
|
:value {EWW_CPU.avg}
|
2024-06-02 14:57:12 -07:00
|
|
|
)))
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-memory []
|
2024-06-02 14:57:12 -07:00
|
|
|
(box
|
|
|
|
:class "memory"
|
|
|
|
:orientation "v"
|
|
|
|
(circular-progress
|
|
|
|
:class "progress"
|
2024-06-03 00:03:45 -07:00
|
|
|
:width 25
|
|
|
|
:height 25
|
2024-05-31 14:33:53 -07:00
|
|
|
:thickness 4
|
2024-06-02 14:57:12 -07:00
|
|
|
:tooltip " ${round(100 * EWW_RAM.used_mem / EWW_RAM.total_mem, 2)}%"
|
2024-05-31 14:33:53 -07:00
|
|
|
:value {EWW_RAM.used_mem_perc}
|
2024-06-02 14:57:12 -07:00
|
|
|
)))
|
2024-05-31 14:33:53 -07:00
|
|
|
(defwidget widget-tray []
|
|
|
|
(systray
|
|
|
|
:class "systray"
|
|
|
|
:orientation "v"
|
|
|
|
:space-evenly true
|
2024-06-03 00:03:45 -07:00
|
|
|
:icon-size 25
|
2024-05-31 14:33:53 -07:00
|
|
|
:prepend-new true
|
|
|
|
))
|
|
|
|
|
|
|
|
(defwidget widget-clock []
|
2023-08-28 15:31:02 -07:00
|
|
|
(box
|
|
|
|
:class "clock"
|
|
|
|
:orientation "v"
|
|
|
|
:valign "end"
|
|
|
|
:spacing 1
|
2024-06-02 07:11:20 -07:00
|
|
|
:width 20
|
2024-06-02 18:23:39 -07:00
|
|
|
:tooltip {formattime(EWW_TIME, "%F (%a) %T [%Z]")}
|
2024-06-02 14:57:12 -07:00
|
|
|
;(box :class "icon" "")
|
2024-06-02 23:51:55 -07:00
|
|
|
(label :text "${clock.m}")
|
|
|
|
(label :text "${clock.d}")
|
|
|
|
(label :class "icon" :text "")
|
|
|
|
(label :text "${clock.H}")
|
|
|
|
(label :text "${clock.M}")
|
2023-08-28 15:31:02 -07:00
|
|
|
))
|
|
|
|
|
|
|
|
(defpoll clock :initial "{}" :interval "10s"
|
|
|
|
"date '+{\"H\":\"%H\", \"M\":\"%M\", \"d\":\"%d\", \"m\":\"%m\", \"b\":\"%b\", \"Y\":\"%Y\"}'")
|
|
|
|
|
|
|
|
|
|
|
|
; Calendar
|
|
|
|
|
|
|
|
(defwindow calendar
|
|
|
|
:geometry (geometry :x "70px"
|
|
|
|
:y "65%"
|
|
|
|
:width "270px"
|
|
|
|
:height "60px")
|
2024-05-31 14:33:53 -07:00
|
|
|
(cal))
|
2023-08-28 15:31:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
(defwidget cal []
|
|
|
|
(box :class "cal"
|
|
|
|
:orientation "v"
|
|
|
|
(box :class "cal-inner-box"
|
|
|
|
(calendar :class "cal"
|
|
|
|
:day calendar_day
|
|
|
|
:month calendar_month
|
|
|
|
:year calendar_year))))
|
|
|
|
(defpoll calendar_day :interval "10h"
|
|
|
|
"date '+%d'")
|
|
|
|
(defpoll calendar_month :interval "10h"
|
|
|
|
"scripts/calendar")
|
|
|
|
(defpoll calendar_year :interval "10h"
|
|
|
|
"date '+%Y'")
|
|
|
|
|
2024-06-02 14:57:12 -07:00
|
|
|
; Weather
|
|
|
|
|
|
|
|
(defwidget widget-weather [orientation]
|
2023-08-28 15:31:02 -07:00
|
|
|
(box
|
2024-06-02 14:57:12 -07:00
|
|
|
:class "weather"
|
|
|
|
:orientation orientation
|
2023-08-28 15:31:02 -07:00
|
|
|
:space-evenly false
|
2024-06-02 14:57:12 -07:00
|
|
|
:valign "start"
|
|
|
|
:halign "center"
|
|
|
|
:spacing 10
|
|
|
|
(button :onclick "scripts/popup weather" "W")
|
2023-08-28 15:31:02 -07:00
|
|
|
))
|
|
|
|
|
2024-06-02 14:57:12 -07:00
|
|
|
(defpoll weather-text :initial "" :interval "180s"
|
|
|
|
"curl --max-time 2 wttr.in")
|
|
|
|
|
|
|
|
(defwindow weather
|
|
|
|
:geometry (geometry :x "70px"
|
|
|
|
:y "50%"
|
|
|
|
:width "270px"
|
|
|
|
:height "60px")
|
|
|
|
(box weather-text))
|