Tools to help manage NotePlan windows on macOS, notably save and restore particular window layouts ('Window Sets').
This plugin gives some tools to help manage NotePlan's windows more easily:
Note: this plugin requires NotePlan version 3.9.8 or higher, and parts require v3.19.2.
There are two main commands:
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.
Note: these commands require NP v3.19.2 or higher for control of the main sidebar.
You can also delete Window Set (alias dws): You are shown a list of all existing window sets to choose from. Or you can delete all saved Window Sets.
Unfortunately because of limitations in the API that plugins use, Window Sets:
If these affect you, please write to the developer ([email protected] or on Discord).
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: I run on multiple Macs: when can't I see some Window Sets on some Macs? A: Different Macs tend to 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.) The plugin is smart enough to only show you the Window Sets created on the same machine.
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.
Q: How can I change the icon for Window Set names, as used in the Window Set menus? A: From plugin v1.4, you can manually update the Window Set definition note to set it -- see Advanced Configuration below.
Click the gear button on the Window Tools line in the Plugin Preferences panel, to update the settings:
Window Sets.@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:
noteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20note%20in%20new%20split&arg0=Note%20Titlenoteplan://x-callback-url/runPlugin?pluginID=jgclark.WindowTools&command=open%20note%20in%20new%20split&arg0=tomorrowSimilarly 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' in GitHub.
If you would like to support my late-night work extending NotePlan through writing these plugins, you can through:
Thanks!
Please see the CHANGELOG.
In more detail here is an annotated example of the code block in the special note:
"WS":
[ // array of sets
{
"name": "Some relative dates", // name you give the set. Should be unique per machine
"machineName": "mba2.local", // name from macOS
"editorWindows": [
{ // define first note, in this case actually a folder
"x": 684, // window starts 684 pixels from left
"y": 0, // and 0 pixels from bottom
"height": 623, // window height
"width": 652, // window width
"noteType": "Folder",
"title": "Projects", // folder name
"windowType": "main", // the first ('main') window in NP
"filename": "Projects" // folder path
},
{ // define second note: the ordering of elements doesn't matter, and tends not to be maintained
"x": 684, // window starts 684 pixels from left
"y": 0, // and 0 pixels from bottom
"height": 623, // window height
"width": 652, // window width
"noteType": "Calendar",
"title": "today", // relative or specific calendar date
"windowType": "split", // a 'split' pane in the main NP window
"filename": "{0d}" // i.e. 0 days from today
},
{ // define third note
"noteType": "Notes",
"x": 966,
"height": 623,
"y": 107,
"width": 450,
"filename": "", // filename of the note, relative to the root of NotePlan's notes
"title": "Window Sets", // title of the note
"windowType": "split" // another 'split' pane in the main NP window
},
{
"x": 954,
"height": 623,
"y": 51,
"noteType": "Notes",
"title": "Window Sets",
"windowType": "floating", // a separate, 'floating' window
"width": 450,
"filename": "@WindowSets/Window Sets.md"
}
],
"htmlWindows": [ // array can be empty
{
"type": "html",
"pluginID": "jgclark.Dashboard",
"pluginCommandName": "Show Dashboard",
"customId": "jgclark.Dashboard.main",
"x": 1617,
"y": 780,
"width": 941,
"height": 596
}
],
"closeOtherWindows": true, // when opening this window set, should existing windows/splits be closed?
"mainSidebarWidth": 250, // (from v1.4, optional) width of main (left) sidebar, in pixels
"icon": "window-restore", // (from v1.4, optional) icon as used in note frontmatter
"iconColor": "#AA6734" // (from v1.4, optional) hexadecimal color (note: not Tailwind colors as used in note frontmatter)
}
]
}
Note: you can't actually include comments in the code block (for this breaks JSON).
(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]} meaning n business days/days/weeks/months/quarters/years after today{-n[bdwmqy]} meaning n before 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.
When you create a Window Set it will do its best to identify the plugin command used to create an 'HTML' 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.
If you find an issue with this plugin, or would like to suggest new features for it, please raise a Bug or Feature 'Issue' in GitHub.
If you would like to support my late-night work extending NotePlan through writing these plugins, you can through:
Thanks!
Please see the CHANGELOG.