-
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 appmenu widget-specific options (#340)
- Loading branch information
1 parent
0c01f98
commit 976c766
Showing
2 changed files
with
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ 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 | ||
{ | ||
appMenu = { | ||
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)"; | ||
}; | ||
compactView = mkBoolOption "Whether to show the app menu in a compact view"; | ||
settings = lib.mkOption { | ||
type = configValueType; | ||
default = null; | ||
example = { | ||
Appearance = { | ||
compactView = true; | ||
}; | ||
}; | ||
description = '' | ||
Extra configuration for the widget | ||
''; | ||
apply = settings: if settings == null then {} else settings; | ||
}; | ||
}; | ||
|
||
convert = | ||
{ position | ||
, size | ||
, compactView | ||
, settings | ||
}: { | ||
name = "org.kde.plasma.appmenu"; | ||
config = lib.recursiveUpdate { | ||
General = lib.filterAttrs (_: v: v != null) { | ||
inherit compactView; | ||
}; | ||
} settings; | ||
}; | ||
}; | ||
} |
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