tsujan / Kvantum

A Linux SVG-based theme engine for Qt and KDE
1.56k stars 146 forks source link

Live theme reloading in open applications #974

Closed Cu3PO42 closed 5 months ago

Cu3PO42 commented 5 months ago

Hi there! First I want to thank you for the tremendous work you've done with Kvantum.

I'd love to be able to change the theme of currently running Qt applications. My brain remembers this working before, but I can currently find no hard evidence of it at all.

I am currently running Kvantum 1.1 and tried changing the theme via both Kvantummanager's GUI and the CLI. As 'applications to be themed' I have tried both Qt5 and Qt6 applications. Both are themed correctly after an application restart, but not before.

I see you currently have a restyleWindow function in Kvantummanager. Might it be possible to execute something similar in other applications upon theme change? I suppose one could watch the Kvantum config for changes to be notified of that?

Unfortunately, I know virtually nothing about Qt or its internals, but if you believe this to be possible, I may take a crack at it.

tsujan commented 5 months ago

Being a style plugin, Kvantum can't apply its themes on the fly. Only a "platform theme" plugin has the permission to do such jobs (usually inside the directory /usr/lib/qt6/plugins/platformthemes/). KDE and LXQt have such plugins as well as config GUIs for them.

That being said, restarting apps (or logging out and in) is always better than an on-the-fly applying of styles/themes because Qt can't apply some details on the fly, especially those related to translucency.

Thanks for the kind words, BTW.

I'm converting this to a discussion for all users.