This plugin (which requires NotePlan version 3.9.8 or higher) gives some tools to help manage NotePlan's windows more easily:
- save different layouts ('Window Sets') of your NotePlan windows on macOS, and then restore them in just a few clicks. This includes ordinary notes, calendar notes and special 'html' windows created by some Plugins. (See more detail below.)
- swap split to main command (alias: swap) swaps the currently-selected split to main, or if no split is currently selected, asks the user which to swap
- move split to main command (alias: mstm) moves the currently-selected split pane to be the first one in the main window.
- constrain main window command (alias: cmw) moves the main window to make sure its fully in the screen area, shrinking it if it needs to.
- open note in new split: (alias: /onns) opens a user-selected note in a new split of the main window (*)
- open note in new window (alias: /onnw) opens a user-selected note in a new window (*)
- open current in new split: (alias: /ocns) opens the current note again in a new split of the main window (*)
- open current in new window: (alias: /ocnw) opens the current note again in a new floating window
(*) these were originally released in the Note Helpers plugin.
There are two main commands:
- /open window set (alias /ows): Open a saved set of windows/panes. You're shown a list of all existing window sets to choose from.
- /save window set (alias /sws): Save the size and position of currently open NotePlan windows and 'split' panes as a set. You're given the option to save any open calendar notes as either relative to today (e.g. 'yesterday' or 'next week'), or as a fixed note.
As monitor dimensions vary widely, a window set layout is specific to the particular Mac computer you've defined it on. If you have more than one then it will only show you the ones for the machine you're currently using.
You can also delete window set (alias /sws): You are shown a list of all existing window sets to choose from.
Unfortunately because of limitations in the API that plugins use, WindowSets:
- can't control the width of split windows within the main NotePlan window.
- can't control the order of windows that overlap, as the API doesn't supply the z-order of windows when saving a set. (Nor can it control the z-order of windows when opening a set.)
- doesn't seem to be able to set size/position of floating Editor windows.
Q: Why does this plugin create a new folder for me called @WindowSet? A: This is the way that all the details of a saved set can be displayed to users who want to be able to do advanced configuration.
Q: Can I delete this folder or re-organise it? A: Yes, you can delete it or move it (say to the Archive) if you don't intend to be doing advanced configuration (see below).
Click the gear button on the Window Tools line in the Plugin Preferences panel, and configure the two settings accordingly:
- Note title for Window Set definitions: defaults to
Window Sets. - Folder where Window Set definitions are stored: defaults to
@Window Sets.
If you want to dig into more detail, and tweak more of what's going on, please read the final section below. But you shouldn't need to for most use of saving and opening window sets.
The /open window set command can be triggered by opening a a special x-callback URL. The first argument is the name of the window set to open (with spaces replaced by %20.)`
For example to restore the 'Days + Weeks' Window Set:
noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20window%20set&arg0=Days%20%2B%20Weeks
The /open note in new split command can also be run this way. For example:
- to open 'Note Title':
noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20note%20in%20new%20split&arg0=Note%20Title - to open tomorrow's daily note:
noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20note%20in%20new%20split&arg0=tomorrow
Similarly for the /open note in new window command, for example noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20note%20in%20new%20window&arg0=Note%20Title.
You can trigger the /delete window set command for a particular named Window Set, for example noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=delete%20window%20nset&arg0=WS%20Name.
If you find an issue with this plugin, or would like to suggest new features for it, please raise a Bug or Feature 'Issue'.
If you would like to support my late-night work extending NotePlan through writing these plugins, you can through:
Thanks!
Please see the CHANGELOG.
Some people use NotePlan on more than one Mac, and they can have different screen dimensions, and therefore need different Window Sets.. For this reason, each Window Set is tied to the 'machineName' that it was created on. (This picks up the name you set in macOS' System Settings > General > Sharing > Local hostname.)
In more detail here is an annotated example of the code block in the special note:
(You might be wondering "Why doesn't it use the normal Plugin Preferences system?" The answer is that it isn't flexible enough to store the necessary details for an arbitrary number of window sets.)
Specific Calendar notes can be specified using their internal filenames (examples: 2023.md, 2023-Q3.md, 2023-09.md, 2023-W44.md, 20230903.md). More usefully, they can be specified as dates relative to today, using the special syntax options:
{+n[bdwmqy]}meaningnbusiness days/days/weeks/months/quarters/years after today{-n[bdwmqy]}meaningnbefore today{0[dwmqy]}meaning the current day/week/month/quarter/year.
For example, filenames of {-1w}, {0w},{1w} respectively means last week, this week and next week's notes.
It will do its best to identify the plugin command used to create the window, however this is based on a lookup list, and so may not include everything. It will tell you if you need to manually update the Window Set definition: just search for the ? which tell you where the command name needs adding.