KeepassXC doesn't respect system theme (Ubuntu 18.04 - GNOME - not Snap install)
KPXC respect the system theme in Ubuntu 18.04 GNOME, which in my case is Adwaita-dark (set via GNOME-Tweaks>Appearance>Themes>Applications)
Despite system theme Adwaita-dark, KPXC has a light theme.
Tried
exec line to: keepassxc --style Adwaita-dark. (from here)~/.bashrc to include export QT_STYLE_OVERRIDE=adwaita-dark as last line (from here). ~/.initrx to include export QT_STYLE_OVERRIDE=gtk2 as last line (from here).Install Ubuntu 18.04 (clean install)
Install KPXC from the Ubuntu Software center (NOT Snap version!).
All opens of application
keepassxc 2.3.1
If use keepassxc -style Adwaita-dark, get error: QApplication: invalid style override passed, ignoring it.
Operating system: Ubuntu 18.04
CPU architecture: x64
Kernel: 4.15.0-20-generic
Enabled extensions:
For Snap and AppImage, this is to be expected. For the "native" version, it's not. I suppose you have some misconfiguration of Qt styles on your system. We don't do anything special here and it works on all platforms I've used KeePassXC on so far.
Yeah, I figured for Snap and AppImage. But this is the native app on a clean Ubuntu install. So unless I messed something in the first few days of using Ubuntu, which is possible, the misconfig is came that way. Any ideas where/how to check and/or remedy?
You probably have to fix or reset the QT_QPA_PLATFORMTHEME env var. Various qt5 packages on Ubuntu also support theming
Apologies, I am not sure how to do that:
fix or reset the QT_QPA_PLATFORMTHEME env var
Confirming that it does not inherit the theme on out of the box Xubuntu 18.04, while installing from the ppa. It worked fine on 16.04. It ignores all the themes, so not particular to any specific theme.
The themes still work fine on other applications, except for keepassxc.
On 18.04
KeePassXC - Version 2.3.3
Revision: 0a155d8
Libraries:
- Qt 5.9.5
- libgcrypt 1.8.1
Operating system: Ubuntu 18.04 LTS
CPU architecture: x86_64
Kernel: linux 4.15.0-23-generic
Meanwhile, on 16.04 the Qt version is 5.5.1
I am seeing this as well. Other Qt programs, including KeepassX, load the system theme correctly.
same problem here. Ubuntu 18.04 (xorg), KeepassXC 2.3.1 from ppa.
You probably have to fix or reset the QT_QPA_PLATFORMTHEME env var. Various qt5 packages on Ubuntu also support theming
tried various values with no luck :
➜ ~ QT_QPA_PLATFORMTHEME=qgnomeplatform keepassxc
QApplication: invalid style override passed, ignoring it.
➜ ~ QT_QPA_PLATFORMTHEME=gtk2 keepassxc
QApplication: invalid style override passed, ignoring it.
➜ ~ QT_QPA_PLATFORMTHEME=qt5ct keepassxc
QApplication: invalid style override passed, ignoring it.
➜ ~ QT_QPA_PLATFORMTHEME=gtk keepassxc
QApplication: invalid style override passed, ignoring it.
Came upon this because of okular (since gnome seems to have killed evince..). Try installing the package qt5-style-plugins and check if it solves the problem. For me it worked straight away, no need for the export.
sudo apt install qt5-style-plugins
Qt is a cross-platform C++ application framework. Qt's primary feature
is its rich set of widgets that provide standard GUI functionality.
.
This package contains the following widget styles:
- Cleanlooks
- Motif
- Plastique
- GTK+ 2
.
It also provides the GTK+ 2 platformtheme, which you would likely want
to use if you want the GTK+ 2 style. Export QT_QPA_PLATFORMTHEME=gtk2 to
enable it for all Qt applications.
Also came upon this on a askubuntu question: https://askubuntu.com/questions/910012/how-can-i-get-qt5-applications-to-use-the-gtk-theme-in-ubuntu-17-04
The problem has occurred since Qt5.7. In this release, the GTK2 platform theme and style was removed and replaced with the GTK3 platform theme. I've recently been in discussion with the Qt developers and it appears there isn't a GTK3 style to complement the platform theme and there are currently no plans to implement this in the future. Therefore, on Ubuntu, the default style is "Fusion" using the GTK3 platform theme.
QT_QPA_PLATFORMTHEME=gtk2 trick works in 2.3.4 from phoerious ppa
Ubuntu 18.10 (xorg)
This works for me from terminal:
QT_QPA_PLATFORMTHEME=gtk2 keepassxc
But how do I get it to work from a launcher?
Editing the keepassxc.desktop file to have that after Exec= does not work. Nor does it work like this: keepassxc QT_QPA_PLATFORMTHEME=gtk2.
Also, editing /etc/environment to include QT_QPA_PLATFORMTHEME=qt5ct does not work.
You need to add it to your .profile file or .bashrc in $HOME
Thanks @droidmonkey. I added it to ~/.profile, with no luck. But maybe I needed to log out. I actually just found an alternative route:
sudo apt install qt5ct
Then select Appearance>Style>gtk2 in the Qt5 Configuration Tool.
Yes, ~/.profile is read at login, so if you change it, you need to at least logout and login back for it to read the changes you made. If you are adding it to ~/.profile you want to add export QT_QPA_PLATFORMTHEME=gtk2. It is as if you run the command yourself as soon as you logged back in. Typing simply export QT_QPA_PLATFORMTHEME=gtk2 on your terminal have the same effect, but it is lost once you log out.
.profile is not always read by your X session. You may need to add it to .xsession instead.
sudo apt install qt5-style-plugins
This worked for me on UbuntuMate18.04.2. I upgraded from 16.
Why did you close this? The app still only follows KDE themes on KDE and it requires setting an environment variable by the user for other desktops. On xubuntu with the arc dark menu keepassxc is very ugly too.
Its not our "bug", take it up with Qt and your distro. We are deploying a custom theme in 2.6 that will eliminate this entire concern.
Thanks @droidmonkey. I added it to
~/.profile, with no luck. But maybe I needed to log out. I actually just found an alternative route:
sudo apt install qt5ctThen select
Appearance>Style>gtk2in the Qt5 Configuration Tool.
Same for me, except I needed to log out after Qt5 preferences installation:
~
sudo apt install qt5ct
~
Restart
Then set preferences under Menu > Preferences > Qt5 Preferences > Appearance: