polychromatic icon indicating copy to clipboard operation
polychromatic copied to clipboard

Suggestion: Hint DE to use dark theme if available

Open ZwS opened this issue 4 years ago • 4 comments

Details about the problem

Hint DE to use dark theme for the application window. For default branded style it would give dark headerbar.

Default theme with dark header bar enabled Imgur

For system theme it would provide better readability for icons, since green-on-white lacks contrast. But I'm not sure is there is reliable way to enable dark theme for Qt that would work indepently from theme engine.

Adwaita Imgur Adwaita Dark variant Imgur

ZwS avatar Aug 22 '21 14:08 ZwS

This is a good idea. Unfortunately, I can't see a way how to do this, since this isn't a GTK application.

  • https://gitlab.gnome.org/GNOME/gtk/-/issues/99
  • https://bugreports.qt.io/browse/QTBUG-63969

If there's an environment variable we can set, or something similar, that would be great.

lah7 avatar Aug 22 '21 21:08 lah7

For dark titlebar I found following command: xprop -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT dark I' m not familiar with GUI toolkits but for me it looks like this is some kind of flag that should be set during window creation.

As for theming I was unable to find some generic way to tell app to use dark theme. The look you can see on my screenshot was achieved by using adwaita-qt style plugin and setting it's dark variant. It's possible that there is some better way to achieve same result (e.g. some option like for headers) but I was unable to find it.

ZwS avatar Aug 23 '21 07:08 ZwS

Thanks. It appears to be a window property. This could work for the main window only:

xprop -name "Polychromatic" -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT dark

I'm using Fedora 34 with GNOME as a test, as it has Adwaita. What's strange is that xprop is designed for X11, but it works on Wayland 😕 🤷🏼

Sadly, it looks like any attempt at this would be an ugly hack. There's python-xlib which might be able to do it too, but I wouldn't want to depend on X11 code, and xprop is not usually pre-installed.

Qt has a concept of "window flags" but there's nothing to provide a hint for dark theme. It would make sense for Qt to support this since Windows apps (and maybe macOS?) have the same problem.

lah7 avatar Aug 23 '21 09:08 lah7