Use BetterTouch Tool Action to move windows to another desktop

I’m a BetterTouch Tool newbie and am trying to create a startup routine that opens certain apps in specific Mission Control desktops. I’m using a laptop and an external monitor. I’ve set up these actions:

and I’m triggering the action with its URL via Alfred.

When I trigger a window in Desktop 1 with the Action “Switch to Desktop 8” nothing happens. The window remains in desktop 1. When I trigger “Move Window One Space/Desktop Right” it moves the BetterTouch Tool app to Desktop 2.

Any thoughts? I did read other threads. I’ve given BTT screen recording authority in System Settings.

Some questions.

  1. Is the goal to use Better Touch Tool and Alfred to implement the startup routine, or are they just the tools you have on hand? (I have a ‘startup routine’ that opens specific apps in specific spaces that uses Bunch along with having apps set to open in specific spaces. If that would accomplish your goal I’ll be happy to share how I do it.)

  2. In the BTT screenshot there are no keyboard shortcuts defined in the “Trigger Name” column. So how are you invoking the action?

  3. I’m not familiar with how to call BTT actions via urls from Alfred. So how is that done?

Thanks so much for the response. Answers to your questions:

  1. I’m only using Better Touch Tool because it has a task to Move or Switch a Window to a specific desktop number. I cannot find that functionality in either Keyboard Maestro or Shortcut.

  2. A trigger is not needed because I simply copy the BTT Action URL. I am opening the URL with Alfred.

  3. See above.

I’ve not used Bunch yet and would enjoy seeing your workflow. Can you launch apps in specific desktops within Bunch?

What Bunch allows you to do is define a set of apps to launch, scripts to run, and folders and documents to open. It does not have commands to open anything in a specific space. But there are other ways to do that.

First in System Settings (and presumably Preferences in Ventura) > Keyboard > Shortcuts > Mission Control enable the “Switch to Desktop X” keyboard shortcuts for the number of Desktops (Spaces) you have set up.

In the Bunch file curly brackets, {}, are used to execute keypresses. So to move to a specific Desktop, for example Desktop 5, you would enter {^5} on a line by itself. So if you had a specific Folder you want to open on Desktop 7, say “CurrentProject” the Bunch syntax would be (lines that start with “#” are comments):

#Switch to Desktop 7

# Open CurrentProject Folder
- /Volumes/HardDrive/Documents/CurrentProject

# Launch iTerm 
iTerm ~ 10

The “%Finder” directs the command to the Finder, and the “-” followed by the path to folder indicates what folder to open. Of course, you’d need to use the path to any files or folders on your system.

The line “iTerm ~10” will launch the app iTerm after a delay of 10 seconds. This is important as the commands (lines) in a Bunch file are not guaranteed to launch in the order listed. I needed to experiment with the delay parameter, to get things to open in the order I wanted them. Otherwise iTerm might open before moving to Desktop 7.

This technique can be used to switch to a desktop and open items in that desktop, and then switch to the next, and so on.

The other technique to have an app open in a specific desktop is to specify a desktop for the app. I do this using the Dock. Navigate to the desktop you want the app to always open in, right click on the app icon in the Dock, and select Options > This Desktop. In the screenshot below I have Music set to always open in a specific Desktop (Space 6 in my case).

Screen Shot 2023-02-09 at 5.41.00 PM

Now in the Bunch file I just need “Music” on a line by itself, and it will open in Desktop 6. And when the Bunch file executes the system will first switch to Desktop 6 and then open Music. This can be used to have other items open on Desktop 6. But you’ll need to experiment with the delays to make sure things do not open until after moving to Desktop 6 and before moving to the next Desktop.

I use these two techniques to open items on specific desktops. In the next post I’ll walk through my morning Bunch.

1 Like

Here is my “Morning” Bunch.

I start my day by checking email and messages, looking at RSS feeds and websites, checking my calendar and weather, check my tasks, and listening to music. While enjoying my coffee as my Mac does all the setup for me.

title: ☕ Morning
# Launch Apps to Start My Day

if time is before 11:59am
    * say "good morning Steve" ~30
else if time is before 4pm
    * say "good afternoon Steve" ~30
    * say "good evening Steve" ~30

$ /usr/bin/shortcuts run "Turn On Speakers"
!$ /usr/bin/shortcuts run "Turn Off Speakers"

$ /usr/bin/shortcuts run "Turn On Cup Warmer"
!$ /usr/bin/shortcuts run "Turn Off Cup Warmer"

$ /usr/bin/shortcuts run "Turn On Laptop Power"
!$ /usr/bin/shortcuts run "Turn Off Laptop Power"

# Apps to Launch 

Messages ~10
Calendar ~10

OmniFocus ~20
CARROTweather ~25

The if statement is just a fun bit to let me know when everything is done. The “*” (asterrisk) indicates that this line is an AppleScript command.

The “$” lines are shell scripts, the “!” is use to indicate that a command (any command, not just shell scripts) is only run when the Bunch is closed. These simple shell scripts are used to run Shortcuts which turn on/off outlets in a smart power strip.

As the If statement and Shell Scripts are not desktop related it doesn’t really matter when they happen in the sequence.

The {^5} switches to Desktop 5, where Mail, Safari, NetNewsWire, are opened. Music then opens on Desktop 6 as it is set to that specific desktop. Messages and Calendar wait 10 seconds, and then open on Desktop 6, after Music. OminFocus then opens after a further delay (set to Desktop 7) and CarrotWearhter 5 seconds later (set to Desktop 10). Note the odd spelling of CARROTweather, that is how the app name is, and the app name must be exact.

I currently have twelve bunches defined, most set to open items across multiple spaces, for different contexts. And while I do not do so, Bunch files can be called from Better Touch Tool and Alfred.

The Bunch documentation is well written and very helpful. And Brent Terpsta, the developer, has also been helpful when I’ve posted questions in the Bunch forum.

I recommend Bunch highly. And I hope this helps. Let me know if you have any questions.

Thank you, thank you for your detailed description of your morning startup.

Very helpful. I’m excited to create a morning workflow using Bunch.

1 Like

Good luck and have fun!

And of course don’t hesitate to ask questions.