This request is related to #331
After working on packaging Vorta and QDarkStyle, I realised that defaulting to a non-system Qt style is not what most users want. Namely, for a package installed with the system package manager on Debian (and derivatives such as Ubuntu, Kubuntu, Neon, etc) the expectation is that all applications follow the style of the desktop as a whole. This is from a Qt/KDE Plasma perspective;
Pyqt5 provides access to the default style, whatever it may be. I'm not sure what the ideal solution is, because QDarkStyle is so different from the usual way of doing things on the Linux desktop, but I'm guessing it will be something like boolean somewhere in Vorta's source. When toggled (with a patch or with sed, when the deb is created), Vorta would not attempt to import QDarkStyle, would disable in-application theme switching (GUI), and would skip all code paths involving QDarkStyle, instead using the pyqt5 defaults.
I personally would be fine with removing it all together. Not sure how it looks on macOS, but on Linux it looks terrible and we got quite a few bug reports because of it.
I'm fine with the defaults too.
Will remove it today and see if bad things happen.
I'm done removing all custom styles, @Hofer-Julian @sten0 . Works well on macOS. Even changes in real-time now. Was able to get rid of a few workarounds for icon colors as well.
Please check it out for Linux. Especially the function uses_dark_mode() should be adapted for Linux. Then we can also get rid of some settings. Hope Qt nicely adjusts to to the main color there.
Will look into it this weekend
Here is a screencap from my WIP Debian package, with #475 merged, running in a sid VM:
Thanks for the screencap, @sten0 . Looks surprisingly similar to the Fusion theme. Sure it's merged? But then it adjusted when you changed the theme, which is good.
I do see we have some remaining design issues. Generally we only use plain-vanilla Qt, so most elements should adjust well.
I did have to set up an event listener, looking for theme changes. This seems to work on Linux as well, but the uses_dark_theme() isn't implemented for Linux. Not sure where to get this info.
The issues you have with the QToolbox element (the horizontal tabs) also exist on macOS, but less severe. Just have the wrong background. Closing a re-opening the window fixed it, but we could probably repaint the element manually when the theme change fires.
To summarize the tasks I see ahead:
uses_dark_theme() (this will also fix the icons)QToolbox display after theme change without closing window.QToolbox titles (I think this is why we used the Fusion style in the first place)I'll probably set up a quick VM as well. Is this just the default desktop?
I did have to set up an event listener, looking for theme changes. This seems to work on Linux as well, but the
uses_dark_theme()isn't implemented for Linux. Not sure where to get this info.
That's a thing of the future, unfortunately.
https://blog.elementary.io/the-need-for-a-freedesktop-dark-style-preference/
Quick note: It's possible to get the UI colors via the palette attribute. This should enable system-independent dark mode detection. E.g. to get the text color printed, plug this in near vorta/application.py:47 (or pretty much anywhere)
palette = self.palette()
print(palette.window().color().name())
print(palette.windowText().color().name())
For dark theme:
#323232
#ffffff
Light theme:
#ececec
#000000
We probably just need lightness(), from 0 to 255 for dark/light.
print(palette.windowText().color().lightness())
That's a thing of the future, unfortunately.
No problem. We can directly get the colors from Qt. Just needs some threshold of what's dark.
Thanks for the screencap, @sten0 . Looks surprisingly similar to the Fusion theme. Sure it's merged? But then it adjusted when you changed the theme, which is good.
You're welcome @m3nu, and thank you for working on this issue :-) This is
the default theme for KDE Plasma. The light variant is called
"Breeze" and the dark variant "Breeze Dark".
I did have to set up an event listener, looking for theme changes. This seems to work on Linux as well, but the
uses_dark_theme()isn't implemented for Linux. Not sure where to get this info.
To summarize the tasks I see ahead:
- [ ] Detect light/dark theme on Linux
uses_dark_theme()(this will also fix the icons)- [ ] Fix
QToolboxdisplay after theme change without closing window.- [ ] Fix
QToolboxtitles (I think this is why we used the Fusion style in the first place)
Yes, I think that's everything I hoped to say with the screencap :-)
I'll probably set up a quick VM as well. Is this just the default desktop?
Yes. Steps to get this specific mix of packages:
deb http://deb.debian.org/debian unstable main contrib non-free
# /\ or your preferred mirror /\
sudo apt update and sudo apt full-upgradesudo reboot command)sudo apt full-upgrade again for good measure.sudo apt install kde-plasma-desktopsudo systemctl start sddmI'm assuming you'll be working from git and skipping the work of Debian packaging. At a minimum python3-pyqt5.qsci python3-secretstorage should be installed. The following is the list of build-dependencies I use:
python3-setuptools
python3-setuptools-git
python3-pytest-forked
python3-pytest-runner
python3-appdirs
python3-apscheduler
python3-keyring
python3-dateutil
python3-paramiko
python3-peewee
python3-psutil
python3-pyqt5.qsci
IIRC I had to manually specify python3-pyqt5.qsci python3-secretstorage as runtime dependencies, and the rest were picked up automatically from the build using the dh-python (and should probably be installed).
And that's my new VM testbed.
I wasn't yet able to get Vorta to work on Debian 10 (buster); here there was failed to import pyqt5 error (low priority for me, since I'm targeting Debian 11). A Neon LTS based on Ubuntu 20.04 might be new enough though. No idea about Kubuntu. They'll all inherit the eventual Debian package their future versions, so the number of your users will grow quite a bit :-) 'hope that's what you want!
Thanks for the VM instructions. I was afraid to ask 馃槃. Will try that this morning.
The other items are probably taken care of already. Detecting dark mode based on palette colors works perfectly and the style issue in QToolbox was due to a bold style I applied. After I removed it, it worked flawlessly. This may fix the titles as well, since the style was applied there too. (just to make it bold, but seems to confuse Qt)
I'll check back after testing on the VM.
Looks like all the issues are already solved. Not much todo in Linux.
Can we now remove both workarounds use_dark_theme and use_light_icon, @Hofer-Julian ? One was needed for Gnome IIRC.
Also made a screengrab 馃
The light tray icon should be the one to use for GNOME since the bar is black, yes.
Not sure about other DEs. Maybe we make it light per default and make it smarter as soon as people complain?
Then I just add an override for Gnome and disable the option for now.
So the icon color will be based on the color palette in use. Except for Gnome, where it will be always white.
Oh just saw your nice screencast.
KDE changes tray color with theme change.
Then probably the best option is to leave light icon hardcoded for GNOME, and see if icon change with theme change works for other DEs as well
Manu notifications@github.com writes:
Thanks for the VM instructions. I was afraid to ask 馃槃. Will try that this morning.
You're welcome :-) No problem!
The other items are probably taken care of already. Detecting dark mode based on palette colors works perfectly and the style issue in
QToolboxwas due to a bold style I applied. After I removed it, it worked flawlessly. This may fix the titles as well, since the style was applied there too. (just to make it bold, but seems to confuse Qt)I'll check back after testing on the VM.
Manu notifications@github.com writes:
Looks like all the issues are already solved. Not much todo in Linux.
Can we now remove both workarounds
use_dark_themeanduse_light_icon, @Hofer-Julian ? One was needed for Gnome IIRC.Also made a screengrab 馃
Nice, I'm happy to see those instructions were sufficiently complete :-)
If you think they would be useful to other people, please let me know
and I can write up a HOWTO/Tutorial.
Cheers,
Nicholas
Most helpful comment
You're welcome @m3nu, and thank you for working on this issue :-) This is
the default theme for KDE Plasma. The light variant is called
"Breeze" and the dark variant "Breeze Dark".
More on this later.
Yes, I think that's everything I hoped to say with the screencap :-)
Yes. Steps to get this specific mix of packages:
sudo apt updateandsudo apt full-upgradesudo rebootcommand)sudo apt full-upgradeagain for good measure.6a. The unstable distribution/suite is changing constantly, but not everything moves at the same speed. Force installations and removals will expose consistency problems that require advanced skills to recover from.
sudo apt install kde-plasma-desktop7.a: Either reboot or run
sudo systemctl start sddmI'm assuming you'll be working from git and skipping the work of Debian packaging. At a minimum
python3-pyqt5.qsci python3-secretstorageshould be installed. The following is the list of build-dependencies I use:IIRC I had to manually specify
python3-pyqt5.qsci python3-secretstorageas runtime dependencies, and the rest were picked up automatically from the build using the dh-python (and should probably be installed).And that's my new VM testbed.
I wasn't yet able to get Vorta to work on Debian 10 (buster); here there was failed to import pyqt5 error (low priority for me, since I'm targeting Debian 11). A Neon LTS based on Ubuntu 20.04 might be new enough though. No idea about Kubuntu. They'll all inherit the eventual Debian package their future versions, so the number of your users will grow quite a bit :-) 'hope that's what you want!