-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add panelspacer widget-specific options (#341)
- Loading branch information
1 parent
976c766
commit 5c97fe8
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
}; | ||
} |