dotfiles/.config/waybar/config.jsonc.cgt

91 lines
3.5 KiB
Fennel

;<! tmpl:setPostProcessor(opt.fennelToJSON) !>
;; vim: ft=fennel
<!
local cpu_temp_hwmon = nil
for d in require("lfs").dir("/sys/class/hwmon") do
if d ~= "." and d ~= ".." then
local namef = io.open("/sys/class/hwmon/" .. d .. "/name", "r")
if namef:read("*a"):gsub("%s+", "") == "coretemp" then
cpu_temp_hwmon = "/sys/class/hwmon/" .. d .. "/temp1_input"
end
namef:close()
end
end
!>
(local format-icons ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"])
{:spacing 4
:layer :top
;<! if opt.wayland_compositor == "river" then !>
:modules-left [:river/tags :river/window]
;<! elseif opt.wayland_compositor == "hyprland" then !>
:modules-left [:hyprland/workspaces :hyprland/window]
;<! end !>
:modules-right [:mpris
:cava
:cpu
:memory
:network
:pulseaudio
:gamemode
:temperature
:battery
:clock
:tray]
:cava {:hide_on_silence true
:bars 16
:bar_delimiter 0
:method :pipewire
: format-icons}
:mpris {:format "{status_icon} {dynamic}"
:interval 5
:dynamic-order [:title :artist :position :length]
:dynamic-importance-order [:position :length :artist :album]
:status-icons {:playing "󰏤" :paused "󰐊" :stopped "󰓛"}
:dynamic-len 24
:dynamic-separators " 󱓜 "}
:gamemode {:format "{glyph} {count}"}
:tray {:spacing 10}
:clock {:tooltip-format "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
:format-alt "{:%Y-%m-%d}"}
:cpu {:format (.. (faccumulate [s "" i 0 (- (cg.opt.system :nproc) 1)]
(.. s "{icon" i "}")) " {usage}% ")
:interval 2
: format-icons}
:memory {:format "{}% "}
:temperature {:hwmon-path "<% cpu_temp_hwmon %>"
:critical-threshold 80
:format "{temperatureC}°C {icon}"
:format-icons ["" "" ""]}
:battery {:states {:warning 50 :critical 20}
:format "{capacity}% {icon}"
:format-charging "{capacity}% 󰂄"
:format-plugged "{capacity}% "
:format-alt "{time} {icon}"
:format-icons ["" "" "" "" ""]}
:pulseaudio (let [fstring (fn [muted bluetooth]
(.. (if muted "󰝟" "{volume}%")
(if (and muted (not bluetooth)) "" " {icon}")
(if bluetooth "" "") " {format_source}"))]
{:format (fstring false false)
:format-muted (fstring true false)
:format-bluetooth (fstring false true)
:format-bluetooth-muted (fstring true true)
:format-source "{volume}% "
:format-source-muted ""
:format-icons {:headphone ""
:hands-free "󰋏"
:headset "󰋎"
:phone ""
:portable ""
:car ""
:default ["" "" ""]}
:on-click :pavucontrol})
:network {:interval 10
:format "{bandwidthDownBytes}  {bandwidthUpBytes} "
:tooltip-format-ethernet "{ifname} {ipaddr}"
:tooltip-format-wifi "{essid} {ipaddr}"
:on-click "<% opt.term.command %> nmtui"
:on-click-right "<% opt.term.command %> doas nmtui"}}