Apply suggestions from code review

Co-authored-by: Heitor Augusto <IAm.HeitorALN@proton.me>
This commit is contained in:
Sergei Gureev 2024-08-23 00:44:23 +03:00 committed by GitHub
parent 0aab9f4b19
commit aa17e6b456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 13 deletions

View File

@ -31,12 +31,12 @@
# Values are taken from
# https://invent.kde.org/plasma/kdeplasma-addons/-/blob/bc53d651cf60709396c9229f8c582ec8a9d2ee53/applets/mediaframe/package/contents/ui/ConfigGeneral.qml#L148-170
wallpaperFillModeTypes = {
"Stretch" = 0; # a.k.a. Scaled
"PreserveAspectFit" = 1; # a.k.a. Scaled Keep Proportions
"PreserveAspectCrop" = 2; # a.k.a. Scaled And Cropped
"Tile" = 3;
"TileVertically" = 4;
"TileHorizontally" = 5;
"Pad" = 6; # a.k.a. Centered
"stretch" = 0; # a.k.a. Scaled
"preserveAspectFit" = 1; # a.k.a. Scaled Keep Proportions
"preserveAspectCrop" = 2; # a.k.a. Scaled And Cropped
"tile" = 3;
"tileVertically" = 4;
"tileHorizontally" = 5;
"pad" = 6; # a.k.a. Centered
};
}

View File

@ -213,7 +213,7 @@ in
"\"" + (builtins.toString path) + "\"" else
"[" + (builtins.concatStringsSep "," (map (s: "\"" + s + "\"") path)) + "]"});
desktop.writeConfig("SlideInterval", "${builtins.toString cfg.workspace.wallpaperSlideShow.interval}");
desktop.writeConfig("FillMode", "${builtins.toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}}");
${lib.optionalString (cfg.workspace.wallpaperFillMode != null) ''desktop.writeConfig("FillMode", "${builtins.toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}}");''}
}
'' else "");
wallpaperPOTD = (if (cfg.workspace.wallpaperPictureOfTheDay != null) then ''
@ -224,7 +224,7 @@ in
desktop.currentConfigGroup = ["Wallpaper", "org.kde.potd", "General"];
desktop.writeConfig("Provider", "${cfg.workspace.wallpaperPictureOfTheDay.provider}");
desktop.writeConfig("UpdateOverMeteredConnection", "${if (cfg.workspace.wallpaperPictureOfTheDay.updateOverMeteredConnection) then "1" else "0"}");
desktop.writeConfig("FillMode", "${builtins.toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}}");
${lib.optionalString (cfg.workspace.wallpaperFillMode != null) ''desktop.writeConfig("FillMode", "${builtins.toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}}");''}
}
'' else "");
wallpaperPlainColor = (if (cfg.workspace.wallpaperPlainColor != null) then ''

View File

@ -164,10 +164,10 @@ in
'';
};
wallpaperFillMode = with lib.types; lib.mkOption {
type = enum (lib.attrNames wallpaperFillModeTypes);
default = "Stretch";
example = "PreserveAspectFit";
wallpaperFillMode = lib.mkOption {
type = with lib.types; nullOr (enum (builtins.attrNames wallpaperFillModeTypes));
default = null;
example = "stretch";
description = ''
Defines how the wallpaper should be displayed on the screen.
Applies only to wallpaperPictureOfTheDay or wallpaperSlideShow.