mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-02 23:21:02 +01:00
aerospace: add more tests and fix expected values
This commit is contained in:
parent
1ed596c638
commit
c220f242cd
8 changed files with 209 additions and 78 deletions
|
|
@ -1,41 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
hmPkgs = pkgs.extend (
|
||||
self: super: {
|
||||
aerospace = config.lib.test.mkStubPackage {
|
||||
name = "aerospace";
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/aerospace
|
||||
chmod 755 $out/bin/aerospace
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
programs.aerospace = {
|
||||
enable = true;
|
||||
package = hmPkgs.aerospace;
|
||||
|
||||
userSettings = {
|
||||
gaps = {
|
||||
outer.left = 8;
|
||||
outer.bottom = 8;
|
||||
outer.top = 8;
|
||||
outer.right = 8;
|
||||
};
|
||||
mode.main.binding = {
|
||||
alt-h = "focus left";
|
||||
alt-j = "focus down";
|
||||
alt-k = "focus up";
|
||||
alt-l = "focus right";
|
||||
};
|
||||
key-mapping.preset = "colemak";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/aerospace/aerospace.toml ${./colemak-settings-expected.toml}
|
||||
'';
|
||||
}
|
||||
28
tests/modules/programs/aerospace/aerospace-no-xdg.nix
Normal file
28
tests/modules/programs/aerospace/aerospace-no-xdg.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
hmPkgs = pkgs.extend (
|
||||
self: super: {
|
||||
aerospace = config.lib.test.mkStubPackage {
|
||||
name = "aerospace";
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/aerospace
|
||||
chmod 755 $out/bin/aerospace
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
xdg.enable = false;
|
||||
|
||||
programs.aerospace = {
|
||||
enable = true;
|
||||
package = hmPkgs.aerospace;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
# aerospace just create the config file if we open it by hand, otherwise he's use directly the default config
|
||||
assertPathNotExists "home-files/.aerospace.toml"
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
hmPkgs = pkgs.extend (
|
||||
self: super: {
|
||||
aerospace = config.lib.test.mkStubPackage {
|
||||
name = "aerospace";
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/aerospace
|
||||
chmod 755 $out/bin/aerospace
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
xdg.enable = false;
|
||||
|
||||
programs.aerospace = {
|
||||
enable = true;
|
||||
package = hmPkgs.aerospace;
|
||||
|
||||
launchd.enable = true;
|
||||
|
||||
settings = {
|
||||
gaps = {
|
||||
outer.left = 8;
|
||||
outer.bottom = 8;
|
||||
outer.top = 8;
|
||||
outer.right = 8;
|
||||
};
|
||||
mode.main.binding = {
|
||||
alt-enter = ''
|
||||
exec-and-forget osascript -e '
|
||||
tell application "Terminal"
|
||||
do script
|
||||
activate
|
||||
end tell'
|
||||
'';
|
||||
alt-h = "focus left";
|
||||
alt-j = "focus down";
|
||||
alt-k = "focus up";
|
||||
alt-l = "focus right";
|
||||
};
|
||||
on-window-detected = [
|
||||
{
|
||||
"if".app-id = "com.apple.finder";
|
||||
run = "move-node-to-workspace 9";
|
||||
}
|
||||
|
||||
{
|
||||
"if" = {
|
||||
app-id = "com.apple.systempreferences";
|
||||
app-name-regex-substring = "settings";
|
||||
window-title-regex-substring = "substring";
|
||||
workspace = "workspace-name";
|
||||
during-aerospace-startup = true;
|
||||
};
|
||||
check-further-callbacks = true;
|
||||
run = [
|
||||
"layout floating"
|
||||
"move-node-to-workspace S"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists "home-files/.config/aerospace";
|
||||
assertFileExists "home-files/.aerospace.toml"
|
||||
assertFileContent "home-files/.aerospace.toml" ${./settings-expected.toml}
|
||||
|
||||
serviceFile=$(normalizeStorePaths LaunchAgents/org.nix-community.home.aerospace.plist)
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent "$serviceFile" ${./aerospace-service-expected.plist}
|
||||
'';
|
||||
}
|
||||
78
tests/modules/programs/aerospace/aerospace-settings.nix
Normal file
78
tests/modules/programs/aerospace/aerospace-settings.nix
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
hmPkgs = pkgs.extend (
|
||||
self: super: {
|
||||
aerospace = config.lib.test.mkStubPackage {
|
||||
name = "aerospace";
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/aerospace
|
||||
chmod 755 $out/bin/aerospace
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
xdg.enable = true;
|
||||
|
||||
programs.aerospace = {
|
||||
enable = true;
|
||||
package = hmPkgs.aerospace;
|
||||
|
||||
launchd.enable = true;
|
||||
|
||||
settings = {
|
||||
gaps = {
|
||||
outer.left = 8;
|
||||
outer.bottom = 8;
|
||||
outer.top = 8;
|
||||
outer.right = 8;
|
||||
};
|
||||
mode.main.binding = {
|
||||
alt-enter = ''
|
||||
exec-and-forget osascript -e '
|
||||
tell application "Terminal"
|
||||
do script
|
||||
activate
|
||||
end tell'
|
||||
'';
|
||||
alt-h = "focus left";
|
||||
alt-j = "focus down";
|
||||
alt-k = "focus up";
|
||||
alt-l = "focus right";
|
||||
};
|
||||
on-window-detected = [
|
||||
{
|
||||
"if".app-id = "com.apple.finder";
|
||||
run = "move-node-to-workspace 9";
|
||||
}
|
||||
|
||||
{
|
||||
"if" = {
|
||||
app-id = "com.apple.systempreferences";
|
||||
app-name-regex-substring = "settings";
|
||||
window-title-regex-substring = "substring";
|
||||
workspace = "workspace-name";
|
||||
during-aerospace-startup = true;
|
||||
};
|
||||
check-further-callbacks = true;
|
||||
run = [
|
||||
"layout floating"
|
||||
"move-node-to-workspace S"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists "home-files/.aerospace.toml";
|
||||
assertFileExists "home-files/.config/aerospace/aerospace.toml"
|
||||
assertFileContent "home-files/.config/aerospace/aerospace.toml" ${./settings-expected.toml}
|
||||
|
||||
serviceFile=$(normalizeStorePaths LaunchAgents/org.nix-community.home.aerospace.plist)
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent "$serviceFile" ${./aerospace-service-expected.plist}
|
||||
'';
|
||||
}
|
||||
|
|
@ -14,33 +14,15 @@ let
|
|||
);
|
||||
in
|
||||
{
|
||||
xdg.enable = true;
|
||||
|
||||
programs.aerospace = {
|
||||
enable = true;
|
||||
package = hmPkgs.aerospace;
|
||||
|
||||
launchd.enable = true;
|
||||
|
||||
userSettings = {
|
||||
gaps = {
|
||||
outer.left = 8;
|
||||
outer.bottom = 8;
|
||||
outer.top = 8;
|
||||
outer.right = 8;
|
||||
};
|
||||
mode.main.binding = {
|
||||
alt-h = "focus left";
|
||||
alt-j = "focus down";
|
||||
alt-k = "focus up";
|
||||
alt-l = "focus right";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/aerospace/aerospace.toml ${./settings-expected.toml}
|
||||
|
||||
serviceFile=$(normalizeStorePaths LaunchAgents/org.nix-community.home.aerospace.plist)
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent "$serviceFile" ${./aerospace-service-expected.plist}
|
||||
# aerospace just create the config file if we open it by hand, otherwise he's use directly the default config
|
||||
assertPathNotExists "home-files/.config/aerospace"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
[gaps.outer]
|
||||
bottom = 8
|
||||
left = 8
|
||||
right = 8
|
||||
top = 8
|
||||
|
||||
[key-mapping]
|
||||
preset = "colemak"
|
||||
|
||||
[mode.main.binding]
|
||||
alt-h = "focus left"
|
||||
alt-j = "focus down"
|
||||
alt-k = "focus up"
|
||||
alt-l = "focus right"
|
||||
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
|
||||
aerospace = ./aerospace.nix;
|
||||
aerospace-colemak = ./aerospace-colemak.nix;
|
||||
aerospace-no-xdg = ./aerospace-no-xdg.nix;
|
||||
aerospace-settings = ./aerospace-settings.nix;
|
||||
aerospace-settings-no-xdg = ./aerospace-settings-no-xdg.nix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,25 @@ right = 8
|
|||
top = 8
|
||||
|
||||
[mode.main.binding]
|
||||
alt-enter = "exec-and-forget osascript -e '\n tell application \"Terminal\"\n do script\n activate\n end tell'\n"
|
||||
alt-h = "focus left"
|
||||
alt-j = "focus down"
|
||||
alt-k = "focus up"
|
||||
alt-l = "focus right"
|
||||
|
||||
[[on-window-detected]]
|
||||
run = "move-node-to-workspace 9"
|
||||
|
||||
[on-window-detected.if]
|
||||
app-id = "com.apple.finder"
|
||||
|
||||
[[on-window-detected]]
|
||||
check-further-callbacks = true
|
||||
run = ["layout floating", "move-node-to-workspace S"]
|
||||
|
||||
[on-window-detected.if]
|
||||
app-id = "com.apple.systempreferences"
|
||||
app-name-regex-substring = "settings"
|
||||
during-aerospace-startup = true
|
||||
window-title-regex-substring = "substring"
|
||||
workspace = "workspace-name"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue