Skip to content

Uniform look for Qt and GTK applications on Sway (Wayland)

There are several techniques to achieve a uniform look (theme and style) of Qt and GTK to circumvent the fact they use a different widget toolkit to render the graphical user interface.

On X11, I used the QGtkStyle method (described in the Wiki) to style Qt applications using the GTK theme.

On Sway (Wayland), this approach only works for Qt applications (*) that use XWayland. It does not work for Qt applications that run natively on Wayland.

Does anyone know a workaround that also works for Qt applications running natively on Wayland (and not on Xwayland)?

(*) For example, qtbrowser is such an application.

69 points6 comments
Open on Reddit
About this post
Posted
Archived
Score
69 · 100% up
Kind
Text
ID
do8vde

Author

1
posts
1
comments
0
media
View profile

7 comments

Not sure why you are getting downvoted, uniform look for QT and GTK applications under Wayland is an issue I've stumbled upon as well without finding a proper solution, so I would be interested in the answer as well.

16 points

Also in the Wiki, on that same page: Styles for both Qt and GTK. IMO adwaita has become a really nice-looking theme, so I now use it as my gtk theme in conjunction with adwaita-qt from the aur (via QT_STYLE_OVERRIDE).

7 points

And because adwaita is the official gnome/gtk theme, it's really reliable, unlike most of the custom themes out there.

5 points

I use QT_QPA_PLATFORMTHEME=qt5ct

You need to install qt5ct and execute it to customize qt5 applications.

6 points

Set the XDG_CURRENT_DESKTOP environment variable to KDE (and KDE_SESSION_VERSION to 5, although I'm not sure if it's needed for this purpose), then use KDE's system settings (systemsettings5) to set the theme.

1 points

Here is my backend/theming setup. Seems to do well most of the time for consistency across GTK and Qt. Works well enough that I get confused which is which if Thunar and pcmanfm are both open, so that's something at least.

###Backends
#
#This may cause crashes

#GTK
export GDK_BACKEND=wayland
#export CLUTTER_BACKEND=wayland

#Qt (should use wayland by default)
#export QT_QPA_PLATFORM=xcb
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1

#SDL
#export SDL_VIDEODRIVER=wayland

#Java
export _JAVA_AWT_WM_NONREPARENTING=1

### Theming
#
export QT_QPA_PLATFORMTHEME="qt5ct"

gsettings set org.gnome.desktop.interface cursor-theme capitaine-cursors
gsettings set org.gnome.desktop.interface icon-theme la-capitaine-icon-theme
gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark

Where "qt5ct" is from the AUR, and is configured to also use an adwaita dark theme.

1 points
unknown author

Deleted before we saved it.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.