modules/kwin: init and add titlebar buttons options

This commit is contained in:
Toast 2023-12-19 10:34:42 +01:00
parent 32ee6377e6
commit 0f38c34581
2 changed files with 44 additions and 0 deletions

View File

@ -8,6 +8,7 @@
./spectacle.nix
./windows.nix
./workspace.nix
./kwin.nix
];
options.programs.plasma.enable = lib.mkEnableOption ''

43
modules/kwin.nix Normal file
View File

@ -0,0 +1,43 @@
{ config, lib, ... }:
with lib;
let
cfg = config.programs.plasma;
in
{
options.programs.plasma.kwin = {
titlebarButtons.right = mkOption {
type = with types; nullOr (listOf str);
default = null;
example = [ "H" "I" "A" "X" ];
description = ''
Title bar buttons to be placed on the right.
'';
};
titlebarButtons.left = mkOption {
type = with types; nullOr (listOf str);
default = null;
example = [ "S" "F" ];
description = ''
Title bar buttons to be placed on the left.
'';
};
};
config = mkIf (cfg.enable) {
# Titlebar buttons
programs.plasma.configFile."kwinrc"."org\\.kde\\.kdecoration2" = mkMerge [
(
mkIf (cfg.kwin.titlebarButtons.left != null) {
"ButtonsOnLeft" = strings.concatStrings cfg.kwin.titlebarButtons.left;
}
)
(
mkIf (cfg.kwin.titlebarButtons.right != null) {
"ButtonsOnRight" = strings.concatStrings cfg.kwin.titlebarButtons.right;
}
)
];
};
}