htop: fix htoprc when fields is not explicitly set
When the 'fields' setting is not set in htoprc, the htop program won't read any of the settings. Provide a default value for fields in case it's not explicitly set by the user.
This commit is contained in:
parent
447f80f676
commit
e60dca7bb3
3 changed files with 47 additions and 3 deletions
|
|
@ -145,9 +145,27 @@ in {
|
|||
|
||||
home.packages = [ pkgs.htop ];
|
||||
|
||||
xdg.configFile."htop/htoprc" = mkIf (cfg.settings != { }) {
|
||||
text = concatStringsSep "\n" (mapAttrsToList formatOption cfg.settings)
|
||||
+ "\n";
|
||||
xdg.configFile."htop/htoprc" = let
|
||||
defaults = {
|
||||
fields = with fields; [
|
||||
PID
|
||||
USER
|
||||
PRIORITY
|
||||
NICE
|
||||
M_SIZE
|
||||
M_RESIDENT
|
||||
M_SHARE
|
||||
STATE
|
||||
PERCENT_CPU
|
||||
PERCENT_MEM
|
||||
TIME
|
||||
COMM
|
||||
];
|
||||
};
|
||||
|
||||
in mkIf (cfg.settings != { }) {
|
||||
text = concatStringsSep "\n"
|
||||
(mapAttrsToList formatOption (defaults // cfg.settings)) + "\n";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue