Uniform look for Qt and GTK

Hi
I had to install Okular to be able to annotate pdf’s
I want to get it to follow the GTK Adwaita-dark widget theme I use on my system
I followed this
https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications
Since I got this:

leigh@T16-AL ~ % qmake --version          
QMake version 3.1
Using Qt version 5.15.9 in /usr/lib

I installed adwaita-qt5

and then ran the following in a terminal and then rebooted

QT_STYLE_OVERRIDE=adwaita

But okular was still in the wrong theme (a light one)

Could someone please tell me what I am doing wrong / what I have missed

Is setting the ENV variables not so straightforward?

Did you log out/log in?
Edit - never mind, I see now you rebooted.

What window manager are you using? Towards the end of that page you linked there are some window manager specific Tips and Tricks.

2 Likes
leigh@T16-AL ~ % neofetch
                   -`                    leigh@T16-AL 
                  .o+`                   ------------ 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: 21BVCTO1WW ThinkPad T16 Gen 1 
               `+oooooo:                 Kernel: 6.3.3-arch1-1 
               -+oooooo+:                Uptime: 19 mins 
             `/:-:++oooo+:               Packages: 1112 (pacman) 
            `/++++/+++++++:              Shell: zsh 5.9 
           `/++++++++++++++:             Resolution: 1920x1200, 1920x1080 
          `/+++ooooooooooooo/`           WM: i3 
         ./ooosssso++osssssso+`          Theme: Adwaita-dark [GTK2/3] 
        .oossssso-````/ossssss+`         Icons: ArchLabs-Dark [GTK2/3] 
       -osssssso.      :ssssssso.        Terminal: xfce4-terminal 
      :osssssss/        osssso+++.       Terminal Font: Monospace 12 
     /ossssssss/        +ssssooo/-       CPU: 12th Gen Intel i7-1255U (12) @ 4.700GHz 
   `/ossssso+/:-        -:/+osssso+-     GPU: Intel Alder Lake-UP3 GT2 [UHD Graphics] 
  `+sso+:-`                 `.-/+oso:    Memory: 2677MiB / 15695MiB 
 `++:.                           `-/+/
 .`                                 `/

@leigh

Maybe this helps.

https://discovery.endeavouros.com/applications/uniform-theme-and-fonts-for-qt-apps-in-gtk-environments/2021/05/

3 Likes

Alot of work @leigh. I think the theming differences is one of the allures of a WM.

For anyone with OCD, it’s a rough ride! :exploding_head:

2 Likes

I think I was being completely naive by thinking that this would work?

How do I set the environment variable?
include a line in .zshrc?

1 Like

How do you log in?

I think you can add that line to ~/.zprofile (although, either may work)
Before the auto login command.

And it may need to be:

export QT_STYLE_OVERRIDE=adwaita

2 Likes

Thanks,

yes it was export and I added it to .zshrc and it was working in terms of setting environment variables which I checked using printenv

  • I learned something new :slight_smile:

But, I now know that its just not really working well

by using qt5ct I could see that adwaita-qt5 did include the adwaita-dark theme I wanted and I set that (as well as icons to archlabs-dark)

Then, instead of resetting another environment variable I just used the following to try okular in it:

okular --platformtheme qt5ct

It looked like the icon theme was changed as I selected in qt5ct but the adwaita dark wasnt being set.
However, closer inspection showed that it was ‘trying’ since some buttons were dark, but not really doing it

fuck this fannying around - I am going to use okular in light mode :rofl:

1 Like

This is weird:
I set this variable in .zshrc then rebooted, but got this using qt5ct, even though the variable is seen to be set:

Unfortunately, that didnt work either :frowning:
But thanks for helping

1 Like

If I understand correctly, then another possibility might be:

export QT_QPA_PLATFORMTHEME=gtk2 && okular

2 Likes

Thanks, but ‘Nope’
Also that makes opening a terminal open an instance of okular and the terminal is blank for some reason

Sorry, that line was for use in a terminal.

export QT_QPA_PLATFORMTHEME=gtk2

would probably be just to export.

no need for sorry, I am sure I should have realised that

But it still doesnt work

I wonder if I should find another Linux pdf app that allows annotations

Bugger, I just had a thought, I hope the Okular notes are readable in windows or my student wont see my annotations I made on her thesis that took all day. :scream:

Edit: TFFT!!! They are all in there in windows using Adobe Acrobat Reader. Phew

1 Like

DOH!
I did try evince but missed the little notes icon in the bottom of the side pain and the amazingly simple Gnome-type interface meant I couldnt find it in dropdown menu

so, no more Qt - its evince not okular!

problem solved laterally :smiley:

But I did learn a bit about environment variables on the way

Thanks all!

3 Likes