luni, 21 iulie 2014

Use Oxygen in Qt5 apps on Manjaro

Qt5 is here, KDE 5 is also coming (and it looks great!) and many applications gets ported to the new version of the popular toolkit framework now developed by Digia. When you use a GTK-based DE you get a fully-native looking Qt applications, thanks to the work made by Qt developers which wanted to get an uniform look on every platform they provide to (unlike GTK developers, which seems to care only about Gnome...). But when you run Qt5 applications in KDE4 you'll mostly get a different-looking UI, using the default theme in Qt5 called Fusion.

Qupzilla not using Oxygen theme :(
That's because libraries are binary-incompatible between Qt4 and Qt5 which makes impossible loading the Oxygen style in Qt5 as it is compiled for Qt4. The solution, then, is to compile Oxygen for Qt5. There's a oxygen package in AUR (mirror) but it depends on kwin (probably with a reason) which also depends on other packages which finally will fail to build (at least on Manjaro), but I was able to compile and using it without this. So either you modify the PKGBUILD of that package or use this one (which is the same, except the dependency of kwin) for compiling and creating the .tar.xz package. To do this, just save the file anywhere (make sure that your browser doesn't add .txt extension at the end, like it did for me) and run makepkg in its directory. After everything is done you'll see a new package, which you can install by running pacman -U oxygen-5.0.0-1-x86_64.pkg.tar.xz.
Everything looks fine now,
except the fonts which are bigger on Qt5 apps
Now when you'll run a Qt5 app you should see it skinned with the Oxygen style. If the applications are still using the old style, run the application from Terminal (or Konsole :P) with -style oxygen argument and see the output which may offer some relevant information about missing libs, etc. If  the fonts are not the same in Qt5 applications, just copy kdeglobals from ~/.kde4/share/config/ in ~/.config/ and re-run the application.
Way better
If you encounter issues or you need more information (it is very possible that I ommited something) don't hesitate to ask in the comments section.