#!/usr/bin/env bash # Regenerates qt6ct's config + color scheme to match the current Quickshell # theme, the Qt-side equivalent of gtk-theme-set. Qt apps (Gwenview, Ark, # Kate, ...) had no working platform theme plugin at all before this — the # QT_QPA_PLATFORMTHEME=qt6ct env var (hyprland.conf) was pointing at a # plugin that wasn't even installed, so every Qt app fell back to # whatever default style/palette it shipped with, ignoring the rest of # the desktop entirely. style=Fusion (not a KDE/Breeze style) matters # specifically: Fusion paints straight from QPalette, so a custom color # scheme here is guaranteed to actually show — Breeze-family styles # prefer reading colors from kdeglobals instead, which is a separate, # static, unrelated leftover file on this machine. set -euo pipefail accent="${1:?usage: qt-theme-set }" bg="${2:?bg required}" bg_alt="${3:?bgAlt required}" fg="${4:?fg required}" fg_dim="${5:?fgDim required}" border="${6:?border required}" dark="${7:?dark required}" dir="$HOME/.config/qt6ct" mkdir -p "$dir/colors" # qt6ct color scheme files store QPalette::ColorRole values as a fixed- # order, comma-separated #aarrggbb list — order and format verified # against the example schemes qt6ct itself ships # (share/qt6ct/colors/darker.conf etc.), not guessed: WindowText, Button, # Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Window, # Shadow, Highlight, HighlightedText, Link, LinkVisited, AlternateBase, # NoRole, ToolTipBase, ToolTipText, PlaceholderText. a() { printf '#ff%s' "${1#\#}"; } # opaque t() { printf '#80%s' "${1#\#}"; } # translucent, for PlaceholderText active="$(a "$fg"), $(a "$bg_alt"), $(a "$border"), $(a "$bg_alt"), $(a "$bg"), $(a "$border"), $(a "$fg"), $(a "$fg"), $(a "$fg"), $(a "$bg"), $(a "$bg"), $(a "$border"), $(a "$accent"), $(a "$bg"), $(a "$accent"), $(a "$accent"), $(a "$bg_alt"), $(a "$bg"), $(a "$bg_alt"), $(a "$fg"), $(t "$fg_dim")" disabled="$(a "$fg_dim"), $(a "$bg_alt"), $(a "$border"), $(a "$bg_alt"), $(a "$bg"), $(a "$border"), $(a "$fg_dim"), $(a "$fg_dim"), $(a "$fg_dim"), $(a "$bg"), $(a "$bg"), $(a "$border"), $(a "$accent"), $(a "$fg_dim"), $(a "$accent"), $(a "$accent"), $(a "$bg_alt"), $(a "$bg"), $(a "$bg_alt"), $(a "$fg_dim"), $(t "$fg_dim")" color_file="$dir/colors/quickshell-theme.conf" cat > "$color_file" < "$dir/qt6ct.conf" < "$HOME/.config/kdeglobals" <