blog

My personal blog.
Log | Files | Refs

commit ee9e1aac4ec225a7bc4360eee6c4da3c2432fd64
parent 1fb4081bfd350e32ccdece73565e001f0b6e4f27
Author: Luke Willis <lukejw@loquat.dev>
Date:   Wed, 20 Aug 2025 15:35:53 -0400

Write post about theming QT

Diffstat:
Aimg/pavucontrol-qt-themed.webp | 0
Aimg/pavucontrol-qt-unthemed.webp | 0
Aposts/theming-qt-on-sway.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/img/pavucontrol-qt-themed.webp b/img/pavucontrol-qt-themed.webp Binary files differ. diff --git a/img/pavucontrol-qt-unthemed.webp b/img/pavucontrol-qt-unthemed.webp Binary files differ. diff --git a/posts/theming-qt-on-sway.md b/posts/theming-qt-on-sway.md @@ -0,0 +1,73 @@ +`((title . "Theming QT apps on Sway using Kvantum and lxqt-qtplugin") (date . "2025-08-20"));` +This took me an uncomfortable amount of time to figure out. + +Long story short, QT doesn't really have a built-in mechanism to handle themes +or icons. You have to use a style engine to change how applications look. +[Kvantum](https://github.com/tsujan/Kvantum/tree/master/Kvantum) is great for +this purpose and has a lot of nice built in themes. Once installed, you can +simply set `QT_STYLE_OVERRIDE=kvantum` and QT apps will start using the theme. + +However, this still doesn't handle icons. Icons have to be handled through the +`QT_QPA_PLATFORMTHEME` variable. Most DEs provide a weird plugin of their own +that does some kind of black magic which can only be configured through a GUI. +qt6ct/qt5ct are often advertised a fix for this, but they're both archived for +some reason. Fortunately, [lxqt-qtplugin](https://github.com/lxqt/lxqt-qtplugin) +works regardless of DE and has a simple configuration file format. This isn't +really documented or advertised, but I did some digging into its code and I +figured out how to use it. I'm personally using it alongside Sway, but it should +work alongside any WM of your choice. + +It's two simple steps. + +1. Create `~/.config/Kvantum/kvantum.kvconfig` and modify it. + +This is self-explanatory. + +``` +[General] +theme=KvSimplicityDark +``` + +Just put the name of your Kvantum theme there. If you want to select or preview +the available themes with a fancy GUI, `kvantummanager` and `kvantumpreview` +should be available (if you installed Kvantum, of course). + +2. Create `~/.config/lxqt/lxqt.conf` and modify it. + +This is mostly self-explanatory. + +``` +[General] +icon_theme=Papirus-Dark + +[Qt] +font="Sans Serif,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +``` + +If you're wondering about the weird font formatting, look up QFont. It's how QT +reads font data. To make it simple, just copy this value, replacing "Sans Serif" +with your desired font and "12" with your desired point size. + +2. Set `QT_QPA_PLATFORMTHEME=lxqt`. + +And you're done! + +Obviously, make sure lxqt-qtplugin and Kvantum are installed. Now everything +will look nice and pretty. If you're curious how I manage this on GNU Guix, +check out my personal set of Guix configurations, +[orchard](https://git.loquat.dev/orchard/). + +Here's how [pavucontrol-qt](https://github.com/lxqt/pavucontrol-qt) looks on my +system with this configuration. + +Before: +![Screenshot](/img/pavucontrol-qt-unthemed.webp) + +After: +![Screenshot](/img/pavucontrol-qt-themed.webp) + +Isn't that better? + +In Christ, + +Luke