Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of operations #16

Open
FelixKratz opened this issue Mar 9, 2024 · 1 comment
Open

Order of operations #16

FelixKratz opened this issue Mar 9, 2024 · 1 comment
Labels
limitation A fundamental limitation
Milestone

Comments

@FelixKratz
Copy link
Owner

FelixKratz commented Mar 9, 2024

A fundamental problem in lua is that the key value tables are not sorted. This means the order in which the table arguments are parsed is essentially random.

The sketchybar api has some order-of-operation dependent properties, e.g:

sketchybar --set <name> background.color=0xffff0000 background.drawing=off`

Sets the background color — which enables the background automatically — and then disables the background again.
The same is not possible in lua (in a single set call) because:

<name>:set({ background = { color = 0xffff0000, drawing = false } })

Is not reliably parsed in this order. If this is parsed the other way around, the background is disabled and only then the color is set — which then enables the background automatically.

A fix for this will likely need to be on the sketchybar syntax side. I.e. all the sketchybar config options must be entirely independent of each other such that order of operations is never a problem.

@FelixKratz FelixKratz added this to the v1.0 milestone Mar 9, 2024
@FelixKratz FelixKratz added the limitation A fundamental limitation label Mar 9, 2024
@Marc-AnthonyG
Copy link

I had this problem while doing configuration for hovering element. What would be the best way around this issues as of right now. Declaring the colors and the drawing in two different set command? This might impact performance for event that are trigger a lot.

Could we hard code a fix in SbarLua for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
limitation A fundamental limitation
Projects
None yet
Development

No branches or pull requests

2 participants