Jump to content

Workflow to move app to current monitor/space or to create new instance/window of it


Recommended Posts

Hello,

 

I am working in a multi monitor and multi space setup. I often use Alfred with the normal "App launch" behaviour to quickly jump to an already open app in which space this app might be.

This works great. However sometimes I am in a space where I want to open a new window of the app in that space.

There is a small workflow for chrome which does that, but I actually need this for any app.

 

Furthermore, sometimes I am in a space and I want to use an app which is another space, but I don't want to create a new instance, I just want to move this app in this space.

 

Ideal I would like to achieve this with the normal app launch behaviour, so when I type in 'chrome' I then can press a modifier key to choose between 'move here', 'create new window'.

 

Is there anyway to achieve this with a workflow or with any other extension/scripting?

 

thanks for the input.

Edited by KaputtZimon
Link to comment

I know have a workflow which uses a file filter on the /Application folder and rund `open -n "${1}"`.

So is there a way to call this from a modifier key when I normally would start an app?

 

However I have no clue how to move an existing application to the current space, if that is even possible...

Link to comment

I have not tried this (because I'm not currently connected to my separate monitor) but, assuming you're using Alfred 5, have you looked at connecting to an app launcher an Automation Task Move Window to Different Screen? Note:

  • there are options for which screen; and
  • the result centres the topmost window on the specified screen.

Stephen

Link to comment

I'm assuming (still unable to test it, sorry) that if you create a workflow that:

  • starts with either a hotkey or a keyword action; which is linked to
  • a Launch Apps/Files action; which is in turn linked to
  • an Automation Task configured to Move Window to a Different Screen

you'll end up with the new app window displayed, centred, on the screen you select when configuring the Automation Task.

 

In other words, the first steps provide you with the "topmost window” that the Automation Task requires in order to move it to a different screen.

 

Of course, there's no reason why you can't use the same launcher to launch, and leave, the app on your first screen—using a key modifier to launch the app and move it to a different screen.

 

Stephen

Link to comment

Well I am looking to solve two problems:

1. I want to open a new instance of an app, which I tried using the approach above with 

open -n "${1}"

This works with some apps but apparently every app implements this different, so in my case 50% of apps do not open a new instance when using this command. So I guess this is just not possible.

 

2. I want to move an already open app to the monitor and space where the cursor is. When I launch an App which is not open yet, it automatically appears in the right space and monitor. The problem is when I want to launch an app which is already open in another space. When this happens then the space is changed where the app is, but I want to move the app to my current space.

 

One first step solution could be, to first get all open apps, and then select one which is then moved to the current space and screen. 

But the solution for this should be using the normal app launch behaviour, since I don't want to have to remember which apps are open or not.

 

Also, apparently there is no easy way to move a window to a different space without the mouse....

Edited by KaputtZimon
Link to comment

@KaputtZimon Apple does not provide an API to programmatically move windows to specific spaces. Until that changes, it can’t be done (or requires hacky methods).

 

To request to Apple that they add the feature, use the Feedback Assistant app. They say that the more requests they have, the likelier something is to be implemented.

Link to comment
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...