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

[Feature request] Custom format replacements in custom modules #432

Open
rgouicem opened this issue Aug 23, 2019 · 5 comments · May be fixed by #2441
Open

[Feature request] Custom format replacements in custom modules #432

rgouicem opened this issue Aug 23, 2019 · 5 comments · May be fixed by #2441
Labels
enhancement New feature or request

Comments

@rgouicem
Copy link

I'm currently writing a custom module to monitor free space on my SSD. However, custom modules that return a JSON can only return a text field containing already formatted text. I would like to return different values (free space, used space, total space, usage) and let the format be specified in my waybar config file.

Here is an example of what I would like to return with my module:

{"mount": "/home",
 "total": "871", 
 "used": "86",
 "free": "740",
 "usage": "9.8", 
 "tooltip": "", 
 "class": "ok"}

And I would like to define the format this way in my config file:
"format": "{mount}: {used}G/{total}G"

That would make custom modules better by dissociating data and format.

@rgouicem rgouicem changed the title Custom format replacements in custom modules [Feature request] Custom format replacements in custom modules Aug 23, 2019
@Alexays
Copy link
Owner

Alexays commented Aug 29, 2019

It'll be possible once #404 get finished :)

@Alexays Alexays added the enhancement New feature or request label Aug 29, 2019
@rgouicem
Copy link
Author

rgouicem commented Sep 4, 2019

OK. I will be waiting for this update then 😄

@rileyrg
Copy link

rileyrg commented May 28, 2021

Did this happen? I just spent a day trying to output my own json fields but alas... Now I feel a bit silly as it doesnt seem to be supported ;) LOL #1118 https://github.com/rileyrg/linux-init/blob/master/directories/bin/sway/waybar-ip-info-json

@WhyNotHugo
Copy link
Contributor

I don't think extending format like in the example is that important, since you can just format in your external helper.

It would be nice to be able to pass more fields from custom modules though.

@rileyrg
Copy link

rileyrg commented May 29, 2021

Formatting in the external helper is exactly what I wanted to avoid and indeed previous comments in the thread agreed . Certainly it seemed (lol!) obvious to me that adding in {fields} would just work if I returned them in json object. That said, yes, I can separate the json object collection and the formatting into different scripts. Anyway, I just format in the help now as you say. cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants