how to open and move an app silently through 'exec-and-forget' #1538
Replies: 1 comment
|
I have something similar set up to open various apps, and then move them around to different spaces, resize them, etc with a keybind. I had a lot of issues getting it working the way I wanted doing it in the config itself. What I ended up doing was writing a separate script that uses the aerospace CLI commands to move everything around, and targets the items by Window ID (rather than what's focused). This method allows much more granular control, along with adding pauses (sleeps) to give the apps time to launch before you try moving them (as newly launched apps tend to grab focus). I have that script living in my Aerospace config folder, set to being executable, and then I have the bind in my Aerospace config file just doing an exec-and-forget pointing to that script. |
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I have a probably fundamental question on writing key-bindings using 'exec-and-forget'. My goal is to define a key-binding that first opens up several apps and then switches my focus to a specific workspace. This is my function (in service mode)
As you can see from the script, I intend to focus on my "Calendar" workspace. However, every time I use the key-binding, I ended up looking at my Obsidian app (which lives in an "Obsidian" workspace).
I searched up a little bit and ChatGPT tells me that this is because I have another script
such that when aerospace creates and moves the Obsidian app to its desired workspace, the system will adjust the focus. But I am confused that, when I run
open -g -a Obsidianin a terminal, obsidian can be invoked and sent silently to its desired workspace--while I am still focusing on the terminal (NOT in theObsidianworkspace).Could anybody explains why we have these inconsistencies (at least to me)? And possibly workarounds? I also met another problem on 'exec-and-forget osascript -e 'quit app "Visual Studio Code"'' which would raise an error.
My whole config file is
All reactions