mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 10:15:20 +01:00
[GH-ISSUE #1049] truncate.length doesn't seem to work #331
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#331
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 @postsolar on GitHub (Jun 14, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1049
Describe the bug
From the wiki on
truncate.length:But it doesn't appear to work this way. Maybe there's something else involved? My widgets' labels just don't get truncated with this setting.
truncate.max_lengthworks buttruncate.lengthdoes not, regardless of label's pre-truncate length. I tried different modules,focused,music.To reproduce
Steps to reproduce the behavior:
Expected behavior
Truncate works and widget has fixed width as specified in the config
System information:
4fad5a4d18Configuration
Config
Styles
Additional context
Screenshots
With
truncate.length = 5andtruncate.mode = "start":@JakeStanger commented on GitHub (Jun 16, 2025):
I suspect this is more of an issue of the docs not being very clear than anything else.
The
truncate.lengthproperty works more akin to a minimum, so its much less useful than themax_lengthproperty. Under the hood it callsset_width_chars. From the GTK docs:https://docs.gtk.org/gtk3/method.Entry.set_width_chars.html
Note that the two aren't mutually exclusive:
github.com/JakeStanger/ironbar@ff9f4477bb/src/gtk_helpers.rs (L107-L117)@postsolar commented on GitHub (Jun 17, 2025):
Thank you for clarifying. I also just noticed that for
clipboardI'd have to also setlengthto some number, otherwise it truncates at just 1 char regardless ofmax_lengthbeing much higher:— truncates to just 1 char
— truncates to ~10 chars
But for
label,lengthdoesn't work this way.@postsolar commented on GitHub (Jun 18, 2025):
In case of
music.truncate_popup_titlethis is all also quite confusing, not obvious how to set it up the preferred way:max_length = 60: title gets truncated regardless of its length, even if it's shorter than 60 chars.length = 60: title only gets truncated if it's ≥60 chars, good. But an issue here is that it's also centered which results in this:Not good looking. Apparently this can't be fixed with GTK3 CSS. Maybe we could hardcode left alignment and then remove it in GTK4 branch? Or maybe there's something lower-level that could be addressed? What do you think @JakeStanger ?
@postsolar commented on GitHub (Jun 18, 2025):
I suspect
lengthandmax_lengthwork differently depending on whether it's a widget or a popup (which follows from your quoting of GTK docs). But I'm yet to hammer it home how exactly it works.@JakeStanger commented on GitHub (Jun 18, 2025):
I'm not able to check right now, but if I were to hazard a guess, I would assume it's got something to do with how GTK is packing the widgets. For example I think the volume slider container is actually set to expand to ensure it gets sufficient width, which is possibly pushing back on the labels when they're set to truncate. Alignment might help that, I don't know?
The difference between a bar widget and popup shouldn't be any more than that, at least.
If none of that holds up, perhaps we could look at adding a
max_length_naivethat doesn't use the GTK truncation system and just trims the string.@postsolar commented on GitHub (Jun 24, 2025):
Summing this up, I think my personal issue was just
max_lengthnot working as expected, specifically within popups. This seems to be due to certain popups defaulting to a certain width. Settingmin-widthin the stylesheet fixes this, and popups' initial width is perhaps a different issue.