nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
8.39k stars 137 forks source link

Lift limitations in `on-window-detected.run` #20

Open nikitabobko opened 1 year ago

nikitabobko commented 1 year ago

The limitations are:

wojciech-kulik commented 11 months ago

I would like to use resize width 250 to be able to force some layout. I'm using it to have terminal on the left and small iOS simulator on the right side. Probably move-through left would be useful as well.

sizuf commented 7 months ago

Being able to use the resize command inside on-window-detected would be useful. In my case, I'd like the mobile emulators to start with a smaller width.

dekked commented 5 months ago

I'm using sketchybar and would like to only display those workspaces that are non empty + the currently focused one.

So far, there is no robust way to:

I am solving it in a hacky and not foolproof way, basically with a trigger every time I change workspace or whenever an app is moved to another workspace, as well as when the front app changes.

I thought I could do part of it by detecting any new window being opened, but I can't run an execute-and-forget command to signal sketchybar :)

I understand the reason not to allow this would be not to execute any command that would create a window and suddenly we have an infinite cascade?

vcooley commented 5 months ago

I would like a "do nothing" command that just intercepts the event and stops further events from being called (with check-further-callbacks = false).

My use use case is that I'm often opening up Chrome debug windows, and my current setup has a rule to always send Chrome windows to a certain workspace when they're opened. I would like to setup a rule that just uses the default behavior of opening the dev tools window in the same workspace as the parent window so that I don't have to go looking for it.

nikitabobko commented 5 months ago

@vcooley have you tried to use empty array run = []?

vcooley commented 5 months ago

@nikitabobko I hadn't tried that, but had tried empty string. The empty array did the trick, thanks!

tobiasgiese commented 4 months ago

I'm using sketchybar and would like to only display those workspaces that are non empty + the currently focused one.

I am doing the same (or at least I am trying). Do you have a workaround for this @dekked? Or is it possible to implement this in AeroSpace? cc @nikitabobko

nikitabobko commented 4 months ago

So far, there is no robust way to:

  • Detect a new window being openend, and signal sketchybar that it should recompute which workspaces are active.
  • Do the same thing when a window is closed, or conversely, when a workspace becomes empty.

@dekked @tobiasgiese your use case is better covered by #230 which will be implemented in the next version

tobiasgiese commented 4 months ago

deleted moved to https://github.com/nikitabobko/AeroSpace/issues/230#issuecomment-2262997144

kingmatusevich commented 3 months ago

It would be useful to be able to set the accordion layout for some of the workspaces, either in a workspace config or in the window detected be able to check if startup and set the right workspace layout

tale commented 3 months ago

I'd like the ability to set fullscreen for an application. I'm using it as a workaround to the big sur tabs issue in #68.

magoz commented 3 months ago

I'd like to:

[[on-window-detected]]
run = ['join-with right', 'mode main']

So each new window is automatically merged.

Is there another way to do this?

wanbinkimoon commented 3 months ago

I'd love to

[[on-window-detected]]
if.app-id = 'com.foo.bar'
run = 'layout fullscreen'

so that a particular app is always open in apple fullscreen mode

kronolynx commented 3 months ago

I'm using sketchybar and would like to only display those workspaces that are non empty + the currently focused one.

So far, there is no robust way to:

* Detect a new window being openend, and signal sketchybar that it should recompute which workspaces are active.

* Do the same thing when a window is closed, or conversely, when a workspace becomes empty.

I am solving it in a hacky and not foolproof way, basically with a trigger every time I change workspace or whenever an app is moved to another workspace, as well as when the front app changes.

I thought I could do part of it by detecting any new window being opened, but I can't run an execute-and-forget command to signal sketchybar :)

I understand the reason not to allow this would be not to execute any command that would create a window and suddenly we have an infinite cascade?

@dekked I'm currently using space_windows_change to update my workspaces on sketchybar when windows are created/destroyed, I haven't found a way yet to detect when a window is moved to a different workspace.

tobiasgiese commented 3 months ago

@kronolynx I am using a dirty hack like

alt-shift-1 = ['move-node-to-workspace 1', 'exec-and-forget sketchybar --trigger aerospace_workspace_change NEW_WORKSPACE=1' ]

and a script that moves the workspace to the correct display workspace. Not the best, but it does the job

samirettali commented 3 months ago

Can floating windows be configured to always be on top? I don't know if it's more of a OS thing

qskkk commented 3 months ago

In a tile layout, I would like my windows to automatically arrange themselves in a tree structure. For example, if I have 2 windows in h_tiles and I add a third one, I want it to be positioned in the bottom right corner of my screen like this:

h_tiles ├── window 1 └── v_tiles ├── window 2 └── window 3 And when a fourth window is opened, it should resize into this layout:

h_tiles └── v_tiles ├── window 1 └── window 4 └── v_tiles ├── window 2 └── window 3 I tried to achieve this using a bash script triggered by the command:

[[on-window-detected]] check-further-callbacks = true run = ['exec-and-forget ~/.scripts/layout.sh'] But I encountered this error:

on-window-detected[0]: For now, 'layout floating', 'layout tiling' and 'move-node-to-workspace' are the only commands that are supported in 'on-window-detected'. Please report your use cases to https://github.com/nikitabobko/AeroSpace/issues/20 If you need help with this issue or want to know how to work around it, let me know!

0xwal commented 3 months ago
[[on-window-detected]]
if.window-title-regex-substring = "Alert window"
run = ["layout floating", "move-node-to-monitor 2"]

I want it to appear on second monitor without taking the focus as the window is timed notification that will disappear in x seconds and sometime is not important.

gservat commented 3 months ago

It would be useful to be able to set the accordion layout for some of the workspaces, either in a workspace config or in the window detected be able to check if startup and set the right workspace layout

Same. For some apps, like VS Code, I like using the accordion layout but I can't find a way to do that.

foxswat commented 3 months ago

would love it support close action so that it can auto close the non meeting zoom window when Zoom app is opened by a meeting link:

[[on-window-detected]]
if.app-id = 'us.zoom.xos'
if.window-title-regex-substring = 'Zoom Workplace'
run = 'close'
silicakes commented 3 months ago

I have a use case where one of my workspaces contains zellij + neovim on the entire screen. I'd like to unbind most aerospace related keys as this is the only window in the workspace for me, So doing something like:

[[on-window-detected]]
if.app-id = 'net.kovidgoyal.kitty'
run = ['mode terminal']

[mode.terminal.binding]
alt-h = []
alt-j = []
alt-k = []
alt-l = []
....

Can be very beneficial.

Also, this should probably be referenced with https://github.com/nikitabobko/AeroSpace/issues/412 as it will probably have a more complete solution for exiting the aforementioned terminal mode once the window is not the terminal and the mode is set to terminal

alex-belost commented 3 months ago

I would like to have the option to set the accordion layout for a specific workspace.

[[on-window-detected]] if.workspace = 'Z' check-further-callbacks = true run = 'layout accordion'

edygar commented 3 months ago

I wanted to not only make it float, but also put it in the center with rectangle's help

[[on-window-detected]] if.app-id = 'com.google.Chrome' if.window-title-regex-substring = 'Sign In - Google Accounts' run = ['layout floating', 'exec-and-forget open -g "rectangle://execute-action?name=center"']

paulodiovani commented 3 months ago

I have some examples of commands that could be run with it:

dellacf commented 2 months ago

Can floating windows be configured to always be on top? I don't know if it's more of a OS thing

I would also love that. Sometimes my floating windows are lost/hidden behind other windows.

It would be useful to be able to set the accordion layout for some of the workspaces, either in a workspace config or in the window detected be able to check if startup and set the right workspace layout

Same for me: ms teams is opening windows in new windows, which is a bit annoying. To solve that I would like to change to accordion layout for this workspace whenever teams is opened:

[[on-window-detected]]
if.app-id = 'com.microsoft.teams2'
run = 'layout accordion'

Just in general: is there a reason why the actions that can be triggered by on-window-detected is so restricted?

paulodiovani commented 2 months ago

Can floating windows be configured to always be on top? I don't know if it's more of a OS thing

I would also love that. Sometimes my floating windows are lost/hidden behind other windows.

@dellacf the focus command allows to focus floating windows too, so you just need some shortcuts for it (defaults to alt-hjkl, I use cmd + arrows).

dblum-analog commented 2 months ago
[[on-window-detected]]
if.window-title-regex-substring = "Alert window"
run = ["layout floating", "move-node-to-monitor 2"]

I want it to appear on second monitor without taking the focus as the window is timed notification that will disappear in x seconds and sometime is not important.

Second this - I use the iTerm as a drop-down terminal and would love it to always be on the main monitor.

dellacf commented 2 months ago

@dellacf the focus command allows to focus floating windows too, so you just need some shortcuts for it (defaults to alt-hjkl, I use cmd + arrows).

I know, I just don't like that the floating windows are hidden behind my tilling windows.

denysav commented 2 months ago

I group apps by spaces. For instance, R stands for "reading" and apps like LiquidText, Kindle, Preview go there. I don't normally use those apps side-by-side (i.e., tiling layout), so ideally I'd want them to be fullscreen and the space R to have accordion layout, so I can quickly switch between those apps.

ELLIOTTCABLE commented 1 month ago

:+1: on the 'resize'-related stuff that adjust layout and positioning.

One particular reason this is necessary is that lots of apps have "naturally small" windows for particular purposes; and sometimes I would like those to be in the tiled grid, but I don't want them zoomed up to taking up ⅓ of the space on a Pro Display XDR.

As a specific (but not the only) example, the Tags window in Things 3 is a separate window instead of a drawer, and I do want it open (and not occluding the main window / 'floating') during normal usage of the app:

Screenshot 2024-10-08 at 16 11 40

However, if I set it to layout tiling, I end up with this ridiculousness every time I open the app:

image
albinjon commented 1 month ago

I'd like to:

[[on-window-detected]]
run = ['join-with right', 'mode main']

So each new window is automatically merged.

Is there another way to do this?

Also extremely interested in this! Seems strange to me to need to manually join to nest windows.

hisbaan commented 1 month ago

Similar to @qskkk I'd like to implement an auto spiral/dwindle layout and there seems to be a pretty easy way to do this with the on-window-detected callback, but it's missing the ability to run join-with commands and the ability to check the layout of the current node. Something like:

[[on-window-detected]]
if.node.layout = 'horizontal'
run = ['join-with left']

[[on-window-detected]]
if.node.layout = 'vertical'
run = ['join-with up']
ELLIOTTCABLE commented 4 weeks ago

Another use:

There's (often?) bugs with some niche applications using application-hiding oddly (https://bluebird.app/), or a fullscreen-mode (many games), where that particular poorly-behaved application ends up leaving a "gap" in a tiled layout. With arbitrary commands, a workaround would be possible - detect the launch of those oddities, and set them to 'floating' mode, so they don't affect the grid.

yuxb2 commented 2 weeks ago

Hi, would it be possible to add the resize option in the [on-window-detected] ? I would love to use it to set certain apps that are in floating to a certain size on my screen. A simple option to center elements would also be great. I'm using Hammerspoon right now to re-center all the floating windows at the moment, but it would be much easier if you could add a 'center-window' option, furthermore than the resize option. Thanks a lot, keep up the great work!

dudeofawesome commented 1 week ago

I would like to be able to automatically make secondary windows of a specific app accordion.

For example, if I'm in Firefox and hit cmd+n to open a new window, I'd like it to automatically join the original Firefox window's layout and vertically accordion with it.

AlanWarren commented 9 hours ago

Just to add to what's already been mentioned.

Jetbrains IDE's allow you to combine/attach multiple windows into a single window on MacOS. (i.e Open new Project -> Attach Window) They appear as tabs above your editor tabs, which is a very nice feature.

Aerospace interprets these as individual windows and attempts to tile them, which results in large blank spaces where these windows would normally be. (they remain attached to a single window, but Aerospace will display a blank tile for each additional window)

A great way of handling this is to always join new jetbrains windows, and then put them in an accordion. It's really slick if you set the accordion gap to 0, and you essentially get to ALT-J/K through your open projects.

The only hassle is that you have to micro-manage it. It would be great if we could automatically join up all jetbrains windows and set them to a vertical accordion layout.