Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add command to programatically run all on-window-detected callbacks #107

Open
carlosflorencio opened this issue Jan 8, 2024 · 8 comments
Labels
feature-proposal A well defined feature proposal good-first-issue Easy to fix issues. Good for newcomers triaged The issue makes sense to maintainers

Comments

@carlosflorencio
Copy link

carlosflorencio commented Jan 8, 2024

Hi,

It's possible to have a command that runs all the on-window-detected callbacks?

Use-case:
I have the apps <> workspaces affinities setup like:

# apps to workspaces
[[on-window-detected]]
if.app-id = 'com.microsoft.VSCode'
run = ['move-node-to-workspace 1']

[[on-window-detected]]
if.app-id = 'com.vivaldi.Vivaldi'
run = ['move-node-to-workspace 2']

...

Sometimes I move apps between workspaces and then have the need to reposition them back to the initial workspaces. So it would be useful to have a command like aerospace force-window-detected to run all the rules the move the windows back to their original workspace.

Also a different request/question, it's possible to assign layouts to workspaces in the config file? e.g workspace 1 to start with the h_accordion layout. (UPD: resolved in the comments)

@nikitabobko
Copy link
Owner

nikitabobko commented Jan 8, 2024

So it would be useful to have a command like aerospace force-window-detected to run all the rules the move the windows back to their original workspace.

Nice. I like the suggestion. The hardest part here is to come up with a good name for the command

Brainstorming:

  1. force-window-detected (the suggested name)
  2. run-on-window-detected-callbacks
  3. force-run-on-window-detected-callbacks
  4. redetect-windows

Right now, 2 and 3 are my favorite. IMO, they are the most clear. Ideas are welcome

Also a different request/question, it's possible to assign layouts to workspaces in the config file? e.g workspace 1 to start with the h_accordion layout.

Right now. it's not possible, but probably it'd be nice to have. What is your use case?

I'm curious if it were possible to run layout command in on-window-detected callback, would it resolve your issue? (this way you will apply the layout only if the specific window is detected, but maybe it's exactly what you want to, I don't know your use cases)

The hardest part is to come up with a good syntax

Brainstorming:

# (a)
default-root-container-layout = 'tiles'
workspace.1.default-root-container-layout = 'tiles'

# (b)
[default-root-container-layout]
workspace.1 = 'tiles'
workspace.2 = 'accordion'
workspace.all = 'tiles' # 'all' will be a reserved name for workspaces since 0.8.0, anyway

# (c)
[default-root-container-layout]
workspace.1 = 'tiles'
workspace.2 = 'accordion'
other = 'tiles'

@carlosflorencio
Copy link
Author

Regarding the command name, I think the second option is good: run-on-window-detected-callbacks!

Right now. it's not possible, but probably it'd be nice to have. What is your use case?

The use case is to fast switch maximised apps in the same workspace. E.g I like to have a workspace for IDEs where I have multiple instances (different folders/projects opened) and I like a stacked/accordion layout for that.

I'm curious if it were possible to run layout command in on-window-detected callback, would it resolve your issue?

Yes sort of, but when using different apps I would need a rule for each of them to set the layout. It feels more natural to set the layout at the workspace configuration level.

Regarding the syntax, I like your options (a) and (b).
Another approach would be to set the layout also in callback style on-workspace-changed (#87):

[[on-workspace-changed]]
if.workspace-id = '1'
if.during-aerospace-startup = true  # only run this once
run = ['layout h_accordion']

@GraemeARobinson
Copy link

+1 for this feature request

@nikitabobko

This comment has been minimized.

@carlosflorencio

This comment has been minimized.

@quulah

This comment has been minimized.

@nikitabobko

This comment has been minimized.

@quulah

This comment has been minimized.

@nikitabobko nikitabobko added good-first-issue Easy to fix issues. Good for newcomers feature-proposal A well defined feature proposal triaged The issue makes sense to maintainers labels Dec 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature-proposal A well defined feature proposal good-first-issue Easy to fix issues. Good for newcomers triaged The issue makes sense to maintainers
Projects
None yet
Development

No branches or pull requests

4 participants