Open lukelex opened 2 years ago
I agree, the config can get pretty unwieldy. I like these ideas, thanks!
The config format we're using doesn't automagically support either of these, but:
templates = {
(
name: "normal_text",
block: TextBlock((
...
))
),
}
layout_blocks: [ ... ( name: "summary", parent: "image", hook: Hook(parent_anchor: MR, self_anchor: BL), offset: Vec2(x: 0.0, y: 0.0), params: "normal_text", ), ]
Which isn't ideal, and doesn't solve the real problem where you want templates but want to be able to override some of the fields.
Being able to override fields would probably require some craziness to support ergonomically.
---
A cheap way to support "importing" may be for Wired to just additively pull in configs in the same directory with some prefix -- e.g. you'd have your "main" config `wired.ron` with the base settings and then `wired_*.ron` (like, `wired_system.ron` or `wired_app.ron`) would be your other layouts. The only downside I see here is that maybe it's a bit confusing if someone has like `wired_bak.ron` and it's being loaded because of this system.
We could probably add some kind of rudimentary "import" without that much trouble.
This would already go a long way tbh.
A cheap way to support "importing" may be for Wired to just additively pull in configs in the same directory with some prefix -- e.g. you'd have your "main" config wired.ron with the base settings and then wired_*.ron (like, wired_system.ron or wired_app.ron) would be your other layouts. The only downside I see here is that maybe it's a bit confusing if someone has like wired_bak.ron and it's being loaded because of this system.
What if wired only tried to load these files if they are specified somewhere in wired.ron
?
What if wired only tried to load these files if they are specified somewhere in
wired.ron
?
That's an option, will have to thinkt further about details of implementing that.
I recently came across https://github.com/wez/wezterm, which does configuration in a lua file. Basically, you can run any lua code you like, then export the config in a return
block, e.g.:
local wezterm = require 'wezterm'
local prog
local font
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
prog = { 'pwsh.exe' }
font = 'JetBrains Mono'
end
if wezterm.target_triple == 'x86_64-unknown-linux-gnu' then
prog = { 'zsh' }
font = 'JetBrains Mono'
end
return {
enable_tab_bar = false,
default_prog = prog,
window_background_opacity = 1,
tab_bar_at_bottom = true,
font = wezterm.font_with_fallback {
font,
},
font_size = 11.0,
color_scheme = "Nord (base16)",
keys = {
{
key = 'RightArrow', mods = 'CTRL',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = 'DownArrow', mods = 'CTRL',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
}
},
}
I think this is pretty much the direction to go in. We may even be able to move the notification criteria stuff into that as well.
Hopefully you follow with it! Lua is a really good choice to make configurations!
I'm in the process of adding a third notification type, and in doing so, I've found myself duplicating a lot more code than ideal, and the file configuration is 300+ lines long. So it's getting a bit unwieldy.
Have you considered either one or both of the following?
params
can be reused.