Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeepassXC doesn't respect system theme (Ubuntu 18.04 - GNOME) #1931

Closed
TheRoarkster opened this issue May 9, 2018 · 19 comments
Closed

KeepassXC doesn't respect system theme (Ubuntu 18.04 - GNOME) #1931

TheRoarkster opened this issue May 9, 2018 · 19 comments
Labels

Comments

@TheRoarkster
Copy link

TheRoarkster commented May 9, 2018

KeepassXC doesn't respect system theme (Ubuntu 18.04 - GNOME - not Snap install)

Expected Behavior

KPXC respect the system theme in Ubuntu 18.04 GNOME, which in my case is Adwaita-dark (set via GNOME-Tweaks>Appearance>Themes>Applications)

Current Behavior

Despite system theme Adwaita-dark, KPXC has a light theme.

Possible Solution

Tried

  1. editing KPXC desktop file exec line to: keepassxc --style Adwaita-dark. (from here)
  2. editing ~/.bashrc to include export QT_STYLE_OVERRIDE=adwaita-dark as last line (from here).
  3. editing ~/.initrx to include export QT_STYLE_OVERRIDE=gtk2 as last line (from here).

Steps to Reproduce (for bugs)

Install Ubuntu 18.04 (clean install)
Install KPXC from the Ubuntu Software center (NOT Snap version!).

Context

All opens of application

Debug Info

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:

  • n/a
@phoerious
Copy link
Member

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.

@TheRoarkster
Copy link
Author

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?

@droidmonkey
Copy link
Member

You probably have to fix or reset the QT_QPA_PLATFORMTHEME env var. Various qt5 packages on Ubuntu also support theming

@TheRoarkster
Copy link
Author

Apologies, I am not sure how to do that:

fix or reset the QT_QPA_PLATFORMTHEME env var

@droidmonkey
Copy link
Member

See #1914 (comment)

@Podesta
Copy link

Podesta commented Jun 26, 2018

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

@suwalski
Copy link

I am seeing this as well. Other Qt programs, including KeepassX, load the system theme correctly.

@capi1O
Copy link

capi1O commented Sep 14, 2018

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.

@Podesta
Copy link

Podesta commented Sep 21, 2018

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.

@capi1O
Copy link

capi1O commented Dec 12, 2018

QT_QPA_PLATFORMTHEME=gtk2 trick works in 2.3.4 from phoerious ppa

Ubuntu 18.10 (xorg)

@TheRoarkster
Copy link
Author

TheRoarkster commented Mar 28, 2019

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.

@droidmonkey
Copy link
Member

You need to add it to your .profile file or .bashrc in $HOME

@TheRoarkster
Copy link
Author

TheRoarkster commented Mar 28, 2019

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.

@Podesta
Copy link

Podesta commented Mar 29, 2019

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.

@phoerious
Copy link
Member

.profile is not always read by your X session. You may need to add it to .xsession instead.

@ghost
Copy link

ghost commented Apr 14, 2019

sudo apt install qt5-style-plugins

This worked for me on UbuntuMate18.04.2. I upgraded from 16.

arcticicestudio added a commit to arcticicestudio/igloo that referenced this issue Jun 9, 2019
KeePassXC (1) supports GTK3 out-of-the-box, but unfortunately doesn't
adapt to the current system theme and icon them making the UI looking
really unpleasant and outdated.
To use a modern style the app is now started with the
`QT_QPA_PLATFORMTHEME` environment variable (2) set to `gtk2` to ensure the
app respects the Qt5 style overrides (3).

References:
  (1) https://keepassxc.org
  (2) https://wiki.archlinux.org/index.php/qt#All_Qt5-based_applications_fail_to_run_after_Qt5_update
  (3) keepassxreboot/keepassxc#1931

Resolves GH-204
@ghost
Copy link

ghost commented Feb 21, 2020

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.

@droidmonkey
Copy link
Member

droidmonkey commented Feb 21, 2020

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.

@jeffmcneill
Copy link

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.

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:

  • Style = gtk2
  • Standard dialogs = GTK2
  • Palette = Default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants