mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 08:15:21 +01:00
[GH-ISSUE #1388] Consider using a Map for the format parameter in more modules #7439
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#7439
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 @lypwig on GitHub (Feb 18, 2026).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1388
I really like how the bluetooth module can be configured, with a format parameter that takes a map, where a single string is used for both the label and the icons using nerd font.
It's both elegant, easy to understand and powerful, as we can change the icon/label order, display only one of them, change the color or size of the icon/label with Pango markup, etc.
As this syntax seems much better than defining
icon_size,show_icon,show_label, etc like in some other modules, it could be interesting to use it on other modules too in order to improve customization and consistency.In addition, a
rangefilter (see #1381) could be used to define format conditionally where a percent value is used.This one would take a percent value and an array of strings, and returns the string item corresponding to the normalized percent value (see examples).
Backward compatibility can be ensured by detecting the type used (string or map), and eventually a deprecation warning could be printed if the old syntax is used.
More generally, the idea is also to move the UI/UX in the default values of the config file when possible, instead to do it in rust, in order to let users change this UI/UX more easily.
I might be interested to work on this, let me know.
Here is an overview of some suggestions for the format parameter using this syntax in several modules.
Battery
2 states (disconnected / charging), using 2 range filters to change the color and icon according to the battery level. Using inline Nerd font icons also ensures icon size equals the font size.
Brightness
Here I defined the moon phase icons currently in use (15 levels), but one could define a simple 3-level range with no labels using
brightness: {percentage|range(,,)}, or a static format without icon usingbrightness: {percentage}%.Bluetooth
The bluetooth format parameter is already a Map, but I just wanted to suggest how it could be improved using range filters to change the battery icon with the nerd font.
Without filters, an array-based syntax could be used instead, but it's way more verbose:
Clipboard
The
nonestate has been added in order to show a specific icon/color when the clipboard is empty.Inhibit
Nothing unusual here except I used nerd font icons instead Unicode chars in order to allow changing the icon color.
Network manager
One state per device type, and range filter for wifi_on.
The icon could be used as default for other device types.
Some other nerd font icons like or might be accurate for some device types but I don't have enough knowledge in this field to pick good ones.
Using inline Nerd font icons also ensures that the size of the icon follows the font size.
Notifications
Same states as the "icons" parameter. Using Pango markup on the amount value allows more user customization (for instance one could prefer to have the amount in a regular size).
Sys info
Range filters are used to set colors, you got the idea.
I suggest here to put the items array in a
itemsattribute, and then define format and eventual other properties on each item, such asintervalorpopup(which can be used to show more detailed information).It allows more flexibility such as defining mouse events on the item-level.
Volume
Same thing here, an array is used on in an
itemsattribute, which allows users to switch the order of hp/mic, or display only one of them, and mouse events or other things can be defined on the item level.By the way, the nerd font icons currently used for the volume seems to be deprecated.
@lypwig commented on GitHub (Feb 19, 2026):
I think all this stuff represents a considerable amount of work and might be out of scope of this project, sorry for the inconvenience. Feel free to reopen if necessary.
@JakeStanger commented on GitHub (Feb 19, 2026):
The recently introduced profiles system aims to accomplish what you've described here, and is currently supported by the battery, network-manager and volume modules.
There are plans to expand that to other modules, and increase the number of options supported by it. That will eventually include a refactor of the BT module to migrate to it.
You didn't need to close all the issues; I've not had a chance to review them yet and some of them look like good ideas. The amount of effort you perceive something to be is also unimportant. I can judge that, and often things are worth the effort.
You also exploded my inbox, btw...
@lypwig commented on GitHub (Feb 19, 2026):
Oh my god I'm so sorry for that I didn't know you would receive a notification on each edit!
Thank you for your answer.