mirror of
https://github.com/nix-community/plasma-manager.git
synced 2024-11-30 11:52:44 +03:00
modules/kwin: use more natural names
This commit is contained in:
parent
480ba1f95b
commit
6348923046
@ -4,11 +4,54 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.plasma;
|
||||
validTitlebarButtons = {
|
||||
longNames = [
|
||||
"more-window-actions"
|
||||
"application-menu"
|
||||
"on-all-desktops"
|
||||
"minimize"
|
||||
"maximize"
|
||||
"close"
|
||||
"help"
|
||||
"shade"
|
||||
"keep-below-windows"
|
||||
"keep-above-windows"
|
||||
];
|
||||
shortNames = [
|
||||
"M"
|
||||
"N"
|
||||
"S"
|
||||
"I"
|
||||
"A"
|
||||
"X"
|
||||
"H"
|
||||
"L"
|
||||
"B"
|
||||
"F"
|
||||
];
|
||||
};
|
||||
|
||||
# Gets a list with long names and turns it into short names
|
||||
getShortNames = wantedButtons:
|
||||
lists.forEach (
|
||||
lists.flatten (
|
||||
lists.forEach wantedButtons (currentButton:
|
||||
lists.remove null (
|
||||
lists.imap0 ( index: value:
|
||||
if value == currentButton then "${toString index}" else null
|
||||
) validTitlebarButtons.longNames
|
||||
)
|
||||
)
|
||||
)
|
||||
) getShortNameFromIndex;
|
||||
|
||||
# Gets the index and returns the short name in that position
|
||||
getShortNameFromIndex = position: builtins.elemAt validTitlebarButtons.shortNames (strings.toInt position);
|
||||
in
|
||||
{
|
||||
options.programs.plasma.kwin = {
|
||||
titlebarButtons.right = mkOption {
|
||||
type = with types; nullOr (listOf str);
|
||||
type = with types; nullOr (listOf (enum validTitlebarButtons.longNames));
|
||||
default = null;
|
||||
example = [ "H" "I" "A" "X" ];
|
||||
description = ''
|
||||
@ -16,7 +59,7 @@ in
|
||||
'';
|
||||
};
|
||||
titlebarButtons.left = mkOption {
|
||||
type = with types; nullOr (listOf str);
|
||||
type = with types; nullOr (listOf (enum validTitlebarButtons.longNames));
|
||||
default = null;
|
||||
example = [ "S" "F" ];
|
||||
description = ''
|
||||
@ -30,12 +73,12 @@ in
|
||||
programs.plasma.configFile."kwinrc"."org\\.kde\\.kdecoration2" = mkMerge [
|
||||
(
|
||||
mkIf (cfg.kwin.titlebarButtons.left != null) {
|
||||
"ButtonsOnLeft" = strings.concatStrings cfg.kwin.titlebarButtons.left;
|
||||
"ButtonsOnLeft" = strings.concatStrings (getShortNames cfg.kwin.titlebarButtons.left);
|
||||
}
|
||||
)
|
||||
(
|
||||
mkIf (cfg.kwin.titlebarButtons.right != null) {
|
||||
"ButtonsOnRight" = strings.concatStrings cfg.kwin.titlebarButtons.right;
|
||||
"ButtonsOnRight" = strings.concatStrings (getShortNames cfg.kwin.titlebarButtons.right);
|
||||
}
|
||||
)
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user