dotfiles/.config/eww/eww.yuck

261 lines
7.8 KiB
Text
Raw Normal View History

2024-10-21 16:49:00 +02:00
; Brightness
2024-11-05 14:09:13 +01:00
(defpoll brightness :initial "128" :interval "1h" "cat /sys/class/backlight/amdgpu_bl1/brightness")
2024-10-21 09:34:11 +02:00
(defvar brightness-icons '["", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]')
(defvar brightness-slide false)
; Battery
(defvar battery-icons '{"Full": {"10": "󰂄"}, "Charging": ["󰢟", "󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], "Discharging": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]}')
2024-11-19 09:37:19 +01:00
; Bluetooth
(deflisten bluetooth :initial "{}" "~/.config/eww/scripts/get-bluetooth.sh")
2024-10-21 09:34:11 +02:00
; DateTime
2024-11-05 14:09:13 +01:00
(defpoll datetime :interval "1s" "date +'%a %-e %b %X'")
2024-10-21 16:49:00 +02:00
(defpoll month :interval "1m" :initial "1" "date +'%m'")
(defpoll day :interval "1m" :initial "1" "date +'%d'")
2024-10-21 13:57:40 +02:00
(defpoll year :interval "1m" :initial "0" "date +'%Y'")
2024-10-21 09:34:11 +02:00
; Network
2024-11-05 14:09:13 +01:00
(deflisten network :initial '{"if": "null"}' "~/.config/eww/scripts/get-network.sh")
2024-10-21 16:49:00 +02:00
; Notifications status
2024-11-05 14:09:13 +01:00
(defpoll nf-enabled :initial "true" :interval "1h" "makoctl mode | grep -q dnd && echo false || echo true")
2024-10-21 16:49:00 +02:00
; Packages updates
(deflisten packages-updates :initial '{"count": "-", "class": " "}' "~/.config/eww/scripts/pkg-updates.sh")
2024-11-05 14:09:13 +01:00
; Volume
(defpoll volume :initial '{"input":{"value":50,"muted":0},"output":{"value":50,"muted":0}}' :interval "1h" "~/.config/eww/scripts/get-volume.sh")
(defvar volume-icons '{"input": {"active": ["󰍬", "󰍬", "󰍬"], "muted": "󰍭"}, "output": {"active": ["󰕿", "󰖀", "󰕾"], "muted": "󰝟"}}')
(defvar volume-slide '{"input": false, "output": false}')
2024-10-21 09:58:57 +02:00
; Window Title
2024-10-21 13:57:40 +02:00
(deflisten window-title "~/.config/eww/scripts/get-window-title.sh")
2024-10-21 09:58:57 +02:00
2024-10-21 11:14:08 +02:00
; Workspaces
2024-10-21 13:57:40 +02:00
(deflisten workspaces :initial "[]" "~/.config/eww/scripts/get-workspaces.sh")
2024-10-21 11:14:08 +02:00
(deflisten active-workspace "~/.config/eww/scripts/get-active-workspace.sh")
2024-10-21 09:34:11 +02:00
; Widgets
(defwidget bar-left []
(box :halign "start"
2024-11-18 16:11:45 +01:00
:spacing 12
2024-10-21 09:34:11 +02:00
:space-evenly false
2024-10-21 11:14:08 +02:00
(workspaces)
2024-11-05 14:09:13 +01:00
(tray)
2024-10-21 13:57:40 +02:00
(nf-state)
2024-10-21 16:49:00 +02:00
(packages-updates)
2024-11-05 14:09:13 +01:00
(volume)
(network)
2024-11-19 09:37:19 +01:00
(bluetooth)
2024-10-21 11:14:08 +02:00
)
)
(defwidget workspaces []
(eventbox :onscroll "~/.config/eww/scripts/change-active-workspace.sh {} ${active-workspace}"
(box :spacing 0
(for workspace in workspaces
2024-11-05 14:09:13 +01:00
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
:class "workspace ${workspace.id == active-workspace ? "active" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
(label :text "${workspace.id == active-workspace ? "" :""}")
2024-10-21 11:14:08 +02:00
)
)
)
2024-10-21 09:34:11 +02:00
)
)
2024-11-05 14:09:13 +01:00
(defwidget tray []
(systray :spacing 8
:icon-size 16
:class "systray"
)
)
2024-10-21 13:57:40 +02:00
(defwidget nf-state []
(eventbox :onclick "~/.config/eww/scripts/toggle-nf-state.sh"
2024-10-21 13:57:40 +02:00
(label :text "${nf-enabled ? "󰂚" : "󰂛"} NF"
:class "${nf-enabled ? "" : "disabled"}"
)
)
)
2024-10-21 11:14:08 +02:00
2024-10-21 16:49:00 +02:00
(defwidget packages-updates []
2024-11-18 16:11:45 +01:00
(eventbox :onclick "pkill -SIGUSR1 -u $(id -u) pkg-updates.sh"
2024-11-05 14:09:13 +01:00
(label :text "󰏖 ${packages-updates.count}"
:class "${packages-updates.class}"
:tooltip "${packages-updates.tooltip}"
)
)
)
(defwidget volume []
(box :spacing 10
:space-evenly false
(for target in '["output", "input"]'
(eventbox :onhover "${EWW_CMD} update volume-slide=$(${EWW_CMD} get volume-slide | jq -c '.${target} = true')"
:onhoverlost "${EWW_CMD} update volume-slide=$(${EWW_CMD} get volume-slide | jq -c '.${target} = false')"
(box :space-evenly false
:class "${volume[target].muted == 1 ? "disabled" : ""}"
(eventbox :onclick "~/.config/eww/scripts/toggle-volume-mute.sh ${target}"
(label :text "${volume[target].muted == 1 ? "${volume-icons[target].muted}" : "${volume-icons[target].active[round(volume[target].value / 42, 0)]}"} ${volume[target].value}%")
)
(revealer :transition "slideleft"
:reveal {volume-slide[target]}
(scale :value {volume[target].value}
:min 0
:max 101
:onchange "~/.config/eww/scripts/set-volume.sh ${target} {}"
)
)
)
)
)
2024-10-21 16:49:00 +02:00
)
)
(defwidget network []
(tooltip
(label :text "IPv4: ${network.ip4}\\nIPv6: ${network.ip6}${network.type == "wifi" ? "\\nRate: ${network.rate}\\nSignal strength: ${network.signal}" : ""}")
2024-11-05 14:09:13 +01:00
(label :text "${network.icon} ${network.name} ${network.if == "null" ? "" : "󰜮 ${network.down} 󰜷 ${network.up}"}")
)
)
2024-11-19 09:37:19 +01:00
(defwidget bluetooth []
(eventbox :onclick "~/.config/eww/scripts/toggle-bluetooth-state.sh"
(label :text "${bluetooth.icon} ${bluetooth.device}"
:class "${bluetooth.state}"
)
)
)
2024-10-21 16:49:00 +02:00
2024-10-21 09:58:57 +02:00
(defwidget bar-middle []
2024-11-19 09:37:19 +01:00
(box :halign "center"
:spacing 12
:space-evenly false
(title)
)
)
(defwidget title []
2024-11-04 11:44:00 +01:00
(label :limit-width 42
:show-truncated false
2024-10-21 09:58:57 +02:00
:text "${window-title}"
)
)
2024-10-21 11:14:08 +02:00
2024-10-21 09:34:11 +02:00
(defwidget bar-right []
(box :halign "end"
2024-11-18 16:11:45 +01:00
:spacing 12
2024-10-21 09:34:11 +02:00
:space-evenly false
2024-10-21 13:57:40 +02:00
(brightness)
2024-10-21 09:34:11 +02:00
(battery :percent {EWW_BATTERY.BAT0.capacity}
:status {EWW_BATTERY.BAT0.status}
)
(ram)
(cpu-temp)
2024-11-05 14:09:13 +01:00
(cpu-usage)
(clock)
2024-10-21 09:34:11 +02:00
)
)
2024-10-21 13:57:40 +02:00
(defwidget brightness []
2024-10-21 09:34:11 +02:00
(eventbox :onhover "${EWW_CMD} update brightness-slide=true"
:onhoverlost "${EWW_CMD} update brightness-slide=false"
(box :space-evenly false
2024-11-05 14:09:13 +01:00
(label :text "${brightness-icons[round(brightness / 18.2, 0)]} ${round(brightness / 255 * 100, 0)}%")
2024-10-21 09:34:11 +02:00
(revealer :transition "slideleft"
:reveal {brightness-slide}
(scale :value {brightness}
:min 0
2024-11-05 14:09:13 +01:00
:max 256
:onchange "~/.config/eww/scripts/set-brightness.sh {}"
2024-10-21 09:34:11 +02:00
)
)
)
)
)
(defwidget battery [percent status]
(label :text "${battery-icons[status][round(percent / 10, 0)]} ${percent}%"
:tooltip "${percent}% (${status})"
:class "${percent <= 30 ? percent <= 15 ? 'crit' : 'alert' : ''}"
)
)
(defwidget ram []
(label :text " ${round(EWW_RAM.used_mem / 1073741824, 2)}GiB"
:tooltip " ${round(EWW_RAM.used_mem / 1073741824, 2)}GiB out of ${round(EWW_RAM.total_mem / 1073741824, 2)}GiB used"
)
)
(defwidget threshold [val unit alert-val crit-val icon alert-icon crit-icon]
(label :text "${val < alert-val ? icon : (val < crit-val ? alert-icon : crit-icon)} ${round(val, 0)}${unit}"
:class "${val < alert-val ? '' : (val < crit-val ? 'alert' : 'crit')}"
)
)
(defwidget cpu-temp []
(threshold :val {EWW_TEMPS.K10TEMP_TCTL}
:unit "°C"
:alert-val 65
:crit-val 75
:icon "󱃃"
:alert-icon "󰔏"
:crit-icon "󰸁"
)
)
2024-11-05 14:09:13 +01:00
(defwidget cpu-usage []
(label :text " ${round(EWW_CPU.avg, 0)}%"
:tooltip " ${arraylength(EWW_CPU.cores)} cores available"
)
)
(defwidget clock []
2024-11-19 10:10:46 +01:00
(eventbox :onclick "eww open --toggle calendar"
2024-11-05 14:09:13 +01:00
(label :text "󰥔 ${datetime}")
)
)
2024-11-19 10:10:46 +01:00
(defwindow calendar :monitor 0
:geometry (geometry :x "5px"
:y "5px"
:width "300px"
:height "169px"
:anchor "top right"
)
:stacking "fg"
:exclusive false
(calendar :day {day}
:month {month}
:year {year}
)
)
2024-11-05 14:09:13 +01:00
2024-10-21 09:34:11 +02:00
; Bar
(defwidget bar []
(centerbox
2024-10-21 09:34:11 +02:00
(bar-left)
2024-10-21 09:58:57 +02:00
(bar-middle)
2024-10-21 09:34:11 +02:00
(bar-right)
)
)
(defwindow bar :monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
2024-11-05 14:09:13 +01:00
:height "30px"
2024-10-21 09:34:11 +02:00
:anchor "top center"
)
:stacking "fg"
:exclusive true
(bar)
)