Files
nixos/Droidnix/assets/traveldroid/conf_bak/eww/eww.yuck
T
2026-04-04 14:53:11 +02:00

80 lines
3.0 KiB
Plaintext

;; Main bar widget
(defwidget bar []
(box :class "bar" :orientation "h" :space-evenly false :font "FiraCode Nerd Font 10"
;; Left: Workspaces (Hyprland)
(box :class "workspaces" :orientation "h"
(label :class "workspace" :id "workspace_1" :text "1")
(label :class "workspace" :id "workspace_2" :text "2")
(label :class "workspace" :id "workspace_3" :text "3")
(label :class "workspace" :id "workspace_4" :text "4")
(label :class "workspace" :id "workspace_5" :text "5")
)
;; Center: Empty (placeholder for alignment)
(box :halign "center" :hexpand true)
;; Right: System modules
(box :class "right-items" :orientation "h" :spacing 8
;; Idle inhibitor
(button :class "idle-inhibitor" :onclick "eww update idle_inhibitor_icon='\uF472'; notify-send 'Idle inhibitor' 'Activated'"
:label (label :id "idle_inhibitor_icon" :text "\uF472"))
;; PulseAudio
(button :class "pulseaudio" :onclick "pavucontrol"
:label (label :id "pulseaudio_label" :text "\uF028 100%"))
;; Network
(button :class "network" :onclick "impala" :onclick-right "nm-connection-editor"
:label (label :id "network_label" :text "Disconnected !"))
;; Battery
(button :class "battery" :label (label :id "battery_label" :text "100% \uF0E4"))
;; Tray placeholder (requires external tray like waybar-tray)
(box :class "tray" :orientation "h" :spacing 4
(label :text "Tray"))
;; Clock
(button :class "clock" :onclick "flatpak run eu.betterbird.Betterbird -calendar"
:label (label :id "clock_label" :text "Mon, 01 Jan 2024 - 12:00"))
)
)
)
;; Window definition
(defwindow bar-window
:geometry (geometry :x 0 :y 0 :width 1920 :height 34 :anchor "top left")
:layer "top"
:exclusivity "ignore"
(bar)
)
;; Scripts to update dynamic content
(defpoll [1000] ;; Update every second
;; Update PulseAudio volume
(setq pulseaudio-volume (exec "pamixer --get-volume"))
(setq pulseaudio-muted (exec "pamixer --get-mute"))
(if (string= pulseaudio-muted "true")
(eww update pulseaudio_label="\uF026")
(eww update pulseaudio_label=(strfmt "{}% {}" pulseaudio-volume (if (> (string->number pulseaudio-volume) 50) "\uF028" "\uF027"))
)
;; Update network status
(setq network-essid (exec "nmcli -t -f TYPE,NAME dev status | awk -F: '/wifi/{print $2}'"))
(if (string-empty? network-essid)
(eww update network_label="Disconnected !")
(eww update network_label=(strfmt "\uF1EB ({})" network-essid))
)
;; Update clock
(eww update clock_label=(strftime "%a, %d %b %Y - %H:%M"))
;; Update battery status
(setq battery-capacity (exec "cat /sys/class/power_supply/BAT0/capacity"))
(setq battery-status (exec "cat /sys/class/power_supply/BAT0/status"))
(if (string= battery-status "Charging")
(eww update battery_label=(strfmt "{}% \uF0E4" battery-capacity))
(eww update battery_label=(strfmt "{}% \uF079" battery-capacity))
)
)