Jump to content

Recommended Posts

This Alfred workflow opens a new Notion window when supplied the keyword "nn".

 

The Github repository for the workflow can be found here. To download the Alfred workflow directly, click this link.

 

This workflow was made for Mac OS using Apple script (which you can see in the Github repo).

Edited by eupraxia
Link to comment
  • 2 weeks later...
On 5/5/2022 at 7:44 AM, heyjoetofu said:

Thanks! But does it need to open the Public Example page in the browser?

 

Edit: I've since changed the workflow to simply open a duplicate of whatever page you're on. This solved the issue of the prior page navigating "back" one page when the new page was opened.

 

Oh, is the workflow opening Notion to the web browser as opposed to the Mac app?

 

I may have forgotten to explain this part. See if this works for you. If it does, I'll update the workflow accordingly :)

 

I've created my own public example page in Notion, so you can test the workflow before plugging in your own link. This will allow us to make sure it's working before you customise it to open the Notion page that you want it to open.

 

The code in the Apple script is as follows, this time with my freshly created (and public) example page:
 

on alfred_script(q)

	tell application "Notion" to activate
	tell application "System Events" to keystroke "n" using {command down, shift down}
	tell application "Notion" to open location {"notion://www.notion.so/tommarshall/Example-c8c0ea70bd094a82a40f1ee3c11c4169"}

end alfred_script

 

Go into the workflow on Alfred, right click on the "Run NSAppleScript" object, click "Configure Object...", delete the entire existing script, and replace it with the code above.

 

Once you've done that, when you run the shortcut (i.e. without modifying it at all) it should open a page called "Example" with a brief note of jubilation that the workflow appeared to work. If that page successfully opened in Notion—yay! If you run into any issues, please let me know!

 

Also, in case I wasn't clear in the README, this is how you paste in your own link:

 

To make the shortcut open your Notion page within Notion's Mac App (rather than in your browser), simply copy the link to your Notion page (which is just a regular old URL), delete the `https` at the beginning of the URL, and replace the `https` with `notion` so that you end up with a link the beginning of which looks like the link in the code block above.

 

That's literally all you need to do--replace the link with your own, and replace `https` with `notion`, and it should work. If it doesn't, then I've screwed up 🥴.

Edited by eupraxia
Link to comment

Ah, gotcha. Sorry, I absolutely didn't make the connection to not only change the https:// to notion:// but to change the link as well. For some reason I assumed the example page had something to do with functionality. 🤦‍♂️ (Weirdly enough the example page opened in the browser AND the app when I first changed the https-link to a notion-link, so that was irritating as well).

 

Thanks for clarifying, everything's working perfectly now!

Link to comment
21 hours ago, heyjoetofu said:

Ah, gotcha. Sorry, I absolutely didn't make the connection to not only change the https:// to notion:// but to change the link as well. For some reason I assumed the example page had something to do with functionality. 🤦‍♂️ (Weirdly enough the example page opened in the browser AND the app when I first changed the https-link to a notion-link, so that was irritating as well).

 

Thanks for clarifying, everything's working perfectly now!

 

Not at all—it’s the maker’s job to clearly communicate how their thing works!

 

Glad all working smoothly! If you like it, you might like some of my other shortcuts (they’re all pretty simple and similar in spirit). They’re all on my GitHub page :)

 

Edited by eupraxia
Link to comment

Thank you, eupraxia, for this fantastic time-saving workflow. It works great!
 

However, is it possible to force the Notion to open the new window in the current workspace Desktop? This could be a mac issue rather than something specific to Notion. 
 

So, I have multiple Desktops and have Notion loaded in some of these. If I'm working on a particular workspace and use your workflow, it will open Notion in the last workspace that Notion used. Moreover, it will cause the already open notion page to switch to the new page. I just opened and loaded up another Notion copy with the intended page. 

Sorry if the above is not clear; I'm new to Alfred. To see what I'm referring to:
1) Open Notion in Desktop 1 with any page
2) Go to Desktop 2 from the mission control, and use the workflow to load Notion with the intended page
 

You will be switched (automatically) to Desktop one, where now you have the old notion page and the new notion page both set to the intended page. 

I have to click back (or cmd+[) on the previous notion window to set it back to what it was and then drag the newly opened notion window to the Desktop 2. 

Link to comment

Glad to hear it's on the right path to being useful to you, optimalflow!

 

On 5/12/2022 at 1:17 PM, optimalflow said:

So, I have multiple Desktops and have Notion loaded in some of these. If I'm working on a particular workspace and use your workflow, it will open Notion in the last workspace that Notion used. Moreover, it will cause the already open notion page to switch to the new page. I just opened and loaded up another Notion copy with the intended page. 

Sorry if the above is not clear; I'm new to Alfred. To see what I'm referring to:
1) Open Notion in Desktop 1 with any page
2) Go to Desktop 2 from the mission control, and use the workflow to load Notion with the intended page
 

You will be switched (automatically) to Desktop one, where now you have the old notion page and the new notion page both set to the intended page. 

I have to click back (or cmd+[) on the previous notion window to set it back to what it was and then drag the newly opened notion window to the Desktop 2. 

 

There's two problems I'm picking up on here:

A) when you use the shortcut, it pings back to the desktop where the Notion window is already open rather than opening it in situ on the desktop you're currently viewing.

B) the Notion page you have already open when you use the shortcut reverses to a prior page

 

For A: have you checked your settings in System Preferences > Mission Control ? There should be a box there that you can toggle on and off which says "When switching to an application, switch to a Space with open windows for the application. Try unticking that box, and see if problem persists.

 

For B: I've updated the shortcut on Github, which appears to have fixed the issue. Now, it will open the page you were on before, but it won't do anything to your currently open window. Let me know if this works.

 

When I have some time, I'll try and figure out a way to make it customisable so that it always opens at a particular page pre-designated by the user--whatever the user considers their own personal "home" page as far as this shortcut is concerned.

 

Hope this helps!

Link to comment
  • 3 months later...

My biggest problem with this workflow is that it opens a new notion window on the last virtual desktop that you had a notion window on.  I'd like for it to work like this, open a new notion window on the virtual desktop that you're on without having to turn off that feature in mission control of not switching to the space that an application is in.  It makes MacOS far less useable for someone like myself that uses 16 virtual desktops.  

Link to comment

Welcome @nokiafan,

 

I doubt that’s something the Workflow deliberately does. Apple doesn‘t even provide public APIs for the virtual desktops. If you want that behaviour to change you need to ask Apple (via the Feedback Assistant app) for them to change it or provide the APIs for the developers to do it themselves.

Link to comment
  • 4 months later...

@nokiafan I'm not sure I fully understand you.

 

By "virtual desktops" I take it you mean the desktops that come up in a bar at the top of the MacOS screen when you swipe down with 4 fingers (although it may be set to a different command for you)? I can also navigate those by using Ctrl + [left arrow key] or [right arrow key]? And it sounds like you're saying that, if you have two desktops open, and you have a Notion window open in, say, Desktop 2, and then you move over to Desktop 1 and execute the 'nn' workflow to open a new Notion window in Desktop 1, it flicks you back to Desktop 2?

 

I think I have a solution for you! I'm not 100% sure, but I think I had that problem and solved it--it was over 6 months ago now. I just did a quick Google, and I'm pretty sure this is what I did:

 

On this Apple support page, it explains:

Quote

By default, when switching to an app, the desktop automatically switches to a space that has open windows for the app. For example, if you create a new TextEdit document in Desktop 3, but TextEdit windows are already open in Desktop 2, your new document opens in Desktop 2. To change this setting, choose Apple menu  2f77cc85238452e25cb517130188bf99.png > System Settings, click Desktop & Dock 48ae9eda1b7aab1c2a7c6fcb3aff6aa8.png in the sidebar, go to Mission Control on the right, then turn “When switching to an application, switch to a Space with open windows for the application” on or off.

 

Basically, it seems like it's an option you can toggle on and off in Mac. I've had it turned off since I found this solution, and it's had zero noticeable side effects (i.e. it doesn't seem to impact any other functionality that I use on my Mac).

 

Let me know if it works for you!

Edited by eupraxia
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...