Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kde: apply Qt theme on non-KDE systems and add Qt6 support #367

Merged
merged 26 commits into from
Jul 19, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5386b7e
Fix plasma theme not applying on non-KDE systems
Jackaed May 15, 2024
dcee93c
Replace plasma-workspace with xdg.configFile (#1)
Jackaed May 16, 2024
fed3e72
Merge branch 'danth:master' into master
Jackaed Jun 11, 2024
e38a551
Merge branch 'danth:master' into master
Jackaed Jun 24, 2024
c1884fa
Merge branch 'danth:master' into master
Jackaed Jun 28, 2024
f20776e
Use qt.platformTheme.name instead of qt.platformTheme
Jackaed Jul 12, 2024
c42f705
Add kdepackages required for qt6
Jackaed Jul 13, 2024
7a4d18c
Fix bug
Jackaed Jul 13, 2024
c68a45b
Further improvements to add qt6 support
Jackaed Jul 13, 2024
a97b120
Further improvements to add qt6 support
Jackaed Jul 13, 2024
3eb2528
Further improvements to add qt6 support
Jackaed Jul 13, 2024
dee9f03
Further improvements to add qt6 support
Jackaed Jul 13, 2024
0fdfb16
Further improvements to add qt6 support
Jackaed Jul 13, 2024
636ef17
Further improvements to add qt6 support
Jackaed Jul 13, 2024
ca7141d
Further improvements to add qt6 support
Jackaed Jul 13, 2024
fe460ae
Further improvements to add qt6 support
Jackaed Jul 13, 2024
5c8d0a2
Try and get breeze-icons working on qt6
Jackaed Jul 13, 2024
4ffcbf3
Try and get breeze-icons working on qt6
Jackaed Jul 13, 2024
9466925
Try and get breeze-icons working on qt6
Jackaed Jul 13, 2024
f9d19fc
Finally get Qt6 working correctly
Jackaed Jul 13, 2024
a59f0bb
Merge branch 'danth:master' into master
Jackaed Jul 13, 2024
787df15
Add env vars to systemd session variables
Jackaed Jul 14, 2024
344ab01
Add env vars to systemd session variables
Jackaed Jul 14, 2024
6fa3489
Add env vars to systemd session variables
Jackaed Jul 14, 2024
1561596
Re-do to have a diff that isn't horrific
Jackaed Jul 15, 2024
e728d79
Add theming for Qt Quick Controls (fixes systemsettings and other app…
Jackaed Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 69 additions & 42 deletions modules/kde/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}" ];

# 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

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

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
'';
xdg = {
systemDirs.config = [ "${configPackage}" ];
configFile."kdeglobals".text = "${formatConfig colorscheme}";
};

systemd.user.sessionVariables = envVars;

qt = {
enable = true;
};

home = {
packages = with pkgs; [
themePackage

# 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
'';
};
};
}