diff --git a/modules/services/window-managers/i3-sway/lib/functions.nix b/modules/services/window-managers/i3-sway/lib/functions.nix index 3cb7eca5..75b3f7b6 100644 --- a/modules/services/window-managers/i3-sway/lib/functions.nix +++ b/modules/services/window-managers/i3-sway/lib/functions.nix @@ -4,9 +4,13 @@ with lib; rec { criteriaStr = criteria: - "[${ - concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria) - }]"; + let + toCriteria = k: v: + if builtins.isBool v then + (if v then "${k}" else "") + else + ''${k}="${v}"''; + in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]"; keybindingDefaultWorkspace = filterAttrs (n: v: cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace) diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index 478fc856..1dcb330e 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -353,14 +353,23 @@ let criteria = mkOption { type = criteriaModule; - description = - "Criteria of the windows on which command should be executed."; - example = { title = "x200: ~/work"; }; + description = '' + Criteria of the windows on which command should be executed. + + A value of true is equivalent to using an empty + criteria (which is different from an empty string criteria). + ''; + example = literalExample '' + { + title = "x200: ~/work"; + floating = true; + }; + ''; }; }; }; - criteriaModule = types.attrsOf types.str; + criteriaModule = types.attrsOf (types.either types.str types.bool); in { fonts = mkOption { type = with types; either (listOf str) fontOptions;