mirror of
https://github.com/danth/stylix
synced 2024-11-10 06:34:15 +00:00
kde: apply Qt theme on non-KDE systems and add Qt6 support (#367)
This commit is contained in:
parent
29148118cc
commit
6bbae4f85b
1 changed files with 65 additions and 38 deletions
|
@ -219,53 +219,80 @@ let
|
|||
printf '%s\n' "$kded5rc" >"$out/kded5rc"
|
||||
printf '%s\n' "$kdeglobals" >"$out/kdeglobals"
|
||||
'';
|
||||
|
||||
envVars = {
|
||||
QT_QPA_PLATFORMTHEME = "kde";
|
||||
QT_STYLE_OVERRIDE = "breeze";
|
||||
};
|
||||
|
||||
in {
|
||||
options.stylix.targets.kde.enable =
|
||||
config.lib.stylix.mkEnableTarget "KDE" true;
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.kde.enable && pkgs.stdenv.hostPlatform.isLinux) {
|
||||
home.packages = [ themePackage ];
|
||||
xdg.systemDirs.config = [ "${configPackage}" ];
|
||||
xdg = {
|
||||
systemDirs.config = [ "${configPackage}" ];
|
||||
configFile."kdeglobals".text = "${formatConfig colorscheme}";
|
||||
};
|
||||
|
||||
# plasma-apply-wallpaperimage is necessary to change the wallpaper
|
||||
# after the first login.
|
||||
#
|
||||
# plasma-apply-lookandfeel is only here to trigger a hot reload, the theme
|
||||
# would still be applied without it if you logged out and back in.
|
||||
#
|
||||
# Home Manager clears $PATH before running the activation script, but we
|
||||
# want to avoid installing these tools explicitly because that would pull
|
||||
# in large dependencies for people who aren't actually using KDE.
|
||||
# The workaround used is to assume a list of common paths where the tools
|
||||
# might be installed, and look there. The ideal solution would require
|
||||
# changes to KDE to make it possible to update the wallpaper through
|
||||
# config files alone.
|
||||
home.activation.stylixLookAndFeel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
global_path() {
|
||||
for directory in /run/current-system/sw/bin /usr/bin /bin; do
|
||||
if [[ -f "$directory/$1" ]]; then
|
||||
printf '%s\n' "$directory/$1"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
systemd.user.sessionVariables = envVars;
|
||||
|
||||
return 1
|
||||
}
|
||||
qt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
if wallpaper_image="$(global_path plasma-apply-wallpaperimage)"; then
|
||||
"$wallpaper_image" "${themePackage}/share/wallpapers/stylix"
|
||||
else
|
||||
verboseEcho \
|
||||
"plasma-apply-wallpaperimage: command not found"
|
||||
fi
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
themePackage
|
||||
|
||||
if look_and_feel="$(global_path plasma-apply-lookandfeel)"; then
|
||||
"$look_and_feel" --apply stylix
|
||||
else
|
||||
verboseEcho \
|
||||
"Skipping plasma-apply-lookandfeel: command not found"
|
||||
fi
|
||||
'';
|
||||
# QT6 packages (note that full does not mean "install all of KDE", just all of Qt6)
|
||||
(hiPrio kdePackages.full)
|
||||
(hiPrio kdePackages.breeze-icons)
|
||||
(hiPrio kdePackages.breeze)
|
||||
(hiPrio kdePackages.plasma-integration)
|
||||
(hiPrio kdePackages.qqc2-breeze-style)
|
||||
(hiPrio kdePackages.qqc2-desktop-style)
|
||||
|
||||
# QT5 packages
|
||||
libsForQt5.full
|
||||
libsForQt5.breeze-icons
|
||||
libsForQt5.breeze-qt5
|
||||
libsForQt5.qqc2-breeze-style
|
||||
libsForQt5.qqc2-desktop-style
|
||||
libsForQt5.plasma-integration
|
||||
];
|
||||
|
||||
sessionVariables = envVars;
|
||||
|
||||
# plasma-apply-wallpaperimage is necessary to change the wallpaper
|
||||
# after the first login.
|
||||
#
|
||||
# Home Manager clears $PATH before running the activation script, but we
|
||||
# want to avoid installing these tools explicitly because that would pull
|
||||
# in large dependencies for people who aren't actually using KDE.
|
||||
# The workaround used is to assume a list of common paths where the tools
|
||||
# might be installed, and look there. The ideal solution would require
|
||||
# changes to KDE to make it possible to update the wallpaper through
|
||||
# config files alone.
|
||||
activation.stylixLookAndFeel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
global_path() {
|
||||
for directory in /run/current-system/sw/bin /usr/bin /bin; do
|
||||
if [[ -f "$directory/$1" ]]; then
|
||||
printf '%s\n' "$directory/$1"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if wallpaper_image="$(global_path plasma-apply-wallpaperimage)"; then
|
||||
"$wallpaper_image" "${themePackage}/share/wallpapers/stylix"
|
||||
else
|
||||
verboseEcho \
|
||||
"plasma-apply-wallpaperimage: command not found"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue