From 095d7b698944ead485b650a4b33d29cde6ceeb0c Mon Sep 17 00:00:00 2001 From: Toast <39011842+toast003@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:51:21 +0100 Subject: [PATCH] Generate konsole profiles using generators.toINI --- modules/apps/konsole.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/apps/konsole.nix b/modules/apps/konsole.nix index 76333c31..eaf6d276 100644 --- a/modules/apps/konsole.nix +++ b/modules/apps/konsole.nix @@ -5,6 +5,7 @@ with lib; let cfg = config.programs.konsole; profilesSubmodule = { + # TODO: don't set null as the defaults, toINI doesn't like it options = { name = mkOption { type = with types; nullOr str; @@ -126,7 +127,7 @@ in ) ]; - programs.plasma.dataFile = mkIf (cfg.profiles != {}) ( + xdg.dataFile = mkIf (cfg.profiles != {}) ( mkMerge ([ ( mkMerge ( @@ -134,21 +135,22 @@ in attrName: profile: let # Use the name from the name option if it's set - profileName = if builtins.isString profile.name then profile.name else attrName; + profileName = if builtins.isString profile.name then profile.name else attrName; + fontString = mkIf (profile.font.name != null) "${profile.font.name},${builtins.toString profile.font.size}"; in { - "konsole/${profileName}.profile" = { + "konsole/${profileName}.profile".text = lib.generators.toINI {} { "General" = { - "Command" = profile.command; + "Command" = (mkIf (profile.command != null) profile.command).content; "Name" = profileName; # Konsole generated profiles seem to allways have this "Parent" = "FALLBACK/"; }; "Appearance" = { - "ColorScheme" = profile.colorScheme; + "ColorScheme" = (mkIf (profile.colorScheme != null) profile.colorScheme).content; # If the font size is not set we leave a comma a the end after the name # We should fix this probs but konsole doesn't seem to care ¯\_(ツ)_/¯ - "Font" = with profile.font; "${name},${builtins.toString size}"; + "Font" = fontString.content; }; }; }