You are not logged in.
I use KDE/Plasma for my daily basis, but I'm trying i3wm these days, because I like how lightweight it is and the whole concept of having different apps opened at different workspaces; but the aesthetics of apps on i3wm are terrible, and I need qt5ct/qt6ct to make them look good (although not as good as on plasma). But the issue is that this configuration is affecting my plasma configuration, making it horrible too. How can I make these two live together?
Create a .xprofile, and source the script:
#!/bin/bash
CURRENT_DESKTOP=$(echo "$XDG_CURRENT_DESKTOP")
if [[ "$CURRENT_DESKTOP" = "i3" ]]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_SCREEN_SCALE_FACTORS=1.5 # 1.5
export QT_AUTO_SCREEN_SCALE_FACTOR=0
elif [[ "$CURRENT_DESKTOP" = "KDE" ]]; then
unset QT_QPA_PLATFORMTHEME
export QT_AUTO_SCREEN_SCALE_FACTOR=1
else
echo "Gestor de ventanas no es i3 ni kwin: $CURRENT_DESKTOP"
fi
echo $CURRENT_DESKTOP
echo $QT_QPA_PLATFORMTHEME
echo $QT_SCREEN_SCALE_FACTORS
echo $QT_AUTO_SCREEN_SCALE_FACTOR
Last edited by moshpirit (2024-03-05 04:08:33)
Offline
Did you see my response in the other thread you posted in?
Unset/set the QT_QPA_PLATFORMTHEME=qt5ct depending on which environment you log in, or see https://wiki.archlinux.org/title/Qt#Con … KDE_Plasma as there's apparently a qt5ct-kde which has some patches for better KDE integration.
Offline
Hi! Thanks for replying! I've installed qt5ct-kde, but it doesn't convince me how it looks on plasma, so I'm getting along with the set/unset plan by adding
if [ "$(echo "$XDG_CURRENT_DESKTOP")" = "i3" ]; then
QT_QPA_PLATFORMTHEME=qt5ct
fi
to /etc/environment, but it doesn't seem to work.
Also, I tried with a script and executing it at autostart:
#!/bin/bash
if [ "$(echo "$XDG_CURRENT_DESKTOP")" = "i3" ]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
elif [ "$(echo "$XDG_CURRENT_DESKTOP")" = "KDE" ]; then
export QT_QPA_PLATFORMTHEME=" "
fi
export QT_QPA_PLATFORMTHEME=" "
When I export the variable in a terminal (export QT_QPA_PLATFORMTHEME=qt5ct), it works, but not when it's executed from the script (which has execution permission, btw)
To check if it's working, I run the command qt5tc, which shows a warning.
Offline
I have, I created this post because I didn't think the other one would get any responses. Thank you!
Offline
/etc/environment is not a bash shell and can't be used for shell scripting.
In which autostart did you put said script? it needs to be in a path where things are being logically passed down. The canonical "global" path is /etc/profile but I'm not sure whether that's not too early for XDG_CURRENT_DESKTOP to be set. FWIW I'd say set it to qt5ct by default and for plasma you can override it by putting the script doing the relevant export into ~/.config/plasma-workspace/env
It's better to discuss this in a new topic and letting the 2 year old one rest, I'll merge the responses over,
Last edited by V1del (2024-02-25 23:56:27)
Offline
I created this file at /home/alberto/.config/autostart/qt6ct.sh.desktop though the Plasma Autostart Manager:
[Desktop Entry]
Comment[es_ES]=
Comment=
Exec=/home/alberto/.config/i3/scripts/qt6ct.sh
GenericName[es_ES]=
GenericName=
Icon=dialog-scripts
MimeType=
Name[es_ES]=qt6ct.sh
Name=qt6ct.sh
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-AutostartScript=true
X-KDE-SubstituteUID=false
X-KDE-Username=
And here's the script (~/.config/i3/scripts/qt6ct.sh):
#!/bin/bash
# usar qt5ct o qt6ct fastidia la configuración de Plasma, por eso, solo debe ejecutarse si estoy usando i3.
# Si estás usando i3wm, establecer QT_QPA_PLATFORMTHEME en "qt6ct"
if [ "$(echo "$XDG_CURRENT_DESKTOP")" = "i3" ]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
elif [ "$(echo "$XDG_CURRENT_DESKTOP")" = "KDE" ]; then
# Si estás usando Plasma (KDE), comentar la línea que exporta la variable
export QT_QPA_PLATFORMTHEME=" "
fi
export QT_QPA_PLATFORMTHEME=" "
FWIW I'd say set it to qt5ct by default and for plasma you can override it by putting the script doing the relevant export into ~/.config/plasma-workspace/env/
What do you mean? like inserting this script at ~/.config/plasma-workspace/env/?
#!/bin/bash
export QT_QPA_PLATFORMTHEME=" "
Last edited by moshpirit (2024-02-26 10:34:05)
Offline
Hmm, I've just found something interesting (screenshot):
➤ ~/.config/i3/scripts/qt6ct.sh
i3
qt5ct
➤ echo "$QT_QPA_PLATFORMTHEME"
➤
So the script that I run when I start up, doesn't really export anything at all.
I have searched on every file that I thought could be exporting it as a null value (~/.bashrc, ~/.profile, ~/.bash_profile, ~/.xinitrc, ~/.Xresources, /etc/environment, /root/.profile, /root/.bashrc), but everything looks fine (no QT_QPA_PLATFORMTHEME anywhere, or is commented).
I also added this to i3 config file:
exec ~/.config/i3/scripts/qt6ct.sh
exec source ~/.config/i3/scripts/qt6ct.sh
---------
Here's the script now:
#!/bin/bash
# usar qt5ct o qt6ct fastidia la configuración de Plasma, por eso, solo debe ejecutarse si estoy usando i3.
# Si estás usando i3wm, establecer QT_QPA_PLATFORMTHEME en "qt6ct"
CURRENT_DESKTOP=$(echo "$XDG_CURRENT_DESKTOP")
if [ "$CURRENT_DESKTOP"="i3" ]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
elif [ "$CURRENT_DESKTOP"="KDE" ]; then
# Si estás usando Plasma (KDE), comentar la línea que exporta la variable
unset QT_QPA_PLATFORMTHEME
else
echo "Gestor de ventanas no es i3 ni kwin: $CURRENT_DESKTOP"
fi
echo $CURRENT_DESKTOP
echo $QT_QPA_PLATFORMTHEME
EDIT: I fixed the spaces before and after "=", so the script works fine now, but I found something interesting here:
➤ ~/.config/i3/scripts/qt6ct.sh
i3
qt5ct
➤ echo "$QT_QPA_PLATFORMTHEME"
➤ ~/.config/i3/scripts/qt6ct.sh
i3
qt5ct
➤ source ~/.config/i3/scripts/qt6ct.sh
i3
qt5ct
➤ echo "$QT_QPA_PLATFORMTHEME"
qt5ct
I added source ~/.config/i3/scripts/qt6ct.sh at .profile, and logout. When I logged in, nothing has changed. I don't know why, since when I manually run it, it apparently changes the value of QT_QPA_PLATFORMTHEME.
After doing all of that, Qt apps doesn't seem affected at all, when I open the qt5ct application from Rofi, it keeps showing me the same warning (something like: The QT_QPA_PLATFORMTHEME environment variable has not been set (required values: qt5ct or qt6ct)).
AFTER I do all of this, if I run qt5ct or run rofi --show -drun and then select the qt5ct app, then it works just fine. The same happens with dolphin: if I run it from rofi, then it looks awful, but if I run it from the terminal, it looks great. BUT if I close the terminal and open it again, everything goes back to normal (meaning: awful).
After including source ~/.config/i3/scripts/qt6ct.sh to /etc/environment and rebooting to see if anything changed: nope. No changes, the problem persists.
Last edited by moshpirit (2024-03-05 01:31:44)
Offline
[removed]
Last edited by moshpirit (2024-03-05 03:04:16)
Offline
FIXED IT!!
The only thing I needed was creating a .xprofile file and sourcing this script:
#!/bin/bash
CURRENT_DESKTOP=$(echo "$XDG_CURRENT_DESKTOP")
if [[ "$CURRENT_DESKTOP" = "i3" ]]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_SCREEN_SCALE_FACTORS=1.5 # 1.5
export QT_AUTO_SCREEN_SCALE_FACTOR=0
elif [[ "$CURRENT_DESKTOP" = "KDE" ]]; then
unset QT_QPA_PLATFORMTHEME
export QT_AUTO_SCREEN_SCALE_FACTOR=1
else
echo "Gestor de ventanas no es i3 ni kwin: $CURRENT_DESKTOP"
fi
echo $CURRENT_DESKTOP
echo $QT_QPA_PLATFORMTHEME
echo $QT_SCREEN_SCALE_FACTORS
echo $QT_AUTO_SCREEN_SCALE_FACTOR
Last edited by moshpirit (2024-03-05 04:03:42)
Offline
FIXED IT!!
The only thing I needed was creating a .xprofile file and sourcing this script:
#!/bin/bash CURRENT_DESKTOP=$(echo "$XDG_CURRENT_DESKTOP") if [[ "$CURRENT_DESKTOP" = "i3" ]]; then export QT_QPA_PLATFORMTHEME="qt5ct" export QT_SCREEN_SCALE_FACTORS=1.5 # 1.5 export QT_AUTO_SCREEN_SCALE_FACTOR=0 elif [[ "$CURRENT_DESKTOP" = "KDE" ]]; then unset QT_QPA_PLATFORMTHEME export QT_AUTO_SCREEN_SCALE_FACTOR=1 else echo "Gestor de ventanas no es i3 ni kwin: $CURRENT_DESKTOP" fi echo $CURRENT_DESKTOP echo $QT_QPA_PLATFORMTHEME echo $QT_SCREEN_SCALE_FACTORS echo $QT_AUTO_SCREEN_SCALE_FACTOR
Hey! I'm facing the exact same Issue. How are you sourcing your script ? I always had a
.xprofile
file with the following content.
if [[ "$XDG_CURRENT_DESKTOP" = "i3" ]]; then
export QT_QPA_PLATFORMTHEME="qt5ct"
fi
And it worked like a charm, do I need to change something else ?
Offline