Russia has attacked Ukraine. We stand with Ukraine.
Partial income from our applications goes to support Ukraine.

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 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 will use Safari as 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 already configured OpenIn as a default browser on your macOS using tutorial.

Configuring OpenIn

Add browsers that you want to use with the 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 the Edit focus hints and add a new Focus hint with 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 Focus Hint with Focus defined in System Settings.

Add another rule by clicking Add rule….

Name it Command, enable 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 Safari browser by default. But when you click link while pressing Command OpenIn will show you browser selection.

Order of the rules

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

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

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

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

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

Browsers with rules

Browsers with rules

Defining focuses in the System Settings

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

While editing Work focus click on Add filter….

Work focus

Work focus

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

Add app filter

Add app filter

In the list of Focus Hint select Work (this list shows you all focus hints defined within OpenIn applications). After that click Add to save 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, a 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 focus to any other defined on your system, now when you click the link, OpenIn should open link in Safari.
  • With of without Focus defined try clicking the link with Command pressed on your keyboard, OpenIn will show you browser selection.