With MaxTo, you can use recipes to launch any program and place it where you want. Browsers are however somewhat special.
The reason browsers are a bit different than most other programs, is that the process you launch is usually not the
same process that shows the window. When you launch e.g.
chrome https://maxto.net
,
the process that starts isn't the same process that shows the website — it simply sends a signal to an existing
browser window that the user wants to open the URL. If you don't already have a browser open, it will start another
process, and then signal it. Then the initial process will exit. It can also be hard to locate the browser window
that contains the page you launched, as the window title of the browser is the currently active tab, which is not
necessarily the website you launched.
This means that it can be difficult to create the same recipe as you would for other programs, where the flow is basically launch program, wait for it to be ready, then do something to the foreground window.
Goal
The goal of this how-to is to create a recipe that launches a new browser window that we place in a region on a specific virtual desktop when we press a hotkey. We'll try to do this Google Chrome and Firefox, but the same exact example should also work well with most Chromium-based browsers (as they share the same command line arguments).
We will not just show you exactly how to create this recipe, but will also try to outline how we figured out what to do as well.
Background research
Before we start, it always helps to do some background research on the command line for the browsers.
Google Chrome (and other Chromium browsers)
Firefox
In summary, we can see that both browsers support opening a URL in a new window, which will likely let us target the newly opened window in our recipe.
Creating the recipe
Don't want to go through all these steps?
Yeah, I know, it looks like a lot of work. I've exported the final recipe (for Google Chrome) so you can just download it. Once you have the file, click Import recipe in the Recipes tab in Settings. There you go, saved you 2 minutes.
Get started by creating a new recipe in the Recipes view in Settings (hit Control T to open Settings).
Give your recipe a name, and click Add trigger.
We are looking for a hotkey trigger, it should be right at the top.
Assign a hotkey, we chose Control X , and afterwards click Add ingredient.
PS! You can click on the dropdown and simply press the button on the keyboard that you want to use.
This time we want the "Launch a program" ingredient, you can find it at the bottom:
You'll need to fill in a few details here, including the path to Google Chrome (may vary a bit depending on which
version you have installed), the arguments
--new-window https://maxto.net
and
make sure it waits for the specific window
* - MaxTo - Google Chrome
.
From observation we know that the title of the MaxTo website we are opening is usually "Home - MaxTo", but if your browser switches language it can be "Hjem - MaxTo" (or some text in other languages), which is the reason for using a wildcard.
On portable paths
MaxTo is offering to help you fix a non-portable file path in the image below. Note that in the recipe file we have prepared, we've replaced the static file path with a file path containing an environment variable. MaxTo fixed that for us, a feature which is mostly useful if you intend to share your recipes with others.
Finally, click Add ingredient to add a second ingredient.
We now want to add the ingredient that will move the window to a specific region in a virtual desktop, so select the Move window command.
You can use the same arguments for finding the window as you did earlier, and then set the numbered virtual desktop to 2, and the region to top right. Once you are done, hit Save changes, and the recipe will be available to run immediately.
Before you run the recipe, make sure you have at least two virtual desktops. Press Control to switch to the next one. If nothing happens when you do that, you can press Control D to create one.
Test your recipe by hitting your hotkey (mine was Control X ). You will notice that Google Chrome launches, and after the website has loaded, MaxTo will move the window to the other virtual desktop.
This takes a while because MaxTo has to wait for the window to be created, and for the website to load, before it can find the window and move it.