Session: replace a Qt platform theme whose plugin isn't installed
CI / test (push) Successful in 2m10s
CI / test (push) Successful in 2m10s
QT_QPA_PLATFORMTHEME=gnome left in the environment without QGnomePlatform made Qt load no platform theme, so KF6 apps got a light Breeze palette while the Breeze style and Dolphin's view read the dark kdeglobals colors: Dolphin's rows alternated near-black (with dark text) and light. chandra-session now keeps a preset theme only if its plugin exists for Qt 6 or 5, else picks kde / xdgdesktopportal as before. Reproduced and checked with Dolphin 26.08 / Qt 6.11 / KF 6.32 headless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hivwxSsQ56aGGv4cFQ
This commit is contained in:
2 files changed
+24
-2
No files matched your search
+21
-1
@@ -59,7 +59,10 @@ export SDL_VIDEODRIVER=wayland
|
||||
# 6 apps such as KWrite then pick Breeze Light). Prefer KDE's own (plasma-integration: reads the
|
||||
# kdeglobals colors chandra-kde-colors writes and repaints live when the switch flips), else Qt's
|
||||
# xdgdesktopportal theme (Qt 6.5+ follows the portal's color-scheme, which the compositor serves,
|
||||
# and KDE Frameworks apps then pick Breeze Dark/Light). A value set elsewhere (qt6ct, say) wins.
|
||||
# and KDE Frameworks apps then pick Breeze Dark/Light). A value set elsewhere (qt6ct, say) wins,
|
||||
# unless its plugin isn't installed: QT_QPA_PLATFORMTHEME=gnome left over from a GNOME setup
|
||||
# without QGnomePlatform makes Qt load no theme at all, and Dolphin then mixes a light palette with
|
||||
# the dark kdeglobals colors (near-black rows with dark text).
|
||||
qt_theme_plugin() { # QT_MAJOR GLOB -> success if a platform theme plugin matching GLOB exists
|
||||
for d in /usr/lib/qt$1/plugins /usr/lib64/qt$1/plugins /usr/lib/*-linux-gnu*/qt$1/plugins \
|
||||
/usr/lib/qt/plugins /usr/lib64/qt/plugins /usr/local/lib/qt$1/plugins; do
|
||||
@@ -67,6 +70,23 @@ qt_theme_plugin() { # QT_MAJOR GLOB -> success if a platform theme plugin match
|
||||
done
|
||||
return 1
|
||||
}
|
||||
qt_theme_installed() { # KEY -> failure if we know KEY's plugin and it is installed for neither Qt
|
||||
case "$1" in
|
||||
kde) g='KDEPlasmaPlatformTheme*.so' ;;
|
||||
xdgdesktopportal|flatpak|snap) g='libqxdgdesktopportal.so' ;;
|
||||
gtk3) g='libqgtk3.so' ;;
|
||||
gnome) g='*gnomeplatform*.so' ;;
|
||||
lxqt) g='libqtlxqt.so' ;;
|
||||
qt6ct) g='libqt6ct.so' ;;
|
||||
qt5ct) g='libqt5ct.so' ;;
|
||||
*) return 0 ;; # a theme we don't know: trust it
|
||||
esac
|
||||
qt_theme_plugin 6 "$g" || qt_theme_plugin 5 "$g"
|
||||
}
|
||||
if [ -n "${QT_QPA_PLATFORMTHEME:-}" ] && ! qt_theme_installed "$QT_QPA_PLATFORMTHEME"; then
|
||||
echo "chandra-session: QT_QPA_PLATFORMTHEME=$QT_QPA_PLATFORMTHEME has no plugin installed; picking one" >&2
|
||||
unset QT_QPA_PLATFORMTHEME
|
||||
fi
|
||||
if [ -z "${QT_QPA_PLATFORMTHEME:-}" ]; then
|
||||
if qt_theme_plugin 6 'KDEPlasmaPlatformTheme6.so'; then
|
||||
export QT_QPA_PLATFORMTHEME=kde
|
||||
|
||||
Reference in new issue
Block a user