Skip to content
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

Add more CLI flags #186

Open
nikitabobko opened this issue Mar 21, 2024 · 3 comments
Open

Add more CLI flags #186

nikitabobko opened this issue Mar 21, 2024 · 3 comments

Comments

@nikitabobko
Copy link
Owner

(1) Add --window-id option to all or almost all commands. This option would make the command behave like if <window-id> was focused

Motivation:

  • Under the hood --window-id is already presented. That's how on-window-detected.run is implemented. We could make it more transparent by saying in the docs that --window-id is applied by default to all of the on-window-detected.run commands. Lift limitations in on-window-detected.run #20
  • It's another way to fix Feature Request: Add command to focus window by id #173 . We could say that if no args were passed to focus command then we force focus the current window. This way focusing the window by id becomes aerospace --window-id <ID> focus

(2) Add --no-follow-focus to move and --follow-focus to move-node-to-workspace commands (btw, it's inconsistent that move follows focus by default, but move-node-to-workspace doesn't).

Motivation:

  • It makes scripting easier. Yes, it's possible to write aerospace move-node-to-workspace <workspace> && aerospace workspace <workspace>, but it gets more problematic when move-node-to-workspace is invoked by xargs. "Follow focus" is quite a common use case, it would be nice to have a flag for it.
  • We could lift the second limitation from Lift limitations in on-window-detected.run #20 by saying that --follow-focus is applied by default to move-node-to-workspace

(3) Add --format window-id (or --window-id-only) to list-windows command.

Motivation: It's tedious and error-prone to write aerospace list-windows | awk '{print $1}'.

In the same way, --format monitor-id (or --monitor-id-only) can be added to list-monitors command


Motivation for all 3 flags:

(a) Move all windows to the current workspace #185:

focused=$(aerospace list-workspaces --focused)
aerospace list-windows --all --format window-id | xargs -n1 aerospace move-node-to-workspace $focused --follow-focus --window-id
@nikitabobko
Copy link
Owner Author

--follow-focus

It's more correct to name it --focus-follows-window

@nikitabobko
Copy link
Owner Author

nikitabobko commented Apr 26, 2024

I'm thinking out loud

--window-id is a bad name. Since the flag affects a lot of commands, it should have a more distinct, verbosish name; otherwise, it could "occupy" a flag name that commands might want to use for their own purposes. For example, the focus command now occupied its own --window-id flag which is not exactly the same as the proposed --window-id in this issue

Another observation is that an empty workspace might be the "subject" as well. The workspace flag needs to be named with a symmetrical name

Proposals:

  • --act-on-window-id <subject-window-id>/--act-on-empty-workspace <subject-workspace-name>
  • --subject-window-id <subject-window-id>/--subject-empty-workspace <subject-workspace-name>
  • --src-window-id <subject-window-id>/--src-empty-workspace <subject-workspace-name>

Description proposal: Make the command acts as if the <subject-window-id> or <subject-workspace-name> was focused before the command execution

Other things that need to be thought about are:

  • Feature interaction with the future swap command Implement swap command #8. The command has two "subjects" it acts on. Are there any other potential commands like that?
  • Feature interaction with move-node-to-workspace. What window should be focused by the end of the command if the --subject-window-id flag is used?

@nick-potts
Copy link

How about --target-window and --target-workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants