Skip to content

Commit

Permalink
refactor: add submodules to shared config
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Jan 26, 2024
1 parent 3297a2f commit 67c554f
Showing 1 changed file with 53 additions and 45 deletions.
98 changes: 53 additions & 45 deletions nix/sharedConfig.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{lib, ...}:
{ lib, ... }:
with lib; {
enable = mkEnableOption "cli to take screenshots";
copy = mkEnableOption "Copy screenshot to clipboard";
window-controls = mkEnableOption "Enable window controls";
shadow = mkEnableOption "Enable shadows";
shadow-image = mkEnableOption "Enable shadows from captured image";
fonts = mkOption {
Expand All @@ -11,11 +10,6 @@ with lib; {
example = "Hack=12.0;Noto Font Emoji=12.0;";
description = "The font used to render, format: Font Name=size;Other Font Name=12.0";
};
background = mkOption {
type = types.str;
default = "#323232";
description = "Background of image generated. Support: '#RRGGBBAA' 'h;#RRGGBBAA;#RRGGBBAA' 'v;#RRGGBBAA;#RRGGBBAA' or file path";
};
radius = mkOption {
type = types.int;
default = 15;
Expand All @@ -26,43 +20,11 @@ with lib; {
default = null;
description = "Author Name of screenshot";
};
author-color = mkOption {
type = types.str;
default = "#FFFFFF";
description = "Title bar text color";
};
window-title = mkOption {
type = lib.types.nullOr types.str;
default = null;
description = "Window title";
};
window-title-background = mkOption {
type = types.str;
default = "#4287f5";
description = "Window title bar background";
};

window-title-color = mkOption {
type = types.str;
default = "#FFFFFF";
description = "Title bar text color";
};
window-controls-width = mkOption {
type = types.int;
default = 120;
description = "Width of window controls";
};
window-controls-height = mkOption {
type = types.int;
default = 40;
description = "Height of window title/controls bar";
};
titlebar-padding = mkOption {
type = types.int;
default = 10;
description = "Padding of title on window bar";
};

padding-x = mkOption {
type = types.int;
default = 80;
Expand All @@ -73,19 +35,65 @@ with lib; {
default = 100;
description = "Padding Y of inner screenshot";
};
shadow-color = mkOption {
type = types.str;
default = "#707070";
description = "Shadow of screenshot. Support: '#RRGGBBAA' 'h;#RRGGBBAA;#RRGGBBAA' 'v;#RRGGBBAA;#RRGGBBAA' or file path";
};
shadow-blur = mkOption {
type = types.int;
default = 50;
description = "Blur of shadow";
};
save-format = mkOption {
type = types.enum ["png" "jpeg" "webp"];
type = types.enum [ "png" "jpeg" "webp" ];
default = "png";
description = "The format in which the image will be saved";
};

colors = mkOption {
type = types.attrsOf (types.submodule {
background = mkOption {
type = types.str;
default = "#323232";
description = "Background of image generated. Support: '#RRGGBBAA' 'h;#RRGGBBAA;#RRGGBBAA' 'v;#RRGGBBAA;#RRGGBBAA' or file path";
};
author = mkOption {
type = types.str;
default = "#FFFFFF";
description = "Title bar text color";
};
window-background = mkOption {
type = types.str;
default = "#4287f5";
description = "Window title bar background";
};
shadow = mkOption {
type = types.str;
default = "#707070";
description = "Shadow of screenshot. Support: '#RRGGBBAA' 'h;#RRGGBBAA;#RRGGBBAA' 'v;#RRGGBBAA;#RRGGBBAA' or file path";
};
title = mkOption {
type = types.str;
default = "#FFFFFF";
description = "Title bar text color";
};
});
};

window-controls = mkOption {
type = types.attrsOf (types.submodule {
enable = mkEnableOption "cli to take screenshots";
width = mkOption {
type = types.int;
default = 120;
description = "Width of window controls";
};
height = mkOption {
type = types.int;
default = 40;
description = "Height of window title/controls bar";
};
titlebar-padding = mkOption {
type = types.int;
default = 10;
description = "Padding of title on window bar";
};
});
};
}

0 comments on commit 67c554f

Please sign in to comment.