Skip to content

Commit

Permalink
Add panelspacer widget-specific options (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeitorAugustoLN authored Aug 25, 2024
1 parent 976c766 commit 5c97fe8
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/widgets/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let
./kicker.nix
./kickerdash.nix
./kickoff.nix
./panel-spacer.nix
./plasma-panel-colorizer.nix
./plasmusic-toolbar.nix
./system-monitor.nix
Expand Down
66 changes: 66 additions & 0 deletions modules/widgets/panel-spacer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{ lib, ... }:
let
inherit (import ./lib.nix { inherit lib; }) configValueType;
inherit (import ./default.nix { inherit lib; }) positionType sizeType;

mkBoolOption = description: lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
inherit description;
};
in
{
panelSpacer = {
opts = {
position = lib.mkOption {
type = positionType;
example = { horizontal = 100; vertical = 300; };
description = "The position of the widget. (Only for desktop widget)";
};
size = lib.mkOption {
type = sizeType;
example = { width = 500; height = 50; };
description = "The size of the widget. (Only for desktop widget)";
};
expanding = mkBoolOption "Whether the spacer should expand to fill the available space.";
length = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
example = 50;
description = ''
The length of the spacer.
If expanding is set to true, this value is ignored.
'';
};
settings = lib.mkOption {
type = configValueType;
default = null;
example = {
General = {
expanding = true;
};
};
description = ''
Extra configuration for the widget
'';
apply = settings: if settings == null then {} else settings;
};
};

convert =
{ position
, size
, expanding
, length
, settings
}: {
name = "org.kde.plasma.panelspacer";
config = lib.recursiveUpdate {
General = lib.filterAttrs (_: v: v != null) {
inherit expanding length;
};
} settings;
};
};
}

0 comments on commit 5c97fe8

Please sign in to comment.