nixos/workflows/a-happy-gnome: add module option to configure static workspaces

This commit is contained in:
Gabriel Arazas 2025-04-15 12:23:44 +08:00
parent 2c066787ef
commit a5aeb823f3
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -192,6 +192,8 @@ in {
default = true; default = true;
}; };
enableStaticWorkspace = lib.mkEnableOption "static workspaces configuration for PaperWM";
winprops = lib.mkOption { winprops = lib.mkOption {
type = let type = let
inherit (lib.types) listOf; inherit (lib.types) listOf;
@ -321,13 +323,24 @@ in {
let let
mkWorkspaceConfig = name: value: mkWorkspaceConfig = name: value:
lib.nameValuePair "org/gnome/shell/extensions/paperwm/workspaces/${name}" value; lib.nameValuePair "org/gnome/shell/extensions/paperwm/workspaces/${name}" value;
workspaces = lib.attrNames cfg.paperwm.workspaces;
in in
{ {
"org/gnome/shell/extensions/paperwm/workspaces".list = "org/gnome/shell/extensions/paperwm/workspaces".list = workspaces;
lib.attrNames cfg.paperwm.workspaces;
} }
// lib.mapAttrs' mkWorkspaceConfig cfg.paperwm.workspaces // lib.mapAttrs' mkWorkspaceConfig cfg.paperwm.workspaces
)) ))
(lib.mkIf cfg.paperwm.enableStaticWorkspace {
"org/gnome/mutter/dynamic-workspaces" = false;
"org/gnome/desktop/wm/preferences/num-workspaces" =
let
workspaces = lib.attrNames cfg.paperwm.workspaces;
in
lib.gvariant.mkInt32 (lib.length workspaces);
})
]; ];
}; };
}; };