app.loshadki

OpenIn 4

Documentation - 13. Tutorial: Configuring rules based on the Focus selected in macOS system

Table of content

The goal of this tutorial is to show you how you can configure different browsers for different Focuses defined in the macOS System Settings.

We will create a rule for the focus Work. For other focuses we will consider them as Home focus and always use Safari as the default browser, and for the Work focus we will use Google Chrome. Additionally, we will create a rule that will allow us to choose the browser when the Command key is pressed.

We assume that you have already configured OpenIn as the default browser on your macOS using the tutorial.

Configuring OpenIn

Add browsers that you want to use with URL links. In our case, we added Safari and Google Chrome with default configurations.

Add browsers

Add browsers

At this point, if we click a link, we will see a browser selection with both browsers in the list.

Default app selection

Default app selection

Adding rules

Add rule that we will execute by default with Safari browser

Click Add rule….

In the Rule editor, type the name Default, change Use applications to Selected and select only Safari from the list.

After that, press Save to save the rule.

Default rule

Default rule

If you try to click a link anywhere in the system, it will be opened by default in Safari.

Add rule that we will execute by default with Google Chrome browser, but only when Focus Hint is set to Work

Add another rule by clicking Add rule….

This time name it Work, change Use applications to Selected and select only Google Chrome from the list.

While editing this rule, click on Edit focus hints and add a new Focus hint with the name Work.

After that, save the rule.

Work rule

Work rule

This rule does not affect anything in your system yet, because we will need to connect the Focus Hint with the Focus defined in System Settings.

Add another rule by clicking Add rule….

Name it Command, enable the Command key for Execute when -> With Key Modifiers. And save it after that.

Command rule

Command rule

At this point, if you click a link it will open the Safari browser by default. But when you click a link while pressing Command, OpenIn will show you the browser selection.

Order of the rules

After adding all rules, in the OpenIn Browsers Preferences you should see browsers and a list of rules as in the screenshot below.

The order of the rules is important. OpenIn matches each rule one by one while trying to find which rule matches the opening context.

The first rule will be executed only when Command is pressed, and if not, OpenIn will go to the next rule.

The second rule will be executed only when a Focus Hint is transferred from the System Focus (we have not defined it yet).

And the last rule does not have any filtering in it, so this rule will always be executed when none of the previous rules matched the opening context.

Browsers with rules

Browsers with rules

Defining focuses in the System Settings

Open System Settings and navigate to the Focus menu. Select the Work focus (or create one).

While editing the Work focus, click on Add filter….

Work focus

Work focus

In the list, select the OpenIn application (if you don’t see OpenIn in the list, make sure it is installed under the /Applications/ folder and try to reboot your Mac).

Add app filter

Add app filter

In the list of Focus Hints, select Work (this list shows you all focus hints defined within OpenIn applications). After that, click Add to save the App filter.

OpenIn app filter

OpenIn app filter

After doing this, you should see that OpenIn now has a filter based on the Focus Hint defined in the Work focus.

Work focus with app filter

Work focus with app filter

Time to test it!

Open, for example, Notes.app and type some URL there, like https://apple.com.

  • Change the Focus to Work and try to click it. OpenIn should open this URL in Google Chrome.
  • Remove Focus, or change the focus to any other defined on your system. Now when you click the link, OpenIn should open the link in Safari.
  • With or without Focus defined, try clicking the link with Command pressed on your keyboard. OpenIn will show you the browser selection.