-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add module to manage konsole and it's profiles #69
Conversation
So far the module can only set the default profile, I'm working rn on generating profiles |
Sorry for the wait btw, things got in the way |
I think #72 fixes the check that's failing, it shouldn't be my fault |
Also @magnouvean I have noticed that after removing something from |
If you are talking about keys I think that is what has always been the case (unless you use |
Sorry that was my bad. I have included a fix in the mentioned PR. |
It seems like it passes with the tests updated at least :) |
Trying to add an assertion in case you set the font size without a name since konsole doesn't support that, but I can't get it to work. This is what I tried: config = mkIf (config.programs.plasma.enable && cfg.enable) {
assertions = [
{
assertion = ((builtins.isInt cfg.font.size) && (builtins.isNull cfg.font.name));
message = "You cannot change the font size without specifying a font!";
}
];
...
} |
Shouldn't it be the opposite, i.e. you assert that |
Can't wrap my head about it, this is what I have so far: diff --git a/modules/apps/konsole.nix b/modules/apps/konsole.nix
index 111592a..c9f3f9d 100644
--- a/modules/apps/konsole.nix
+++ b/modules/apps/konsole.nix
@@ -43,6 +43,14 @@ let
};
};
};
+
+ # Some helper functions
+
+ # Takes a profile and returns true if there's no font set
+ isFontMissing = (value: builtins.isNull value.font.name);
+
+ # Takes a profile and returns true if there is a font size set
+ isFontSizeSet = (value: builtins.isInt value.font.size);
};
in
@@ -79,7 +87,18 @@ in
}
)
];
-
+ assertions = [
+ {
+ # assertion = !((builtins.isInt profilesSubmodule.font.size) && (builtins.isNull profilesSubmodule.font.name));
+
+ assertion = (
+ lib.lists.any (
+ value: !((isFontMissing value) && (isFontSizeSet value))
+ ) (lib.attrsets.attrValues cfg.profiles)
+ );
+ message = "You cannot change the font size without specifying a font!";
+ }
+ ];
# Konsole is fine with using symlinked profiles so I'll use the home-manager way
programs.plasma.dataFile = mkIf (cfg.profiles != {}) (
mkMerge ([ |
Maybe:
|
No, that doesn't seem to work either :( |
Sounds good, I may try to make a separate pr when I have time, but this can be merged before that anyway I think |
Think this should be enough settings for most people |
Maybe adding an option to configure general konsolerc settings would be nice as well. I think it would be better to have this built in here rather than to have to configure this separately via the lower-level settings. Could do a separate pr for it though, but it should be quite simple (just adding an option for it and adding to the mkMerge). |
So something like the EDIT: I didn't add more options for konsole itself since I figured most of what people want to change is in the profiles, and not on konsole. That said if there is something that I didn't think about I can add that too |
Also I have realized that I the format for the profiles is close enough to an INI file that I might be able to get away with using |
Yeah, basically the same as the home-manager options would be good. |
Ok, this should be good enough for now, I'll mark it as ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments. I also saw that some of the descriptions are missing a period at the end. Other than that this looks good!
Oh also @magnouvean |
Good to know. I reckon though that if you feel like this pr is good now it can be merged without thinking about #94, and I'll tweak this module in that pr (it should be easy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
No description provided.