Add more persistent keys for colorschemes in kdeglobals (#180)

This commit is contained in:
magnouvean 2024-06-01 13:14:46 +02:00 committed by GitHub
parent 2636bb4c06
commit 41f42c35f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 63 additions and 7 deletions

47
lib/colorscheme.nix Normal file
View File

@ -0,0 +1,47 @@
{ lib, ... }:
let
colorEffectsKeys = [
"ChangeSelectionColor"
"Color"
"ColorAmount"
"ColorEffect"
"ContrastAmount"
"ContrastEffect"
"Enable"
"IntensityAmount"
"IntensityEffect"
];
colorUIKeys = [
"BackgroundAlternate"
"BackgroundNormal"
"DecorationFocus"
"DecorationHover"
"ForegroundActive"
"ForegroundInactive"
"ForegroundLink"
"ForegroundNegative"
"ForegroundNeutral"
"ForegroundNormal"
"ForegroundVisited"
"regroundPositive"
];
ignoreKeys = {
"ColorEffects:Disabled" = colorEffectsKeys;
"ColorEffects:Inactive" = colorEffectsKeys;
"Colors:Button" = colorUIKeys;
"Colors:Selection" = colorUIKeys;
"Colors:Tooltip" = colorUIKeys;
"Colors:View" = colorUIKeys;
"Colors:Window" = colorUIKeys;
};
in
(lib.mkMerge
(lib.mapAttrsToList
(group: keys: {
"kdeglobals"."${group}" = (lib.mkMerge
(map
(key:
{ "${key}"."persistent" = (lib.mkDefault true); })
keys));
})
ignoreKeys))

View File

@ -171,13 +171,22 @@ in
};
# We add persistence to some keys in order to not reset the themes on
# each generation when we use overrideConfig.
programs.plasma.configFile = lib.mkIf (cfg.overrideConfig) {
kcminputrc.Mouse.cursorTheme.persistent = lib.mkDefault (cfg.workspace.cursorTheme != null);
kdeglobals.General.ColorScheme.persistent = lib.mkDefault (cfg.workspace.colorScheme != null);
kdeglobals.Icons.Theme.persistent = lib.mkDefault (cfg.workspace.iconTheme != null);
kdeglobals.KDE.LookAndFeelPackage.persistent = lib.mkDefault (cfg.workspace.lookAndFeel != null);
plasmarc.Theme.name.persistent = lib.mkDefault (cfg.workspace.theme != null);
};
programs.plasma.configFile = lib.mkIf (cfg.overrideConfig) (
let
colorSchemeIgnore = if (cfg.workspace.colorScheme != null) then (import ../lib/colorscheme.nix { inherit lib; }) else { };
in
(lib.mkMerge
[
{
kcminputrc.Mouse.cursorTheme.persistent = lib.mkDefault (cfg.workspace.cursorTheme != null);
kdeglobals.General.ColorScheme.persistent = lib.mkDefault (cfg.workspace.colorScheme != null);
kdeglobals.Icons.Theme.persistent = lib.mkDefault (cfg.workspace.iconTheme != null);
kdeglobals.KDE.LookAndFeelPackage.persistent = lib.mkDefault (cfg.workspace.lookAndFeel != null);
plasmarc.Theme.name.persistent = lib.mkDefault (cfg.workspace.theme != null);
}
colorSchemeIgnore
])
);
})
(lib.mkIf (cfg.workspace.wallpaper != null) {
# We need to set the wallpaper after the panels are created in order for