From df430537e53b520fabb61032e50be9b8d92400bc Mon Sep 17 00:00:00 2001 From: jgclark Date: Tue, 24 Oct 2023 09:47:26 +0100 Subject: [PATCH] Improve docs + logging --- jgclark.WindowSets/README.md | 12 ++++++++---- jgclark.WindowSets/src/WSHelpers.js | 4 ++-- jgclark.WindowSets/src/windowSets.js | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/jgclark.WindowSets/README.md b/jgclark.WindowSets/README.md index b14148e6d..99bf465a5 100644 --- a/jgclark.WindowSets/README.md +++ b/jgclark.WindowSets/README.md @@ -8,19 +8,23 @@ The commands are simple: As monitor dimensions vary widely, a window set layout is specific to the particular macOS 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. - - -_If you want to dig into more detail, and tweak more of what's going on, please read on. But you shouldn't need to for most use of saving and opening window sets._ - [Buy Me A Coffee](https://www.buymeacoffee.com/revjgc)
+ + +## Known limitations +Unfortunately because of limitations in the API that plugins use, WindowSets: +1. can't control the width of split windows within the main NotePlan window. +2. 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.) + ## Configuration Click the gear button on the **Window Sets** line in the Plugin Preferences panel, and configure the two general 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 on. But you shouldn't need to for most use of saving and opening window sets._ ## Defining Window Sets These are defined in a special note; by default this is `@Window Sets/Windows Sets` but can be changed in the plugin Settings. All Window Sets are defined in a code block in JSON format. When first run it will offer to write out some examples for you to use or modify. diff --git a/jgclark.WindowSets/src/WSHelpers.js b/jgclark.WindowSets/src/WSHelpers.js index 64dee4d4c..56f7654a9 100644 --- a/jgclark.WindowSets/src/WSHelpers.js +++ b/jgclark.WindowSets/src/WSHelpers.js @@ -484,7 +484,7 @@ const exampleWSs: Array = [ "editorWindows": [ { "noteType": "Calendar", - "windowType": "split", + "windowType": "main", "filename": "{-1d}", "title": "yesterday", "x": 0, @@ -530,7 +530,7 @@ const exampleWSs: Array = [ "editorWindows": [ { "noteType": "Calendar", - "windowType": "split", + "windowType": "main", "filename": "{-1w}", "title": "last week", "x": 0, diff --git a/jgclark.WindowSets/src/windowSets.js b/jgclark.WindowSets/src/windowSets.js index bc216b45c..60fdd29ec 100644 --- a/jgclark.WindowSets/src/windowSets.js +++ b/jgclark.WindowSets/src/windowSets.js @@ -68,7 +68,7 @@ const pluginID = 'jgclark.WindowSets' export async function saveWindowSet(): Promise { try { if (NotePlan.environment.platform !== 'macOS' || NotePlan.environment.buildVersion < 1100) { - logInfo('saveWindowSet', `Window Sets needs NotePlan v3.9.8 or later on macOS. Stopping.`) + logInfo(pluginJson, `Window Sets needs NotePlan v3.9.8 or later on macOS. Stopping.`) return } @@ -90,7 +90,6 @@ export async function saveWindowSet(): Promise { height: winRect.height, } }) - // logDebug('saveWindowSet', `Found ${String(editorWinDetails.length)} editor windows`) const htmlWinDetails: Array = NotePlan.htmlWindows.map((win) => { const winRect = win.windowRect @@ -105,7 +104,7 @@ export async function saveWindowSet(): Promise { height: winRect.height, } }) - // logDebug('saveWindowSet', `Found ${String(htmlWinDetails.length)} HTML windows`) + logDebug(pluginJson, `saveWindowSet starting with ${String(editorWinDetails.length)} editor + ${String(htmlWinDetails.length)} HTML windows`) if ((editorWinDetails.length + htmlWinDetails.length) < 2) { const answer = await showMessageYesNo("There's only 1 open window. Are you sure you want to continue to make a Window Set?") @@ -318,9 +317,10 @@ export async function saveWindowSet(): Promise { export async function openWindowSet(setName: string = ''): Promise { try { if (NotePlan.environment.platform !== 'macOS' || NotePlan.environment.buildVersion < 1100) { - logInfo('saveWindowSet', `Window Sets needs NotePlan v3.9.8 or later on macOS. Stopping.`) + logInfo(pluginJson, `Window Sets needs NotePlan v3.9.8 or later on macOS. Stopping.`) return false } + logDebug(pluginJson, `openWindowSet starting with param setName '${setName}'`) const config = await wsh.getPluginSettings() const thisMachineName = NotePlan.environment.machineName