Skip to content

Commit

Permalink
aerospace: add workspace-to-monitor-force-assignment option and fix o…
Browse files Browse the repository at this point in the history
…n-window-detected type LnL7#1208

trying to fix LnL7#1142

testing requested changes

adding workspace to monitor force assignment

remove formatting

tests pass

proper tests

undo formatting

tests for on-window-detected and workspace-to-monitor-force-assignment

testing submodules

cleanup n if fiz

checking

final

toml null field aerospace callback issue

custom null filter for submodule list

check for no presense of window-regex and if.workspace config check

error

formatting mishap

space left
  • Loading branch information
thuvasooriya committed Dec 29, 2024
1 parent 17b97a2 commit 74b2aa1
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions modules/services/aerospace/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,33 @@

let
cfg = config.services.aerospace;

format = pkgs.formats.toml { };
filterAttrsRecursive =
pred: set:
filterAttrsRecursive = pred: set:
lib.listToAttrs (
lib.concatMap (
name:
let
name: let
v = set.${name};
in
if pred v then
[
if pred v
then [
(lib.nameValuePair name (
if lib.isAttrs v then
filterAttrsRecursive pred v
else if lib.isList v then
(map (i: if lib.isAttrs i then filterAttrsRecursive pred i else i) (lib.filter pred v))
else
v
if lib.isAttrs v
then filterAttrsRecursive pred v
else if lib.isList v
then
(map (i:
if lib.isAttrs i
then filterAttrsRecursive pred i
else i) (lib.filter pred v))
else v
))
]
else
[ ]
else []
) (lib.attrNames set)
);
filterNulls = filterAttrsRecursive (v: v != null);
configFile = format.generate "aerospace.toml" (filterNulls cfg.settings);
in
in

{
options = {
Expand Down Expand Up @@ -124,7 +123,7 @@ in
during-aerospace-startup = lib.mkOption {
type = nullOr bool;
default = null;
description = "Whether to match during aerospace startup (optional).";
description = "Whether to match during aerospace startup (optional).";
};
};
};
Expand All @@ -137,8 +136,8 @@ in
description = "Whether to check further callbacks after this rule (optional).";
};
run = lib.mkOption {
type = oneOf [ str (listOf str) ];
example = [ "move-node-to-workspace m" "resize-node" ];
type = oneOf [str (listOf str)];
example = ["move-node-to-workspace m" "resize-node"];
description = "Commands to execute when the conditions match (required).";
};
};
Expand All @@ -160,7 +159,7 @@ in
description = "Commands to run every time a new window is detected with optional conditions.";
};
workspace-to-monitor-force-assignment = lib.mkOption {
type = attrsOf (oneOf [ int str (listOf str) ]);
type = attrsOf (oneOf [int str (listOf str)]);
default = { };
description = ''
Map workspaces to specific monitors.
Expand Down

0 comments on commit 74b2aa1

Please sign in to comment.