-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add a command option to truncate strings #414
Comments
That is a nice idea and also should be straight forward to implement in the |
Not a prolific coder but will try :) |
I realised that it is not as straight forward as I made it seem, since caution has to be applied for multibyte unicode sequences. Simply truncating the |
Tested, it works. The only issue I'm aware of is char counting: |
But since truncation got implemented, we can already close this issue. Thanks for the work! |
I have implemented it such that multi-byte chars are only counted as one char, so |
I retested and you’re right, that’s the case. Sorry for misreporting. I used the emoji sequence ones (e.g. country flags) rather than the plain ones. 😅 |
I am aware of delegating the string truncation to the scripts used in bar items, say with
sed
orcut
as in here. I use this method myself (either withcut
or shell parameter expansion). But I thought that since icons and labels are just strings anyway, it would be nice to have the ability to set the max length via a command option. That way, we can usesketchybar --default
to enable truncation globally without having to do them manually in each item where it's necessary. Not only it will enable truncation for bar items that do not use scripts, it will also reduce computational cost compared to when usingsed
orcut
(though I know these two aren't really costly).The text was updated successfully, but these errors were encountered: