mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-06-13 08:49:53 +02:00
fennelize waybar config
This commit is contained in:
parent
b435029e49
commit
a13b04e101
|
@ -1,134 +1,58 @@
|
||||||
// vim: ft=jsonc
|
;<! tmpl:setPostProcessor(opt.fennelToJSON) !>
|
||||||
{
|
;; vim: ft=fennel
|
||||||
// "layer": "top", // Waybar at top layer
|
{:spacing 4
|
||||||
// "position": "bottom", // Waybar position (top|bottom|left|right)
|
:layer :top
|
||||||
"height": 16, // Waybar height (to be removed for auto height)
|
;<! if opt.wayland_compositor == "river" then !>
|
||||||
// "width": 1280, // Waybar width
|
:modules-left [:river/tags :river/window]
|
||||||
"spacing": 4, // Gaps between modules (4px)
|
;<! elseif opt.wayland_compositor == "hyprland" then !>
|
||||||
"layer": "top",
|
:modules-left [:hyprland/workspaces :hyprland/window]
|
||||||
//<! if opt.wayland_compositor == "river" then !>
|
;<! end !>
|
||||||
"modules-left": [
|
:modules-right [:mpris
|
||||||
"river/tags"
|
:cpu
|
||||||
],
|
:memory
|
||||||
"modules-center": [
|
:pulseaudio
|
||||||
"river/window"
|
:gamemode
|
||||||
],
|
:temperature
|
||||||
//<! elseif opt.wayland_compositor == "hyprland" then !>
|
:battery
|
||||||
"modules-left": [
|
:clock
|
||||||
"hyprland/workspaces",
|
:tray]
|
||||||
"hyprland/window"
|
:mpris {:format "{status_icon} {dynamic}"
|
||||||
],
|
:dynamic-order [:title :artist :position :length]
|
||||||
//<! end !>
|
:dynamic-importance-order [:title :position :length :artist :album]
|
||||||
"modules-right": [
|
:status-icons {:playing "" :paused "" :stopped ""}
|
||||||
"mpris",
|
:dynamic-len 50
|
||||||
"cpu",
|
:dynamic-separators " "}
|
||||||
"memory",
|
:gamemode {:format "{glyph} {count}"}
|
||||||
"pulseaudio",
|
:tray {:spacing 10}
|
||||||
"gamemode",
|
:clock {:tooltip-format "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||||
"temperature",
|
:format-alt "{:%Y-%m-%d}"}
|
||||||
"battery",
|
:cpu {:format "{usage}% "}
|
||||||
"battery#bat2",
|
:memory {:format "{}% "}
|
||||||
"clock",
|
:temperature {:hwmon-path "<% opt.cpu_temp_hwmon %>"
|
||||||
"tray"
|
:critical-threshold 80
|
||||||
],
|
:format "{temperatureC}°C {icon}"
|
||||||
"mpris": {
|
:format-icons ["" "" ""]}
|
||||||
"format": "{status_icon} {dynamic}",
|
:battery {:states {:warning 50 :critical 20}
|
||||||
"dynamic-order": [
|
:format "{capacity}% {icon}"
|
||||||
"title",
|
:format-charging "{capacity}% "
|
||||||
"artist",
|
:format-plugged "{capacity}% "
|
||||||
"position",
|
:format-alt "{time} {icon}"
|
||||||
"length"
|
:format-icons ["" "" "" "" ""]}
|
||||||
],
|
:pulseaudio (let [fstring (fn [muted bluetooth]
|
||||||
"dynamic-importance-order": [
|
(.. (if muted "" "{volume}%")
|
||||||
"title",
|
(if (and muted (not bluetooth)) "" " {icon}")
|
||||||
"position",
|
(if bluetooth "" "") " {format_source}"))]
|
||||||
"length",
|
{:format (fstring false false)
|
||||||
"artist",
|
:format-muted (fstring true false)
|
||||||
"album"
|
:format-bluetooth (fstring false true)
|
||||||
],
|
:format-bluetooth-muted (fstring true true)
|
||||||
"status-icons": {
|
:format-source "{volume}% "
|
||||||
"playing": "",
|
:format-source-muted ""
|
||||||
"paused": "",
|
:format-icons {:headphone ""
|
||||||
"stopped": ""
|
:hands-free ""
|
||||||
},
|
:headset ""
|
||||||
"dynamic-len": 50,
|
:phone ""
|
||||||
"dynamic-separator": " "
|
:portable ""
|
||||||
},
|
:car ""
|
||||||
"gamemode": {
|
:default ["" "" ""]}
|
||||||
"format": "{glyph} {count}"
|
:on-click :pavucontrol})}
|
||||||
},
|
|
||||||
"tray": {
|
|
||||||
// "icon-size": 21,
|
|
||||||
"spacing": 10
|
|
||||||
},
|
|
||||||
"clock": {
|
|
||||||
// "timezone": "America/New_York",
|
|
||||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
|
||||||
"format-alt": "{:%Y-%m-%d}"
|
|
||||||
},
|
|
||||||
"cpu": {
|
|
||||||
"format": "{usage}% ",
|
|
||||||
"tooltip": false
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"format": "{}% "
|
|
||||||
},
|
|
||||||
"temperature": {
|
|
||||||
// "thermal-zone": 2,
|
|
||||||
"hwmon-path": "<% opt.cpu_temp_hwmon %>",
|
|
||||||
"critical-threshold": 80,
|
|
||||||
// "format-critical": "{temperatureC}°C {icon}",
|
|
||||||
"format": "{temperatureC}°C {icon}",
|
|
||||||
"format-icons": [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"battery": {
|
|
||||||
"states": {
|
|
||||||
// "good": 95,
|
|
||||||
"warning": 30,
|
|
||||||
"critical": 15
|
|
||||||
},
|
|
||||||
"format": "{capacity}% {icon}",
|
|
||||||
"format-charging": "{capacity}% ",
|
|
||||||
"format-plugged": "{capacity}% ",
|
|
||||||
"format-alt": "{time} {icon}",
|
|
||||||
// "format-good": "", // An empty format will hide the module
|
|
||||||
// "format-full": "",
|
|
||||||
"format-icons": [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"battery#bat2": {
|
|
||||||
"bat": "BAT2"
|
|
||||||
},
|
|
||||||
"pulseaudio": {
|
|
||||||
// "scroll-step": 1, // %, can be a float
|
|
||||||
"format": "{volume}% {icon} {format_source}",
|
|
||||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
|
||||||
"format-bluetooth-muted": " {icon} {format_source}",
|
|
||||||
"format-muted": " {format_source}",
|
|
||||||
"format-source": "{volume}% ",
|
|
||||||
"format-source-muted": "",
|
|
||||||
"format-icons": {
|
|
||||||
"headphone": "",
|
|
||||||
"hands-free": "",
|
|
||||||
"headset": "",
|
|
||||||
"phone": "",
|
|
||||||
"portable": "",
|
|
||||||
"car": "",
|
|
||||||
"default": [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"on-click": "pavucontrol"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
18
confgen.lua
18
confgen.lua
|
@ -21,6 +21,8 @@ cg.onDone(function(errors)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local fennel = loadfile("/usr/share/lua/5.4/fennel.lua")()
|
||||||
|
|
||||||
-- Recursively merge 2 tables
|
-- Recursively merge 2 tables
|
||||||
local function merge(a, b)
|
local function merge(a, b)
|
||||||
if b[1] then -- b is a list
|
if b[1] then -- b is a list
|
||||||
|
@ -83,19 +85,11 @@ cg.opt.luaCompile = function(lua)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Compile the input as fennel. Meant to be used as a post-processor.
|
-- Compile the input as fennel. Meant to be used as a post-processor.
|
||||||
cg.opt.fennelCompile = function(fnl)
|
cg.opt.fennelCompile = fennel.compileString
|
||||||
local handle = io.popen("fennel -c - > /tmp/cgfnl", "w")
|
|
||||||
if handle == nil then
|
|
||||||
error "Failed to spawn fennel"
|
|
||||||
end
|
|
||||||
|
|
||||||
handle:write(fnl)
|
-- Evaluate fennel code and JSONify the result. Meant to be used as a post-processor.
|
||||||
handle:close()
|
cg.opt.fennelToJSON = function(str)
|
||||||
|
return cg.toJSON(fennel.eval(str))
|
||||||
local f = io.open "/tmp/cgfnl"
|
|
||||||
local res = f:read "*a"
|
|
||||||
f:close()
|
|
||||||
return res
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if the given file exists
|
-- Check if the given file exists
|
||||||
|
|
Loading…
Reference in a new issue