-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aerospace: add module #6279
Open
damidoug
wants to merge
1
commit into
nix-community:master
Choose a base branch
from
damidoug:aerospace
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+308
−0
Open
aerospace: add module #6279
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,12 @@ | |
github = "considerate"; | ||
githubId = 217918; | ||
}; | ||
damidoug = { | ||
email = "[email protected]"; | ||
github = "damidoug"; | ||
githubId = 75175586; | ||
name = "Douglas Damiano"; | ||
}; | ||
danjujan = { | ||
name = "Jan Schmitz"; | ||
email = "[email protected]"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
{ config, lib, pkgs, ... }: | ||
with lib; | ||
let | ||
cfg = config.programs.aerospace; | ||
|
||
tomlFormat = pkgs.formats.toml { }; | ||
|
||
filterAttrsRecursive = pred: set: | ||
lib.listToAttrs (lib.concatMap (name: | ||
let v = set.${name}; | ||
in 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)) | ||
] | ||
else | ||
[ ]) (lib.attrNames set)); | ||
filterNulls = filterAttrsRecursive (v: v != null); | ||
in { | ||
meta.maintainers = with hm.maintainers; [ damidoug ]; | ||
|
||
options.programs.aerospace = with types; { | ||
enable = mkEnableOption "Whether to enable AeroSpace window manager."; | ||
|
||
package = mkPackageOption pkgs "aerospace" { }; | ||
|
||
userSettings = mkOption { | ||
type = submodule { | ||
freeformType = tomlFormat.type; | ||
options = { | ||
start-at-login = lib.mkOption { | ||
type = bool; | ||
default = false; | ||
description = "Start AeroSpace at login."; | ||
}; | ||
after-login-command = mkOption { | ||
type = listOf str; | ||
default = [ ]; | ||
description = '' | ||
You can use it to add commands that run after login to macOS user session. | ||
'start-at-login' needs to be 'true' for 'after-login-command' to work. | ||
''; | ||
}; | ||
after-startup-command = mkOption { | ||
type = listOf str; | ||
default = [ ]; | ||
description = '' | ||
You can use it to add commands that run after AeroSpace startup. | ||
'after-startup-command' is run after 'after-login-command' | ||
''; | ||
example = [ "layout tiles" ]; | ||
}; | ||
enable-normalization-flatten-containers = mkOption { | ||
type = bool; | ||
default = true; | ||
description = | ||
''Containers that have only one child are "flattened".''; | ||
}; | ||
enable-normalization-opposite-orientation-for-nested-containers = | ||
mkOption { | ||
type = bool; | ||
default = true; | ||
description = | ||
"Containers that nest into each other must have opposite orientations."; | ||
}; | ||
accordion-padding = mkOption { | ||
type = int; | ||
default = 30; | ||
description = "Padding between windows in an accordion container."; | ||
}; | ||
default-root-container-layout = mkOption { | ||
type = enum [ "tiles" "accordion" ]; | ||
default = "tiles"; | ||
description = "Default layout for the root container."; | ||
}; | ||
default-root-container-orientation = mkOption { | ||
type = enum [ "horizontal" "vertical" "auto" ]; | ||
default = "auto"; | ||
description = "Default orientation for the root container."; | ||
}; | ||
on-window-detected = mkOption { | ||
type = listOf (submodule { | ||
options = { | ||
"if" = mkOption { | ||
type = submodule { | ||
options = { | ||
app-id = mkOption { | ||
type = nullOr str; | ||
default = null; | ||
description = "The application ID to match (optional)."; | ||
}; | ||
workspace = mkOption { | ||
type = nullOr str; | ||
default = null; | ||
description = "The workspace name to match (optional)."; | ||
}; | ||
window-title-regex-substring = mkOption { | ||
type = nullOr str; | ||
default = null; | ||
description = | ||
"Substring to match in the window title (optional)."; | ||
}; | ||
app-name-regex-substring = mkOption { | ||
type = nullOr str; | ||
default = null; | ||
description = | ||
"Regex substring to match the app name (optional)."; | ||
}; | ||
during-aerospace-startup = mkOption { | ||
type = nullOr bool; | ||
default = null; | ||
description = | ||
"Whether to match during aerospace startup (optional)."; | ||
}; | ||
}; | ||
}; | ||
default = { }; | ||
description = "Conditions for detecting a window."; | ||
}; | ||
check-further-callbacks = mkOption { | ||
type = nullOr bool; | ||
default = null; | ||
description = | ||
"Whether to check further callbacks after this rule (optional)."; | ||
}; | ||
run = mkOption { | ||
type = oneOf [ str (listOf str) ]; | ||
example = [ "move-node-to-workspace m" "resize-node" ]; | ||
description = | ||
"Commands to execute when the conditions match (required)."; | ||
}; | ||
}; | ||
}); | ||
default = [ ]; | ||
example = [{ | ||
"if" = { | ||
app-id = "Another.Cool.App"; | ||
workspace = "cool-workspace"; | ||
window-title-regex-substring = "Title"; | ||
app-name-regex-substring = "CoolApp"; | ||
during-aerospace-startup = false; | ||
}; | ||
check-further-callbacks = false; | ||
run = [ "move-node-to-workspace m" "resize-node" ]; | ||
}]; | ||
description = | ||
"Commands to run every time a new window is detected with optional conditions."; | ||
}; | ||
workspace-to-monitor-force-assignment = mkOption { | ||
type = attrsOf (oneOf [ int str (listOf str) ]); | ||
default = { }; | ||
description = '' | ||
Map workspaces to specific monitors. | ||
Left-hand side is the workspace name, and right-hand side is the monitor pattern. | ||
''; | ||
example = { | ||
"1" = 1; # First monitor from left to right. | ||
"2" = "main"; # Main monitor. | ||
"3" = "secondary"; # Secondary monitor (non-main). | ||
"4" = "built-in"; # Built-in display. | ||
"5" = | ||
"^built-in retina display$"; # Regex for the built-in retina display. | ||
"6" = [ "secondary" "dell" ]; # Match first pattern in the list. | ||
}; | ||
}; | ||
on-focus-changed = mkOption { | ||
type = listOf str; | ||
default = [ ]; | ||
example = [ "move-mouse monitor-lazy-center" ]; | ||
description = | ||
"Commands to run every time focused window or workspace changes."; | ||
}; | ||
on-focused-monitor-changed = mkOption { | ||
type = listOf str; | ||
default = [ "move-mouse monitor-lazy-center" ]; | ||
description = "Commands to run every time focused monitor changes."; | ||
}; | ||
exec-on-workspace-change = mkOption { | ||
type = listOf str; | ||
default = [ ]; | ||
example = [ | ||
"/bin/bash" | ||
"-c" | ||
"sketchybar --trigger aerospace_workspace_change FOCUSED=$AEROSPACE_FOCUSED_WORKSPACE" | ||
]; | ||
description = "Commands to run every time workspace changes."; | ||
}; | ||
key-mapping.preset = mkOption { | ||
type = enum [ "qwerty" "dvorak" ]; | ||
default = "qwerty"; | ||
description = "Keymapping preset."; | ||
}; | ||
}; | ||
}; | ||
default = { }; | ||
example = literalExpression '' | ||
{ | ||
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"; | ||
}; | ||
} | ||
''; | ||
description = '' | ||
AeroSpace configuration, see | ||
<link xlink:href="https://nikitabobko.github.io/AeroSpace/guide#configuring-aerospace"/> | ||
for supported values. | ||
''; | ||
}; | ||
}; | ||
|
||
config.home = mkIf cfg.enable { | ||
packages = [ cfg.package ]; | ||
file.".config/aerospace/aerospace.toml".source = | ||
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
programs.aerospace = { | ||
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"; | ||
}; | ||
}; | ||
}; | ||
|
||
test.stubs.aerospace = { }; | ||
|
||
nmt.script = '' | ||
assertFileContent home-files/.config/aerospace/aerospace.toml ${ | ||
./settings-expected.toml | ||
} | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ aerospace = ./aerospace.nix; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
accordion-padding = 30 | ||
after-login-command = [] | ||
after-startup-command = [] | ||
default-root-container-layout = "tiles" | ||
default-root-container-orientation = "auto" | ||
enable-normalization-flatten-containers = true | ||
enable-normalization-opposite-orientation-for-nested-containers = true | ||
exec-on-workspace-change = [] | ||
on-focus-changed = [] | ||
on-focused-monitor-changed = ["move-mouse monitor-lazy-center"] | ||
on-window-detected = [] | ||
start-at-login = false | ||
|
||
[gaps.outer] | ||
bottom = 8 | ||
left = 8 | ||
right = 8 | ||
top = 8 | ||
|
||
[key-mapping] | ||
preset = "qwerty" | ||
|
||
[mode.main.binding] | ||
alt-h = "focus left" | ||
alt-j = "focus down" | ||
alt-k = "focus up" | ||
alt-l = "focus right" | ||
|
||
[workspace-to-monitor-force-assignment] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khaneliman the diference its for home-manager, in my case I dont use nix-darwin just the nix + home-manager. i want to keep all my apps on home-manager, so i can use the same flake file on linux, darwin etc... just installing nix+home-manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw some news modules merged with the manitainers in the same commit, for this reason i kept in the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, all we are doing is explaining the reason for a comment above. No need to justify it again.
Still is a best practice for logical commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is missing to approve this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split into two commits??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new using git, what's the correct way to split it?