hyprland-community/hyprland-autoname-workspaces

make the active window's icon a different colour

ehula opened this issue ยท 16 comments

ehula commented

Is it possible to introduce styling of workspace icons?

I would love to be able to give the icon of the active window a different colour so that it stands out among the other windows. This would also have the benefit of being able to remove the square brackets currently being used.

Is this possible? Would it conflict with waybar's styling?

Good question, in the futur version the span color will work, after, if we want to enable the color ONLY for the active workspace there is more work I think or trick to find.
I will think about it.
Removing the bracket if we can style the active workspace is a good idea sure. ๐Ÿค”
About a conflict with the css or waybar I feel like they can live together.
Example, here, the green bar for my active workspace from waybar css style, and the firefox color from the span color in the autoname settings:
image

ehula commented

Just to clarify, I'd like to use span color for the active "window" on a workspace, not for the active "workspace". I think maybe you just mis-typed "workspace".

As an example, if I have three windows open on the current workspace, I would like to span color just the icon of the active window.

I'm tired and missread but I will think about this and try things. I will keep you in touch when this topic move. ๐Ÿ‘

Is it possible to introduce styling of workspace icons?

I would love to be able to give the icon of the active window a different colour so that it stands out among the other windows. This would also have the benefit of being able to remove the square brackets currently being used.

Is this possible? Would it conflict with waybar's styling?

Good idea, I think it should be doable.
In my opinion, it could be taken from code and made accessible in config in style like
defaults:

delim=" "
workspace="{id}: {clients}"
client="{client}" # generic app/client
active_client="{client}" #priority over app
dup_client="{client}{s_count}" #s_count - superscripted count of clients on the workspace, but {count} should be available too

so you could modify it as you wish, for example:

delim="โ€ฏ" # NARROW NO-BREAK SPACE
workspace="<span whatever="options" ...>{id}</span>{clients}" # https://docs.gtk.org/Pango/pango_markup.html
client="<span color='grey'>{client}</span>" # generic client
active_client="<span color='white'>{client}</span>" #priority over generic client
dup_client="{client}<span color='red'>{s_count}</span>" 

I just made a {WIP] PR for generalizing delimiter #47, other things could be implemented similarly.

Very good design to be adopt for the future yes. We will add a [format] config section for this and try to reach this.

I start implementing this.

FYI, I reach a step where I can have formatter working BUT not yet active window formatter. It needs a more bigger refactor and studies as we need to go in async mode now for this.

@ehula @psimovec @maximbaz can you try the following PR please ? #49

The formatters are available - but WIP. The one for the active window is not yet available. More refactoring of the code is needed but I should come then.

You can git checkout feat/add-formatters then cargo run and check the README and config.toml.example for new formatters.

Add in your config.toml at least the line [format] for now, even if no more config (this will use the default config then).

Don't hestate to ask me questions. I will be happy to read you ๐Ÿ™๐Ÿป

Batch 1 of the formatter is merge in master. I will try to refactor in async now to support the active event.

You can try this PR if you want #50

Nice update, I can adjust the workspaces quite well now, I am playing with the settings
image

Just some details I found:
I am trying on master for now, the delimiter got broken. On my PR afaik it was always between clients (before 2nd+ client on each workspace), now it is before or after every screen.
image

Another issue I found.. I guess the biggest problem is I can't properly sort by id in the wlr/workspaces module of waybar, so there is the sort by name..
And I saw in code, that if there is no client on workspace, the workspace does not get renamed at all, which breaks the sort (as otherwhise there would be some <span... on start in my case
image
image

Nice update, I can adjust the workspaces quite well now, I am playing with the settings image

Just some details I found: I am trying on master for now, the delimiter got broken. On my PR afaik it was always between clients (before 2nd+ client on each workspace), now it is before or after every screen. image

Another issue I found.. I guess the biggest problem is I can't properly sort by id in the wlr/workspaces module of waybar, so there is the sort by name.. And I saw in code, that if there is no client on workspace, the workspace does not get renamed at all, which breaks the sort (as otherwhise there would be some <span... on start in my case image image

Thanks for the tests @psimovec I will try to fix the bug if I well understand them.
Can you share me the formatters you use to trigger the bug? Is it present with the default one? Will tell you if I need more informations.

I push some fixes try on #50 that also include active window detection.
About bad sorting, @maximbaz will update the wiki to add the trick to fix the ordering. Waybar sort by name, and so we need to use a config waybar trick.

Nice update, I can adjust the workspaces quite well now, I am playing with the settings image
Just some details I found: I am trying on master for now, the delimiter got broken. On my PR afaik it was always between clients (before 2nd+ client on each workspace), now it is before or after every screen. image
Another issue I found.. I guess the biggest problem is I can't properly sort by id in the wlr/workspaces module of waybar, so there is the sort by name.. And I saw in code, that if there is no client on workspace, the workspace does not get renamed at all, which breaks the sort (as otherwhise there would be some <span... on start in my case image image

Thanks for the tests @psimovec I will try to fix the bug if I well understand them. Can you share me the formatters you use to trigger the bug? Is it present with the default one? Will tell you if I need more informations.

delim="โ€ฏ" # NARROW NO-BREAK SPACE
client = "{icon}{delim}"
workspace="<span letter_spacing='-9000'> </span><span font_size='70%' rise='4pt' color='#D{id}D{id}FF'>{id}โ€ฏ</span>{clients}<span letter_spacing='-18000'> </span>"
client_dup = "{icon}<span color='white' letter_spacing='000' font_size='100%' weight='1000' rise='-1pt'  >x{counter}โ€ฏ</span>"

And here you can see relevant workspace names:

workspace ID 2 (<span letter_spacing='-9000'> </span><span font_size='70%' rise='4pt' color='#D2D2FF'>2โ€ฏ</span><span color="orange">๏‰ฉโ€ฏ</span>โ€ฏ<span letter_spacing='-18000'> </span>) on monitor eDP-1:
	windows: 1
	hasfullscreen: 0
	lastwindow: 0x560460063540
	lastwindowtitle: Messenger โ€” Mozilla Firefox


workspace ID 3 (<span letter_spacing='-9000'> </span><span font_size='70%' rise='4pt' color='#D3D3FF'>3โ€ฏ</span>๏‰บโ€ฏ<span color ="#6DBA49" >๎Ÿ…</span>โ€ฏ<span letter_spacing='-18000'> </span>) on monitor eDP-1:
	windows: 2
	hasfullscreen: 0
	lastwindow: 0x56045f9135f0
	lastwindowtitle: Signal

workspace ID 1 (1) on monitor eDP-1:
	windows: 0
	hasfullscreen: 0
	lastwindow: 0x0
	lastwindowtitle: 

The bug triggers when you have a workspace without any clients open.

With default one I suppose the bug doesn't happen, as by default workspaces are named {id}: ... so if the workspace is not renamed, it's name is just {id} for me, so it doesn't affect the ordering.

Thanks @psimovec , you learn me btw some span tricks.

The empty workspace bug is fix in theory in the WIP PR #50 , I introduce a new workspace_empty formatter equal to {id} by default. Also I rename and pass to the formatters even the workspace with no clients.

Also, about the bad ordering, @maximbaz just add some information in the FAQ https://github.com/hyprland-community/hyprland-autoname-workspaces/wiki/FAQ.