nixos-config/ahrc-laptop/eww/eww.yuck

179 lines
3.4 KiB
Text
Raw Normal View History

2024-11-05 09:41:16 +01:00
(deflisten workspaces-status
2024-11-04 15:49:10 +01:00
:initial "[]"
"./listen/niri/workspaces"
)
2024-11-05 09:41:16 +01:00
(deflisten window-title "./listen/niri/window-title")
(deflisten notifications-status
:initial '{"dnd": false, "count": 0}'
"swaync-client --subscribe"
)
(defvar workspaces-icon '{
2024-11-04 15:49:10 +01:00
"admin": "",
"everything": "",
"apps": ""
}')
2024-11-05 09:41:16 +01:00
(defvar notifications-icon '{
"nothing": "",
"new": "",
"dnd": ""
}')
(defvar battery-icon '{
2024-11-05 10:32:11 +01:00
"Discharging": [
"󰁹",
"󰂂",
"󰂁",
"󰂀",
"󰁿",
"󰁾",
"󰁽",
"󰁼",
"󰁻",
"󰁺",
"󰂎"
],
"Charging": [
"󰂅",
"󰂋",
"󰂊",
"󰢞",
"󰂉",
"󰢝",
"󰂈",
"󰂇",
"󰂆",
"󰢜",
"󰢟"
],
"Full": [
"󱟢"
]
2024-11-05 09:41:16 +01:00
}')
2024-11-04 15:49:10 +01:00
(defwidget workspaces []
(box
:class "workspaces"
2024-11-05 09:41:16 +01:00
(for workspace in {workspaces-status}
2024-11-04 15:49:10 +01:00
(eventbox
:onclick "niri msg action focus-workspace ${workspace.idx}"
:width 25
2024-11-05 09:41:16 +01:00
:class "${workspace.is_active ? " workspace-active" : ""}"
2024-11-04 15:49:10 +01:00
2024-11-05 09:41:16 +01:00
"${"${workspaces-icon?.[workspace.name]}" ?: ""} "
2024-11-04 15:49:10 +01:00
)
)
)
)
2024-11-05 09:41:16 +01:00
(defwidget window-title []
(box (label
:limit-width 80
:text "${window-title ?: ""}"
))
)
(defwidget notifications []
(box (eventbox
:onclick "swaync-client --toggle-panel"
:onmiddleclick "swaync-client --close-all"
:onrightclick "swaync-client --toggle-dnd"
:width 25
(label
:class "icons"
:text "${notifications-status.dnd
? "${notifications-icon.dnd}"
: notifications-status.count > 0
? "${notifications-icon.new}"
: "${notifications-icon.nothing}"} ${notifications-status.count}"
)
))
)
2024-11-04 15:49:10 +01:00
(defwidget time []
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
)
2024-11-05 09:41:16 +01:00
(defwidget tray []
(box (systray
:icon-size 15
:spacing 10
))
)
(defwidget battery []
(label
:text "${EWW_BATTERY.BAT0.capacity == 100
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][0]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 90
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][1]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 80
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][2]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 70
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][3]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 60
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][4]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 50
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][5]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 40
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][6]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 30
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][7]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 20
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][8]}"
2024-11-05 09:41:16 +01:00
: EWW_BATTERY.BAT0.capacity >= 10
2024-11-05 10:32:11 +01:00
? "${battery-icon[EWW_BATTERY.BAT0.status][9]}"
: "${battery-icon[EWW_BATTERY.BAT0.status][10]}"} ${EWW_BATTERY.BAT0.capacity}%"
2024-11-05 09:41:16 +01:00
)
)
2024-11-04 15:49:10 +01:00
(defwindow dock
2024-10-23 20:14:52 +02:00
:monitor 0
:geometry (geometry
2024-11-04 15:49:10 +01:00
:x "0"
:y "0"
:width "100%"
2024-10-23 20:14:52 +02:00
:height "30px"
2024-11-04 15:49:10 +01:00
:anchor "bottom center"
2024-10-23 20:14:52 +02:00
)
:stacking "fg"
2024-11-04 15:49:10 +01:00
:exclusive true
(centerbox
2024-11-05 09:41:16 +01:00
:class "main"
2024-11-04 15:49:10 +01:00
(box
:class "left"
:halign "start"
:space-evenly false
(workspaces)
2024-11-05 09:41:16 +01:00
(window-title)
2024-11-04 15:49:10 +01:00
)
(box
:class "middle"
2024-11-05 09:41:16 +01:00
:space-evenly false
2024-11-04 15:49:10 +01:00
2024-11-05 09:41:16 +01:00
(tray)
2024-11-04 15:49:10 +01:00
(time)
2024-11-05 09:41:16 +01:00
(notifications)
2024-11-04 15:49:10 +01:00
)
(box
:class "right"
2024-11-05 09:41:16 +01:00
:halign "end"
:space-evenly false
(battery)
2024-11-04 15:49:10 +01:00
)
)
2024-10-23 20:14:52 +02:00
)