mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 08:15:21 +01:00
[GH-ISSUE #34] Support for modules embedding in Custom #5649
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#5649
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 (Nov 6, 2022).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/34
From what I've observed, you can only put
Widgetin the Custom modules, I wish you can put modules (e.g.script) in the custom modules.I want this cause I want to do retractable modules
@JakeStanger commented on GitHub (Nov 6, 2022):
Hm, this could be quite complex to do. I could certainly replicate the
scriptmodule behaviour inside without much difficulty, but I'm not sure about nesting the actual modules.Are there module types other than
scriptyou want to be able to do this with?I guess at a higher level, the question is more "what exactly are you trying to achieve?" as it might be there's a better way of going about it.
@JustSimplyKyle commented on GitHub (Nov 6, 2022):
Currently, I only need
script.https://user-images.githubusercontent.com/68589851/200174343-d0a23907-3adc-4204-a642-c4f3dc5dd7f4.mp4
This is what I hope to achieve, "retractable" modules(this is in waybar)

Its config is like this
custom/ssandcustom/expand_soundetc. are all scripts that will check the state of whether it's expanded or not, if it's expanded display something, if not, display nothing.This is rather cumbersome to script.
Although now that I think of it, embedding it wouldn't make it easier
@JakeStanger commented on GitHub (Nov 6, 2022):
It looks like your video failed to upload properly, but I think I get the gist.
There's a couple of ideas I've got that might help with this:
custom, add the ability to run polling/watching scripts using the existing syntax. I'm undecided on the syntax, but it'd either use the existing bang!or colon format and be something likelabel = "poll:5000:/path/to/script". This would allow the module to display dynamic content, which would be super powerful.show-ifthat evaluates some shell command/script and only shows the module if it receives exit code 0. If not set, the module would always show. This should lift some of the logic out of your scripts and into the bar.Let me know what you think or if you have any other suggestions
@JustSimplyKyle commented on GitHub (Nov 7, 2022):
Yeah, the
show-ifwould be very helpful!I think I'll personally would prefer the colon syntax
@JakeStanger commented on GitHub (Nov 20, 2022):
Okay I've got an implementation I think I'm happy with up and running, so I'll just need to tidy up and should have something pushed into master in the next few days.
Across the board, there is now a universal 'script' syntax. The places this can be utilised will definitely expand with time, and I still need to standardise the actual
scriptmodule to be parallel. This comes in two flavours:You can create an object with the
cmdkey and optionally theintervalandmodekeys.You can pass a string containing the command. This can optionally start with the interval and/or mode separated by colons. In cases where scripts are embedded into strings, you must use this syntax and not the object syntax.
I've got two new features that will make use of this syntax:
The first is the previously mentioned
show-ifcommand. This takes the exit status of a polling script and shows/hides the module accordingly. Because it relies on the exit status, watch mode is not supported here and the script will always be created as polling regardless of input.The second is inside the custom module, where you can now embed scripts inside label values however you like. This allows you to include arbitrary snippets of text or multiple scripts easily. Anything inside
{{double braces}is executed. Both polling and watch mode are supported here.Let me know what you think! Now's a good time to add/remove/change anything before I tidy up the code & push it up.
@JustSimplyKyle commented on GitHub (Nov 21, 2022):
Seems pretty good.
I have one question tho
show-if = "500:my_script"does this mean: "Show the label if the exit code ofmy_scriptis 0?@JakeStanger commented on GitHub (Nov 21, 2022):
Yep, exactly that :) I think that's the most unix-y approach to it, and means you can use things like
[@JakeStanger commented on GitHub (Nov 28, 2022):
Couple of updates just pushed up should mean you can do what you want to do without too much difficulty now. Let me know if this doesn't resolve it for you & I'll re-open.
@JustSimplyKyle commented on GitHub (Nov 29, 2022):
Pretty good! Successfully remade the expand action with minimal amount of scripting.

Although one thing, is it possible to combine these three "modules"(it is just three different scripts) into one?
@JakeStanger commented on GitHub (Nov 29, 2022):
Not currently. I've considered adding a "spread" operator into Corn that would allow you to merge objects/arrays that would allow for this, but nothing concrete as of yet.