Your apps do NOT have window border and shadow in Ubuntu 24.04? Here are the quick workarounds for the applications based on Qt UI toolkit.
In Linux Desktop, applications are built with different UI toolkit. While, GNOME, Cinnamon, and XFCE use GTK3/4, KDE and LxQt use Qt for their applications.
Ubuntu by default uses GNOME as default desktop environment, but user may also use Qt applications, such as qbittorrent, ksnip screenshot tool, kdenlive video editor, and more.
Since Ubuntu 23.10, the Qt applications are looking weird. They have very thin border without shadow, that look kinda borderless. This is an upstream issue that also happen in Debian 12 bookworm.
Qt apps in Ubuntu 23.10
If you have similar issue, then this tutorial is going to show you how to fix (workaround) it by 2 ways:
- xcb QPA plugin – for Qt apps run against X11.
- QGnomePlatform Theme – Qt app inclusion in GNOME, but lack Qt6 support in Ubuntu so far.
NOTE: You can do both ‘Option 1’ and ‘Option 2’ in Ubuntu. They seem not conflicting with each other.
Option 1: Set xcb QPA environment
If most of your Qt apps are running against X11, then this option is a good choice.
1. First, press Ctrl+Alt+T
to open up a terminal window. When it opens, run command to install the required libraries:
sudo apt install libxcb-cursor0 libxcb-composite0
Then, you can try to launch a Qt app, qBittorrent from example, from command line with xcb plugin to see if it works:
export QT_QPA_PLATFORM=xcb && qBittorrent
2. If it works, then open “Files“, press Ctrl+H to show hidden files/folders.
Then find out the .profile file, right-click on it and select “Open With Text Editor”.
3. When the file opens, scroll down and add the new line below in the end:
export QT_QPA_PLATFORM=xcb
After saving the file, log out and back in. Then, try launching your Qt applications to see the result.
Tips: without log out and back in, you may press Ctrl+Alt+T to open terminal. Then run command export QT_QPA_PLATFORM=xcb
to set the environment for this terminal window. Finally, launch Qt app from this terminal.
Option 2: Use QGnomePlatform Theme
Fedora Linux has QGnomePlatform project to allow Qt applications to fit into the GNOME environment as well as possible, though it’s no longer maintained due to switch to QAdwaitaDecorations.
The theme works great, and even let your Qt apps automatically switch between light and dark mode according to desktop color style.
Ubuntu 23.04 and Ubuntu 23.10 include the package in system repository, sadly for Qt5 apps only!
1. First, press Ctrl+Alt+T on keyboard to open terminal. When terminal opens, run command to install the theme package:
sudo apt install qgnomeplatform-qt5
Ubuntu 24.10 user can also install the qgnomeplatform-qt6
package for Qt6 apps support!
2. Next, also open “Files”, press Ctrl+H to view hidden files. Then, edit the ‘.profile‘ file and add new line in the end:
export QT_QPA_PLATFORMTHEME='gnome'
Finally, log out and back in to apply change.
After doing both ‘Option 1’ and ‘Option 2’, all my Qt applications have native window borders, though the Qt6-based qBittorrent is still not fitting well in GNOME.
Qt apps in Ubuntu 23.10 after this tutorial
Run Qt app against Wayland
After doing ‘Option 1’, your Qt applications will run against X11.
If you do need to run app against Wayland, then either launch the app from terminal. For example, launch kdenlive
using wayland:
env QT_QPA_PLATFORM=wayland kdenlive
Tips: some apps may be running silently in the background. You need to close it first before running the similar command above.
Or, edit the app shortcut file (usually under /usr/share/appliations
), and set the environment by changing the value of ‘Exec’.
For example, edit the app shortcut for Kdenlive, to make it run against wayland:
sudo gnome-text-editor /usr/share/applications/org.kde.kdenlive.desktop