nixos/absol/eww/config/widgets/resources/eww.yuck

105 lines
2.2 KiB
Text
Raw Normal View History

; for unicode symbols: https://jrgraphix.net/r/Unicode/E000-F8FF
; VARIABLES
(defvar GB 1024000000)
(defvar MB 1024000)
; DATE + TIME
(defpoll time :interval "5s"
:initial ""
`date +%H:%M`)
(defpoll date :interval "60s"
:initial ""
`date "+%A | %m-%d-%+4Y"`)
(defwidget datetime []
(eventbox
:tooltip date
(label
:class "text time"
:text time)
))
; CPU
(defwidget cpu []
(box
:active true
:tooltip "${round(EWW_CPU.cores[0].freq/1000,2)} GHz"
(label
:class "cpu_text"
:text " ${round(EWW_CPU.avg,0)}%")
)
)
; BATTERY
(defwidget battery []
(box
:active true
:tooltip "battery"
(label
:class "battery_text"
:text "${EWW_BATTERY.BAT0.capacity}%"
)
)
)
; MEMORY
(defwidget mem []
(box
:active true
:tooltip {EWW_RAM.used_mem / GB < 1 ? "${round(EWW_RAM.used_mem / MB, 1)} M used" : "${round(EWW_RAM.used_mem / GB, 1)} G used"}
(label
:class "mem_text"
:text " ${round(EWW_RAM.used_mem_perc,0)}%")
)
)
; TEMP
; TODO temperature widget (hover to show all times sorted nicely)
; 
; NETWORK
(defpoll hostname :interval "1m" :initial "" "hostname")
(defpoll status-icon :interval "5s" :initial "" "./widgets/resources/network.sh")
(defwidget network []
(eventbox
:active true
:onclick "/usr/bin/env nm-connection-editor &"
:tooltip hostname
(label
:text status-icon
:class "network_icon")))
; BLUETOOTH
(defwidget bluetooth []
(eventbox
:active true
:onclick "blueman-manager &"
(label
:text ""
:class "bluetooth_icon")))
; VOLUME
2024-07-29 18:04:01 +02:00
(defpoll volume_percent :interval "0.1s" :initial "40" "wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk -F. '{print $2}'")
(defwidget volume []
(eventbox
:active true
:onclick "/usr/bin/env pavucontrol &"
:onscroll "if [ {} = 'up' ]; then wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; else wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-; fi" ; wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-
(box
:space-evenly false
:orientation "h"
:spacing "3"
(label
:class "volume_text"
:text "${volume_percent <= 33 ? "" : volume_percent <= 66 ? "" : ""} ${volume_percent}%")
)))
; TODO add mic widget