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

Bundle themes #60

Closed
probonopd opened this issue Jan 29, 2017 · 51 comments
Closed

Bundle themes #60

probonopd opened this issue Jan 29, 2017 · 51 comments

Comments

@probonopd
Copy link
Owner

probonopd commented Jan 29, 2017

Should we do `cp -a "${QT_PLUGIN_PATH}/platformthemes"?

@vadi2
Copy link

vadi2 commented Feb 12, 2017

If this means my Qt application will look more native on a GTK sytem - yes, definitely.

@probonopd
Copy link
Owner Author

Which of the platformthemes are the "standard" ones and should be copied in? Can you send a PR?

@vadi2
Copy link

vadi2 commented Feb 19, 2017

I don't see such a folder in my Qt installation. I can't send a pr in, sorry.

@revast
Copy link

revast commented Sep 26, 2017

libqgtk2.so to have a gtk look on qt5

@revast
Copy link

revast commented Sep 26, 2017

You would need all plugins I would say. Plus QT_PLUGIN_PATH}/styles

Now there is a bit of a chicken and egg situation here. If you just add the ones which are installed on the machine the appimage gets packed, you will miss out some which are installed on the target system. You cannot guess which style/theme is used on the target systems. So if you do not ship with all, the appimage will look like an alien in some target systems.

So I guess its the best to have a list of all possible qt5 styles' and themes' .so files beforehand (the most common, I count 8 at archlinux wiki), and compare these with the ones installed in the qt5 installation of the machine the appimage gets packed, and then inform/warn the user of the fact that if he does not have all the platformthemes and styles installed in his plugins folder, that his app will not look right in different target systems.

If applicable, it would be wise to host these plugins here on github, (for each qt version I guess - or maybe one set of .so's work across more than one version/qtbase-abi...?), and insert them automatically.

Or provide a quick apt-get install or yum install list suggestion depending on the distro linuxdeployqt is run on, or maybe ask the user if linuxdeployqt itself should install these themes/styles via package system before building the appimage.

@TheAssassin
Copy link
Collaborator

Can't Qt be made look for platform themes in one place and the rest in another? How do they solve it on Windows/macOS?

@probonopd
Copy link
Owner Author

It is super important never to mix Qt versions. So if we bundle Qt (which we do) we must make sure that Qt themes are never loaded from the system or else we will crash. Check out the Krita AppImage, it ships with a dark Qt theme.

@revast
Copy link

revast commented Sep 30, 2017

never loaded from the system or else we will crash.

I suspected that.

The way to solve it, from my point of view, is to ship the themes and styles, with ALL their dependencies, that is, you also will need to package GTK it you plan to also support libqgtk2.so (and related) themes.

That is for sure overkill for the average user, but some definitely strive to have a consistent desktop experience for their Apps, and a Dark theme does not necessarily help there.

What would be nice from a user perspective would be to have a possibility to ship the themes with all the dependencies if demanded, e.g. through an extra flag, and that the User is being hinted/warned that when generating the Appimage as it happens now, theme inconsistencies are gonna happen.

@probonopd
Copy link
Owner Author

probonopd commented Oct 1, 2017

you also will need to package GTK

No, since we consider Gtk+2 to be ABI stable and part of each target system.

So we would "only" have to bundle all Qt-GTK parts (libraries, plugins, themes, whatever is needed), if a certain extra flag was specified.

PR welcome!

@revast
Copy link

revast commented Oct 3, 2017

libgtk2.0 is part of a kde-based distro?

ok, here are the dependecies of the platformthemes and styles:

libqgtk2.so
libqgtk2style.so
NEEDED libgtk-x11-2.0.so.0
NEEDED libgdk-x11-2.0.so.0
NEEDED libgdk_pixbuf-2.0.so.0
NEEDED libpango-1.0.so.0
NEEDED libgobject-2.0.so.0
NEEDED libglib-2.0.so.0
NEEDED libX11.so.6
NEEDED libQt5Widgets.so.5
NEEDED libQt5Gui.so.5
NEEDED libQt5Core.so.5
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libc.so.6

libqcleanlooksstyle.so
libqmotifstyle.so
libqplastiquestyle.so
NEEDED libQt5Widgets.so.5
NEEDED libQt5Gui.so.5
NEEDED libQt5Core.so.5
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libc.so.6

breeze.so
qtcurve.so
NEEDED libqtcurve-utils.so.2
NEEDED libKF5KDELibs4Support.so.5
NEEDED libKF5XmlGui.so.5
NEEDED libQt5PrintSupport.so.5
NEEDED libKF5IconThemes.so.5
NEEDED libQt5Svg.so.5
NEEDED libKF5ConfigWidgets.so.5
NEEDED libKF5GuiAddons.so.5
NEEDED libKF5WidgetsAddons.so.5
NEEDED libKF5WindowSystem.so.5
NEEDED libKF5ConfigCore.so.5
NEEDED libQt5DBus.so.5
NEEDED libQt5X11Extras.so.5
NEEDED libQt5Widgets.so.5
NEEDED libQt5Gui.so.5
NEEDED libQt5Core.so.5

oxygen.so
NEEDED libKF5Style.so.5
NEEDED libKF5WindowSystem.so.5
NEEDED liboxygenstyle5.so.5
NEEDED libxcb.so.1
NEEDED libKF5WaylandClient.so.5
NEEDED libKF5ConfigWidgets.so.5
NEEDED libKF5GuiAddons.so.5
NEEDED libQt5X11Extras.so.5
NEEDED libKF5ConfigGui.so.5
NEEDED libKF5ConfigCore.so.5
NEEDED libQt5Widgets.so.5
NEEDED libQt5DBus.so.5
NEEDED libQt5Gui.so.5
NEEDED libQt5Core.so.5
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libc.so.6

so for breeze, qtcurve, oxygen as default, one would have to ship parts of kde libs...

I now query the QT_QPA_PLATFORMTHEME variable of the system and then set the theme accordingly. But doing so, on a system where QT_QPA_PLATFORMTHEME is set to gtk2, and with the gtk2 platformtheme and style installed, results in this error (vanilla xubuntu 17.10 daily image)


QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries.
QCommonStyle::drawComplexControl: Control 1 not handled

as well as this appearance:

1

instead of

2

If I try to install the qt5-gtk-platformtheme plugin via debian package in xubuntu 17.10, it shows these dependencies


libdouble-conversion1 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5
  libqt5widgets5 libxcb-icccm4 libxcb-image0 libxcb-keysyms1
  libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1
  libxkbcommon-x11-0 qt5-gtk-platformtheme


@probonopd
Copy link
Owner Author

Try running with LD_DEBUG=libs your.AppImage to see what is being loaded and what fails to load.

@revast
Copy link

revast commented Oct 4, 2017

https://pastebin.com/8bUR910v
notably, I have a
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: error: symbol lookup error: undefined symbol: hb_font_funcs_set_variation_glyph_func (fatal)

and it tries to find all the libs I get when installing libgnomeui-0, that is

libbonobo2-0 libbonobo2-common libbonoboui2-0 libbonoboui2-common libglade2-0 libgnome-2-0 libgnome-keyring-common libgnome-keyring0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common libgnomevfs2-0 libgnomevfs2-common liborbit-2-0

I found elsewhere this answer to install libgnomeui-0 when searching for a solution to "could not resolve GTK".
So note: while xfce is a GTK-based desktop, it did NOT have the necessary libs shipped!

Obviously, when I try to install these on the target system via package-manager, the app tries to link against them, which results in a segfault. So I am not entirely shure about ABI stability helps here. So you will have to ship all these libs in the appimage for proper theming. You will have to rethink that anyways if you get kde-based themes into play, as well as qt5.8+ switching the theme /style plugins to gtk3...
Does not seem to be a trivial task, also given the fact that the machine where the appimage gets created would need to have all these installed..

@probonopd
Copy link
Owner Author

probonopd commented Oct 4, 2017

I'm asking myself whether it's a good idea to depend on GNOME when all we (probably) really want is to render in Gtk+ 2.

What exactly pulls in libgnomeui-0?

@revast
Copy link

revast commented Oct 8, 2017

nothing I guess - but the style does not work when its not bundled. Even if the style now works, the theme (the color which is set in the system theme, that is, does not...

@probonopd
Copy link
Owner Author

probonopd commented Oct 9, 2017

Some Qt expert is needed here. Maybe ask on the Qt mailing list how this needs to be deployed so that it works.

@probonopd
Copy link
Owner Author

probonopd commented Nov 25, 2017

Interesting: The AppImages from https://download.opensuse.org/repositories/home:/rncbc/AppImage/ look correctly themed on XFCE:

qt

See AppImage/AppImageKit#125 for further analysis. Turns out that this could be achieved whithout the need to bundle platformthemes or anything else.

@TheAssassin
Copy link
Collaborator

Seems to be fixable when using Qt 5.9.3 and copying the platform themes to the AppDir.

See e.g., probonopd/quassel@b75a57c.

@probonopd probonopd reopened this Nov 27, 2017
@probonopd
Copy link
Owner Author

With the platformtheme, the font now looks like in XFCE but the colors still don't...

@TheAssassin
Copy link
Collaborator

Probably due to the lack of a pretty GTK(3?) theme for XFCE (uses GTK2). Some Qt apps lack a "native" look on my xubuntu 16.04. Might not even be the platform themes' fault.

Another idea: we might bundle the wrong one. On my system, the only available platform theme is /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlatformTheme.so.

@probonopd
Copy link
Owner Author

If true, then I want the gtk2 platformtheme back. And we need a KDEPlatformTheme.so as well. If I remember correctly someone had made a special version with few dependencies for use with AppImage.

@vadi2
Copy link

vadi2 commented Nov 27, 2017

Is just using Qt 5.9.3 and the latest linuxdeployqt enough to get this change, or is some coding per probonopd/quassel@b75a57c needed?

We upgraded to 5.9.3 but I don't see a change in theming - it's still using Fusion.

@TheAssassin
Copy link
Collaborator

@vadi2 check whether your AppImage contains a directory usr/plugins/platformthemes/, and describe its contents please.

@vadi2
Copy link

vadi2 commented Nov 27, 2017

/tmp/.mount_Mudlet5HkMB5/plugins$ tree
.
├── audio
│   ├── libqtaudio_alsa.so
│   └── libqtmedia_pulse.so
├── bearer
│   ├── libqconnmanbearer.so
│   ├── libqgenericbearer.so
│   └── libqnmbearer.so
├── imageformats
│   ├── libqgif.so
│   ├── libqico.so
│   └── libqjpeg.so
├── mediaservice
│   ├── libgstaudiodecoder.so
│   ├── libgstcamerabin.so
│   ├── libgstmediacapture.so
│   └── libgstmediaplayer.so
├── platforminputcontexts
│   ├── libcomposeplatforminputcontextplugin.so
│   └── libibusplatforminputcontextplugin.so
├── platforms
│   └── libqxcb.so
├── platformthemes
│   └── libqgtk3.so
└── xcbglintegrations
    └── libqxcb-glx-integration.so

The AppImage is available at https://transfer.sh/WNlqb/Mudlet-3.5.0-testing-963e49b.AppImage and I'm running Ubuntu 17.04.

@TheAssassin
Copy link
Collaborator

The platform themes are bundled properly here. It's actually all about libqgtk3.so. Maybe you need some other platform themes file as well, like I do with my XFCE/xubuntu desktop?

Please list the contents of /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/.

@vadi2
Copy link

vadi2 commented Nov 27, 2017

Not much more to it:

$ tree /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/
/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/
├── libqgtk3.so
└── libubuntuappmenu.so

0 directories, 2 files

@simoniz0r
Copy link

Just wanted to comment that so far the AppImages probonopd linked above and the AppImage for Cantata are the only Qt based AppImages that I've used so far that will actually follow my GTK or Qt color theme.

I've tried quite a few Qt based AppImages on both Xfce and LXQt, and none other than the ones linked above and Cantata follow my system color theme. The color themes for all of the apps I've tested (at least ones available in my repos) work fine when using the versions of these programs installed through my package manager.

Quassel, keepassxc, notepadqq, and simplescreenrecorder are just a few that come to mind that I've tested that do not follow my system theme when using the AppImage release.

@TheAssassin
Copy link
Collaborator

@simoniz0r you can safely consider the stuff on Bintray outdated at any time. You shouldn't use them for productive work anyway. The keepassxc and notepadqq builds seem outdated, too. They might not be the best candidates for verifying this behavior. But you can use https://github.com/TheAssassin/mumble as another test object.

@simoniz0r
Copy link

No, it does not @probonopd

Installed through my package manager:

image

AppImage:

image

@simoniz0r
Copy link

@TheAssassin Your AppImage build of Mumble does not follow my system colors or fonts either.

@probonopd
Copy link
Owner Author

For reference, can you also post a screenshot of an AppImage from https://download.opensuse.org/repositories/home:/rncbc/AppImage/ and describe your system (which OS, version, desktop environment, etc.), please. This will help us a lot.

@simoniz0r
Copy link

simoniz0r commented Nov 27, 2017

After doing some more testing, it seems that only qxgedit and qtractor from the link above use my system theme. I'm thinking this may be because I'm using LXQt's option to use a GTK theme to theme Qt applications. Both qxgedit and qtractor have an option that lets me use the GTK theme for the app, and they use the GTK theme that I have set using lxappearance. Cantata also has an option to use the GTK theme, and it works the same way.

Any Qt apps that are packaged in AppImages that do not have the option built in to use the system's GTK theme do not follow the GTK theme that my system is using. They seem to just fall back to a default Qt theme and font. When I install these applications through my system's package manager using the same theme settings, they follow my system's theme as expected.

It would seem to me like the AppImages that are working with my system theme are applications that have been built with GTK theme support regardless of what package they're being delivered in.

As you can see below, both qxgedit and Cantata have the option for me to use the system's GTK theme. I know that for Cantata, this is something that is in all of the package releases. It's also worth noting that the AppImage release of Cantata will only use my system theme when I go into Cantata's settings and tell it to use the GTK theme. When I install it through my package manager, it uses my system theme when I have the option set to system default.

qxgedit AppImage

Cantata AppImage

Cantata normal install

My info:
image

image

@probonopd
Copy link
Owner Author

probonopd commented Dec 29, 2017

edb-qt56-continuous-git.6fcbf13-x86_64.AppImage on XFCE is using the system's theme, looks almost like a native XFCE application:

edb.

It ships with the libqgtk2.so platform theme which unfortunately seems no longer present in newer versions of Qt. Strangely, it continues to look the same when one removes that platform theme.

@TheAssassin
Copy link
Collaborator

@probonopd how sure are you it won't load the system theme file when removing it from the bundle...? strace might help here.

@simoniz0r
Copy link

simoniz0r commented Dec 29, 2017

The same AppImage does not follow my system theme at all on LXQt.

https://transfer.sh/gjO1r/edb-qt56-continuous-git.6fcbf13-x86_64.AppImage

image

@probonopd
Copy link
Owner Author

Strange. We still don't know why it is behaving so differently with different system/Qt combinations.

@simoniz0r
Copy link

simoniz0r commented Dec 29, 2017

Like I said before, the only Qt AppImages that follow my system theme are applications that have been built with GTK support and have an option to switch to GTK based theming. No other Qt AppImages follow my system theme.

@probonopd
Copy link
Owner Author

applications that have been built with GTK support

How does one do that?

@simoniz0r
Copy link

Sorry, no idea on that one; I'm not a Qt dev... You might try asking someone like CDrummond who works on Cantata or the qxgedit developer.

@probonopd
Copy link
Owner Author

probonopd commented Jan 20, 2019

What do people think of
https://github.com/CrimsonAS/gtkplatform?

gtkplatform is a Qt Platform Abstraction plugin providing Qt applications with the capability to use gtk+ as a host toolkit, primarily intended for use on Linux desktops.

That is: it lets Qt applications render with native gtk+ menus, and use gtk+ for input (mouse, keyboard, touch), and getting window content on screen, the same as it uses e.g. cocoa on macOS for instance.

Unfortunately it seems to be using the more complex and "moving target" Gtk+ 3 rather than the mature Gtk+ 2.

@vadi2
Copy link

vadi2 commented Jan 20, 2019

Tried it out and it didn't work: CrimsonAS/gtkplatform#23

GTK+ 2 isn't mature btw, it's deprecated - the last release was 8 years ago. An application using GTK+ 2 now would look out of place in a modern desktop.

@probonopd
Copy link
Owner Author

probonopd commented Jan 21, 2019

According to https://askubuntu.com/a/910143,

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.

So, bundle the GTK2 platform theme and style?

@probonopd
Copy link
Owner Author

probonopd commented Jan 21, 2019

Yes, that does the trick:

########################################################################
# https://askubuntu.com/a/910143
# https://askubuntu.com/a/748186
# At runtime, export QT_QPA_PLATFORMTHEME=gtk2 (Xfce does it automatically)
########################################################################

apt-get update
apt-get -y install libgtk2.0-dev
git clone http://code.qt.io/qt/qtstyleplugins.git
cd qtstyleplugins
qmake
make -j$(nproc)
make install 
cd -

(...)

linuxdeployqt (...) -extra-plugins=platformthemes/libqgtk2.so,styles/libqgtk2style.so

@Vanuan
Copy link

Vanuan commented Feb 20, 2023

As the AppImageKit issue closed, what's the status on this one?

Can platformthemes be bundled and how to make sure the version is compatible with the host version? Specifically QGnome

@probonopd
Copy link
Owner Author

probonopd commented Feb 20, 2023

The issue is that if you bundle QGnome, then you need to bundle all of its dependencies, too - since you can't assume Gnome to be present on all systems. And in practice, this can lead to all kinds of difficulties.

So over the years the contributors in this project have come to the conclusion that it's not worth the effort, but ymmv. You'd have to use another tool for that, though.

@Vanuan
Copy link

Vanuan commented Feb 24, 2023

@probonopd I think you're confusing Qt platform themes with desktop environments. QGnomePlatform theme is quite lightweight and doesn't require any GNOME dependencies.

  • It is more a part of Qt rather than GNOME, so it depends on Qt.
  • It does depend on Gtk3 though
  • It also depends on gsettings schemas which is a small XML file it uses to get desktop settings over dbus which is a part of Qt.
  • There's also Adwaita-Qt which only depends on Qt

As you can see, there's nothing whatsoever that involves any of GNOME libraries other than Gtk3. And if Gtk3 is not present on target system, the platform plugin would just not load, so noop.

What difficulties you're talking about?

@probonopd
Copy link
Owner Author

And if Gtk3 is not present on target system, the platform plugin would just not load, so noop.

if that is how it works, then it's good. But I remember that back in the time when we bundled Gtk Qt platform themes, we eventually ran into issues that made us decide it was not worth keeping them.

If you are interested in the details:
AppImageCommunity/AppImageUpdate#150

@Vanuan
Copy link

Vanuan commented Feb 25, 2023

@probonopd It looks like the issue is not that Gtk is not present, but that it is loaded from the system and has incompatibility issues. Either it's a configuration issue or a binary incompatibility with bundled libraries. That's indeed a valid issue. Typically, AppImage doesn't load libraries and resources from the system. So this issue is not specific to the platform themes, but to any library that is loaded by AppImage from the system. Are there successful examples where AppImage loads a *.so from the system and it works?

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

No branches or pull requests

6 participants