Replies: 5 comments 5 replies
-
I think one of the basic design issues making config fiddly is the single namespace shared by every expression. With every variable shared by all expressions/files/widgets, pretty much every widget is a singleton. I.e. we can't have a clock widget that we add to the config twice with different timezones or different faces (as @01micko has shown recently!). With multiple namespaces, we could in theory have a clock widget that had a variable for a timezone and face that could be overridden from the main config, something like:
Another idea in a similar vein is user defined functions. Currently, any complex calculation is limited to a specific set of variables, i.e. if we have: |
Beta Was this translation helpful? Give feedback.
-
Being able to use variables like
Works fine if I don't use a variable. |
Beta Was this translation helpful? Give feedback.
-
I've made decent progress with a new expression parser that compiles expressions into bytecode and runs them in a simple vm. It should be reasonably easy to expand this to handle user functions, since the vm has a stack. It should also allow for abstracting widget options into local variables, i.e.
We can treat the {} as a block of local variable declarations for both the builtin and user defined widgets. The widget can then have an init function that would use these variables to customize the widget instance. The tricky style question would be the variable dichotomy. Currently, variables in sfwbar hold an expression and their value is dynamically updated with the result of the expression. I.e. they behave more like cells in a spreadsheet than the typical variables. If we introduce user defined functions with local variables, these local variables will need to behave more like traditional variables, i.e. their expressions only get evaluated as the function is executed. This make sense, since these variables by definition are transient and only exist while the function is being executed. Finally, if we do create more complex functions, it's probably worth merging the actions and the expression functions. Currently the two are separate with expression functions used to query the state of the world and actions attempting to influence this state, but user defined functions, may need to do both at the same time, so the distinction becomes somewhat moot. |
Beta Was this translation helpful? Give feedback.
-
@01micko, have a look at 311b6ac. This commit updates the calendar widget to a new config language. |
Beta Was this translation helpful? Give feedback.
-
First, I want to say this is probably one of the most responsive and useful projects that checks quite a few of my personal preferences. It is a deceptively significant amount of functionality and configurability from such a tight code base. With respect to the topic at hand, I believe the following: Early *nix philosophy of just doing one thing, ie: separate out parameters/variables from visuals/presentation aspects and actions/trigger functions. Override by order precedence, ie: the initialization process of the some components like systemd, gnome, xorg; regardless of my personal opinion of their bloat. Define layout of where and how your configs are stored: Lower levels overrides/augments the previous higher levels. You could also implement a non-override facility (like a key-word) in the scenario that a particular setting remains non-volatile, by permission. Obviously, security implications etc, etc... For modularity sake: you can utilize the Arch libalpm/pacman approach: specific file extensions for defining things in paragraph 2, ie: [0-9]-.{conf, ini}, *.trig, *.func, *.css, *.widget, etc, etc. There's a certain amount of simpilicity in file handling logic. In keeping with this approach, you can tie foo.{conf,ini} to foo.trig, foo.func, foo.css, etc., so as to override/localize behavior/settings. This separation can allow the flexibility to just create links to modify some aspect of bar w/o that doing too much work. Again, security, etc, etc. Although if you do some fullscreen sized, crazy million item dashboard that monitors the health of spawned VMs.... |
Beta Was this translation helpful? Give feedback.
-
Sfwbar configuration is beastly. Partly this comes from the feature set growing over time and config evolving to accommodate it, partly it's the price we're paying for flexibility.
I would like to explore ideas of making the config simpler without sacrificing the flexibility.
Ultimately, I think users who just want to use the bar and some default (or 3rd party) widgets, should be able to configure the bar without having to learn too much of the config language (i.e.
include("widget") { option1 = x, option2 = y }
level of complexity), with widget development involving more code.I would love to hear what users see as pain points and what they see as a "nice" config format that can accommodate the features they need.
Beta Was this translation helpful? Give feedback.
All reactions