client-toolkit icon indicating copy to clipboard operation
client-toolkit copied to clipboard

Automatically reload mouse cursor theme when theme config changes

Open Hubro opened this issue 3 years ago • 7 comments

Applications that use client-toolkit (such as Neovide and Alacritty) get the correct mouse cursor based on my current icon theme.

However, if I change the mouse cursor theme by editing $HOME/.icons/default/index.theme from, for example:

[icon theme]
Inherits=Adwaita

To:

[icon theme]
Inherits=Breeze_Snow

I have to restart the application for the change to take effect. This makes it extremely inconvenient to test out various mouse cursor themes and it makes it impossible to automate switching mouse cursor themes to comply with the system wide light/dark theme preference.

It would be amazing if client-toolkit could watch the current theme and reload the graphics if the theme changes.

Hubro avatar Apr 07 '22 11:04 Hubro

Alternatively, if this could be achieved more easily by disabling caching of the mouse cursor theme, perhaps through an environment variable, that would be acceptable to me.

Hubro avatar Apr 07 '22 12:04 Hubro

However, if I change the mouse cursor theme by editing $HOME/.icons/default/index.theme

Do you have examples of apps that react to this? That seems like requesting SCTK to randomly watch a bunch of files for modifications, which does not seem like something we actually would want to do.

elinorbgr avatar Apr 27 '22 12:04 elinorbgr

@vberger When I change my cursor theme, all Gnome applications pick it up immediately (nautilus, gnome-calculator, gnome-terminal etc.), in fact all GTK applications appear to pick it up immediately (tested solaar and waybar) and all my browsers pick it up immediately (tested Vivaldi, Chrome, Chromium, Firefox).

These applications all seem to pick up the cursor theme from gsettings though.

That seems like requesting SCTK to randomly watch a bunch of files for modifications, which does not seem like something we actually would want to do.

That does indeed sound overkill for something like this, but surely there must be other ways of picking up the change. What about reloading the cursor scheme any time the window gains focus or something like that?

Loading the cursor icons once and never letting them change just seems like the opposite extreme to me, and it blocks use cases such as globally changing color schemes.

Hubro avatar Apr 27 '22 13:04 Hubro

What about reloading the cursor scheme any time the window gains focus or something like that?

Given the current level of abstraction that SCTK is, that would rather be "provide a method for reloading the cursor theme that the downstream app invokes when it sees fit". I guess that could work.

elinorbgr avatar Apr 27 '22 14:04 elinorbgr

I think ideally SCTK would handle low-level "boring" things like this without application developers having to think about it, but if there's no graceful and sensible way to do that, providing a simple function for it would at least be a big improvement.

Hubro avatar Apr 28 '22 08:04 Hubro

I think ideally SCTK would handle low-level "boring" things like this without application developers having to think about it

The API exposed by SCTK is currently not high-level enough to do that. But that would be easily done in winit (which alacritty uses).

elinorbgr avatar Apr 28 '22 09:04 elinorbgr

Right, that makes sense. Is the pointer "ThemeManager" a long-lived object? Would it make sense to add a reload function to it?

Hubro avatar Apr 28 '22 09:04 Hubro