mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 08:15:21 +01:00
[GH-ISSUE #71] Eww style Basic Var #2853
Labels
No labels
A:Build
A:CI
A:Client
A:Config
A:Core
A:Documentation
A:Documentation
A:IPC
A:Testing
A:UX/UI
blocked
BREAKING CHANGE
duplicate
good first issue
GTK4
help wanted
invalid
M:Battery
M:Battery
M:Bindmode
M:Bluetooth
M:Brightness
M:Cairo
M:Clipboard
M:Clock
M:Clock
M:Custom
M:Focused
M:Keyboard
M:Launcher
M:Menu
M:Music
M:Music
M:Music
M:Network Manager
M:Notifications
M:SysInfo
M:Tray
M:Volume
M:Workspaces
partially resolved
P:Critical
P:High
P:Low
P:Medium
pull-request
T:Bug
T:Bug
T:Core Enhancement
T:Module Enhancement
T:New Module
T:Question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
JakeStanger/ironbar#2853
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JustSimplyKyle on GitHub (Feb 10, 2023).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/71
Is your feature request related to a problem? Please describe.
Not exactly a problem, but just an annoyance
Describe the solution you'd like
this would reduce the required scripting to make it work. Without this, I would have to use external scripts to save the state into a lock, which works, but get tedious real quickly. Although this feature is probably out of scope to this issue anyway
Add support for variables, like eww's defvar
Describe alternatives you've considered
using script and lock.
Additional context
https://github.com/JakeStanger/ironbar/issues/70 originates in this issue
@JakeStanger commented on GitHub (Feb 11, 2023):
So my understanding of how it works in Eww:
I think in principal basic support would be simple, but there's a lot to consider to get it right:
@JustSimplyKyle commented on GitHub (Feb 11, 2023):
A simple unix socket should be fine.
I think the same binary should be fine. Compiling time could be a concern, in that case you could just make this an optional feature.
Helper scripts work just fine. The most common use case is just for boolean values so the show-if trick I showed in discussion should work. But I just think it's an hassle to set up in general, and the best one can minilize is just merging it into one binary and give it a flag.
Thanks for you work! Ricing ironbar has been a much nicer experience then what eww and waybar gave me.
(Side note: is there a time where there is a lowest limit on interval, it seems like since then, it has been removed)
@JakeStanger commented on GitHub (Feb 11, 2023):
Yep, if it does go in the main binary I definitely will have it under a (enabled by default) feature flag.
This is why I'm a little reluctant to jump straight into implementing this. There may be an easier/cheaper win for this specific scenario. I'll have a think about it!
I meant anything else worth considering for this issue btw, but thanks for the kind words :P Trying to make it as easy to configure is possible is one of my main goals, so I'm glad that's holding up so far.
@JakeStanger commented on GitHub (Feb 11, 2023):
Another thought - another possible use-case for the socket/CLI would be keybindings to open popups.
@JakeStanger commented on GitHub (Jun 22, 2023):
Tracking this in #199 along with the related CLI/IPC (#91).
The current implementation works as follows:
set <key> <value>command and aget <key>command.${variable}}in dynamic strings (ie anywhere that a script could go to result in text).Example:
would display "hello, world" on the bar. Running set again will live update the greeting.
There is no need to declare variables anywhere, simply referencing one is enough to create it. It will render as blank until set.
Variables are set globally for the running instance of Ironbar, so will apply to all bars. They persist for the application lifetime.
@JustSimplyKyle commented on GitHub (Jun 23, 2023):
How about
@variable? or#variable?Cause iI think it's easy to miss the last bracket in
${var}}@JakeStanger commented on GitHub (Jun 23, 2023):
#variablemight be a good shout. It needs to be something that doesn't conflict with bash syntax ideally, and I think that should do the job nicely@JakeStanger commented on GitHub (Jun 23, 2023):
Although thinking about it...staight up
#variablecould cause problems because people will almost certainly want to includea #in their labels at some point, and then you gotta worry about escaping it, whereas I'd rather minimise the need for that.The current implementation also allows for spaces in variable names, although that might have to change.
I'd also like the script and variable syntax to be similar enough to be vaguely intuitive and keep parsing simple.
I can see the following possible routes forward:
((varaible))or[[variable]]or some other "double wrapping" of the variable name to show clearly where it starts/ends.{variable}might work here (bash experts please correct me!), or#variable#.#variable), remove support for spaces in variable names, and add some kind of escape character.{{double_braces}}for both scripts and variables, but add a prefix to the front of each. For example, you might have a${{script}}and a#{{variable}}.I think the 2nd option is my favourite personally. Interested to know what you think, or if there's a preference on characters to use?
@JustSimplyKyle commented on GitHub (Jun 24, 2023):
I'm fine with either the 2nd or the 3rd
3rd is imho more nice to my eyes, but it also do that at the cost of spaces
We could follow Hyprland's way, by doing "##it_twice" to escape it
Anyway, I would love to see other people's opinion on this
Since it's not easily possible to change syntax after the release
@JustSimplyKyle commented on GitHub (Jun 24, 2023):
Another possible route(admittedly horrible) is...
Completely omitting the syntax of variable syntax!
Since we already have the command
ironbar get <stuff>, there is no need for the extra syntax@yavko commented on GitHub (Jun 24, 2023):
That would require polling tho, and would have a delay, I think the benefit of this feature would be the ability to get rid of polling. Making a separate command that instead watched is also possible, but that wouldn't be as performant or reactive would it?
@JustSimplyKyle commented on GitHub (Jun 24, 2023):
Yeah, I personally would go against that either
Just listing possible ideas
Maybe a do poll(vote) somewhere?
@yavko commented on GitHub (Jun 24, 2023):
I have another idea, we could take a page out of windows' CMD
%variable_name%, since afaik%isn't used anywhere in bash.@JustSimplyKyle commented on GitHub (Jun 24, 2023):
https://stackoverflow.com/questions/125281/how-do-i-remove-the-file-suffix-and-path-portion-from-a-path-string-in-bash
It's also used in bash!
@JustSimplyKyle commented on GitHub (Jun 24, 2023):
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Brace-Expansion
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
hmm, might be a problem
since the shell parameter expansion used up every single symbol easily accessiblee
@JakeStanger commented on GitHub (Jun 24, 2023):
I think this might be okay, since I'd imagine variable usage is gonna outweigh the usage of a literal hash.
As yavko says, this effectively nullifies the whole feature. With this, Ironbar would just be providing a key/value store to absolutely no benefit.
This would also work.
%is used but I don't think there's a case where you'd have something%wrapped%. Personally though I'm not a fan. I've always hated that Windows uses percent signs for vars.Obviously I'd rather not if I don't have to, but if we do find it's problematic I am willing to make the change. Ironbar is alpha still, and a large part of the reasoning behind that is to give room to make big breaking changes where required.
Taking in all of the above, here's what I'm thinking:
#variable, since that's simple.##can be used as an escape for a single literal hash.##will cover it or it will be possible to implement a fix for.Thoughts?
Are we also happy with the current
{{script syntax}}?@yavko commented on GitHub (Jun 24, 2023):
I agree
#variableis the simplest, and doesn't have any conflicts