-
Notifications
You must be signed in to change notification settings - Fork 48
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 space between text and icon #39
Conversation
This change adds a space between the text and the icon behind.
Hi @RoobieBoobieee , can you provide a screenshot as to how this change is better than what's there now? |
It's clear to me now, thanks for providing the screenshots. I agree that it looks better with your custom icons, but it regresses the default in my opinion. In fact, an earlier version of this script had the spaces. I spent a little time trying to figure out another approach to the issue that would work for you and the default. I tried simply specifying a character which included a space, like: $ echo "i3xrocks.label.up: " >> ~/.config/regolith/Xresources But unfortunately all empty space characters render as a "generic unicode" character. I could not find a unicode value or otherwise that would produce the desired result. This issue may be related: FortAwesome/Font-Awesome#1606 I thank you for your time to put together this contribution but cannot merge it. If you find a way of preventing the spacing to occur w/ the default characters then I would be happy to make the change. |
Hi Ken, I was digging through xrescat when I saw this pull request, and it looks like you can get spaces into the strings in Xresources by escaping the space with a backslash, like:
if you run xrescat i3xrock.label.up you should see the space printed before the icon. You could do the same after the icon if you need a space there as well. It looks to me like you need to escape all spaces if you want xrescat to output them exactly as you typed. Anyway, perhaps this could be a solution for this problem. |
Thanks for the suggestion @buck10 ! The issue is that the space character maps to not-a-space in the icon fonts. Generally this is dealt with via Pango If there were a space-like character that was available in both fontawesome and material design web icon font, then this would be a solution. |
Interesting. That is not what I am seeing when I insert escaped spaces after the icons in the bar. |
I may have been confusing another issue. I tried this and was able to see the spacing properly: echo "i3xrocks.label.up: \ " >> ~/.config/regolith/Xresources @RoobieBoobieee can you check if this fixes your issue? |
I checked the use of the escape sequence more and it doesn't work properly if you want spaces after the last character. xrescat seems to want to ignore the space and then escape the linefeed, thereby pulling the next line in the Xresources file into the returned result. I think a better approach would be to have a wrapper around the call to xrescat to allow us to use double-quotes around the values in the Xresources file that would then be stripped from the result when read back, which is more how set_from_resource work. I wrote the following function that does this:
This could be put somewhere that all scripts can then source if they want so that any calls to xrescat could be replaced with XRESCAT. If there are no quotes at the start and end of the returned string, then the result returned from xrescat is not modified. Not sure where the best place to put this file would be, but I suppose /usr/share/i3xrocks or /etc/regolith/i3xrocks would be options. Let me know what you think. |
@kgilmer That works for me, thanks! |
@kgilmer, I have a patch for xrescat that does what my bash script above does, but in C. So it would mean no changes are needed to any of the i3xrocks scripts, but would let people put additional spaces before and after their resource strings if desired. I can issue a pull request if you like. It is currently in my fork of xrescat. |
Sounds interesting, yes please provide your PR for |
Sent the PR over. |
Closing as we took the xrescat PR. |
This change adds a space between the text and the icon behind.