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
WIP: Tab icons #39
WIP: Tab icons #39
Conversation
Added: - Add a new region dynfun 'region_icon' - Code for extracting and resizing icons from _NET_WM_ICON - Somewhat adhoc drawing of icons in tabs. eg. by abusing GrTextElem - Dependency on cairo (didn't feel like learning the ancient X11 GC stuff) Remaining: - Less adhoc "transport" of icons into to the drawing engine - Proper aligning (atm. hardcoded to 16x16 and 2px x and y offset) - Account for icon size when shortening and don't draw icons on top of the title - On/off option, preferably using the style system - Possible build-time option? - Extract icons from the WM_HINTS if _NET_WM_ICON isn't present - Misc cleanup and documentation
…re requested Github issue: raboof#38
- New extra style 'show_icon' controls whether to show tab icons - Position the icon and title properly - Make sure the tabbar is high enough to accomodate the icon [1] [1] icon size is hardcoded to 16x16 atm.
Extra boolean style attribute "icon_align_left" Note: Subject to change
Cool! I think adding cairo as a build-time required dependency could be a hurdle, it'd be really nice if that could be avoided... Notion users don't tend to like changes to their configurations, but leaving this disabled by default will make it hard to discover. Not sure how to handle that gracefully... |
It's simple enough (not pretty) to wrap all icon stuff in We could extend |
Also report that we support _NEW_WM_ICON in _NET_SUPPORTED
winprop key "icon": - Path to a png file - Overrides _NET_WM_ICON [1] - Will be rescaled to 16x16 if needed Atm. no caching of icons is done. The png file is read (and possibly scaled) each time a new matching window is mapped. [1] know quirk: if the app changes _NET_WM_ICON the winprop icon will be overriden
Hypothetically speaking, how hard would it be to ditch cairo (since it isn't used elsewhere in notion right now)? Then nothing would prevent this being merged. |
A long time since I wrote this, but I don't think it's harder than to find something else that can render ARGB data to a x-drawable. If you want support for the icon_path winprop you'll need something that can decode png - hopefully to ARGB laid out like the _NET_WM_ICON xprop (to simplify buffer managment) Probably possible to use https://tronche.com/gui/x/xlib/utilities/XCreateImage.html though I'm not sure how well it handles alpha. I suspect the main challenge will be to properly blend the icon onto the surface. (I don't actually remember if I tried to use the xlib functions or not) |
Thanks for the info. The code is very clear we could ifdef the code if Cairo is present like we do with Xft |
PS: although the PR says WIP, me and hedning used the patch daily (for a year+) as part of our "fork", so the code should be reasonably well tested. |
Great! Thanks @olejorgenb I'll rebase against master (instead of notion3) and create new PR |
I'll close this to follow it on #211 , thanks again @olejorgenb ! |
Work in progress adding icons to tabs. (ie. render
_NET_WM_ICON
)Status: Works, but the code need some cleaning, and I haven't decided on all design choices yet.
Toggled through a style attribute
show_icon
. It's enabled for the clean looks in the branch. If you use a different look (or keep the look files in ~/.notion) addshow_icon = true
todefstyle("tab", ...
ordefstyle("tab-frame", ...
icon_align_left=false|true
controls the alignment (whether the icon follows the text of is always left aligned)I put this PR out there a bit early to get some indication on whether the feature is wanted at all and maybe some feedback/input. If there's little interest I might just maintain the branch in a less polished state.
cairo is a dependency.
icon_path
to winprops?(ref: #38)