From 650ac550fab8184501bbbbb0475f8e6e54e795f5 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 1 Nov 2020 14:21:00 +1100 Subject: [PATCH 01/10] tab favicon fixes: support uploaded images, use emoji for window title, work on macos --- mods/core/client.js | 53 +++++++++++++++++++++++------------------- mods/core/css/tabs.css | 3 +++ mods/core/render.js | 26 ++++++++++++--------- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/mods/core/client.js b/mods/core/client.js index 0ddafe2..f31ab8c 100644 --- a/mods/core/client.js +++ b/mods/core/client.js @@ -217,7 +217,7 @@ module.exports = (store, __exports) => { electron.ipcRenderer.on('enhancer:get-menu-theme', setThemeVars); if (tabsEnabled) { - let tab_title = ''; + let tab_title = { img: '', emoji: '', text: '' }; if (process.platform === 'darwin') document .querySelector('.notion-sidebar [style*="37px"]:empty') @@ -227,30 +227,27 @@ module.exports = (store, __exports) => { ); __electronApi.setWindowTitle = (title) => { const $container = - document.querySelector( - '.notion-peek-renderer [style="padding-left: calc(126px + env(safe-area-inset-left)); padding-right: calc(126px + env(safe-area-inset-right)); max-width: 100%; width: 100%;"]' - ) || - document.querySelector( - '.notion-frame [style="padding-left: calc(96px + env(safe-area-inset-left)); padding-right: calc(96px + env(safe-area-inset-right)); max-width: 100%; margin-bottom: 8px; width: 100%;"]' - ) || document.querySelector('.notion-peak-renderer') || document.querySelector('.notion-frame'), icon = $container.querySelector( - '.notion-record-icon [aria-label]:not([src^="data:"])' + '[style*="env(safe-area-inset-left)"] > .notion-record-icon img:not([src^="data:"])' ), - text = $container.querySelector('[placeholder="Untitled"]'); - title = - (icon - ? icon.getAttribute('src') - ? `` - : `${icon.getAttribute('aria-label')} ` - : '') + - (text - ? text.innerText || 'Untitled' - : [ - setTimeout(() => __electronApi.setWindowTitle(title), 250), - title, - ][1]); + img = + icon && icon.getAttribute('src') + ? `` + : '', + emoji = icon ? icon.getAttribute('aria-label') : ''; + let text = $container.querySelector('[placeholder="Untitled"]'); + text = text + ? text.innerText || 'Untitled' + : [ + setTimeout(() => __electronApi.setWindowTitle(title), 250), + title, + ][1]; TITLE_OBSERVER.disconnect(); TITLE_OBSERVER.observe($container, { childList: true, @@ -258,9 +255,17 @@ module.exports = (store, __exports) => { characterData: true, attributes: true, }); - if (tab_title !== title) { - tab_title = title; - electron.ipcRenderer.sendToHost('enhancer:set-tab-title', title); + if ( + tab_title.img !== img || + tab_title.emoji !== emoji || + tab_title.text !== text + ) { + tab_title = { + img, + emoji, + text, + }; + electron.ipcRenderer.sendToHost('enhancer:set-tab-title', tab_title); } }; __electronApi.openInNewWindow = (urlPath) => { diff --git a/mods/core/css/tabs.css b/mods/core/css/tabs.css index cbde34a..be0633e 100644 --- a/mods/core/css/tabs.css +++ b/mods/core/css/tabs.css @@ -131,7 +131,10 @@ body, opacity: 0.8; } #tabs .tab img { + object-fit: cover; + height: 1em; width: 1em; + border-radius: 3px; margin: 0 0.5em -3px 0.1em; } #tabs .tab:first-child { diff --git a/mods/core/render.js b/mods/core/render.js index 12252a1..222f1b3 100644 --- a/mods/core/render.js +++ b/mods/core/render.js @@ -383,13 +383,13 @@ module.exports = (store, __exports) => { if (selected) { this.views.active = +id; this.views.loaded[id].focus(); - const electronWindow = electron.remote.getCurrentWindow(); - if ( - electronWindow && - electronWindow.getTitle() !== this.state.tabs.get(+id).title - ) { - electronWindow.setTitle(this.state.tabs.get(+id).title); - } + const electronWindow = electron.remote.getCurrentWindow(), + title = + (this.state.tabs.get(+id).emoji + ? `${this.state.tabs.get(+id).emoji} ` + : '') + this.state.tabs.get(+id).text; + if (electronWindow && electronWindow.getTitle() !== title) + electronWindow.setTitle(title); } } } @@ -427,6 +427,7 @@ module.exports = (store, __exports) => { document.body.style.setProperty(style[0], style[1]); break; case 'enhancer:set-tab-title': + console.log(event.args[0]); if (this.state.tabs.get(+event.target.id)) { this.setState({ tabs: new Map( @@ -436,12 +437,15 @@ module.exports = (store, __exports) => { }) ), }); - const electronWindow = electron.remote.getCurrentWindow(); + const electronWindow = electron.remote.getCurrentWindow(), + title = + (event.args[0].emoji ? `${event.args[0].emoji} ` : '') + + event.args[0].text; if ( event.target.id == this.views.current.id && - electronWindow.getTitle() !== event.args[0] + electronWindow.getTitle() !== title ) - electronWindow.setTitle(event.args[0]); + electronWindow.setTitle(title); } break; case 'enhancer:select-tab': @@ -746,7 +750,7 @@ module.exports = (store, __exports) => { }, React.createElement('span', { dangerouslySetInnerHTML: { - __html: title, + __html: (title.img || '') + title.text, }, }), React.createElement( From 6b161eb40309b3eb41fcd7c62830e6937f71560e Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 1 Nov 2020 14:39:06 +1100 Subject: [PATCH 02/10] better selectors for detecting favicons in databases --- mods/core/client.js | 8 +++++++- mods/core/css/tabs.css | 12 ++++++------ mods/core/render.js | 1 - 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mods/core/client.js b/mods/core/client.js index f31ab8c..9a6b386 100644 --- a/mods/core/client.js +++ b/mods/core/client.js @@ -227,10 +227,16 @@ module.exports = (store, __exports) => { ); __electronApi.setWindowTitle = (title) => { const $container = + document.querySelector( + '.notion-peek-renderer [style="padding-left: calc(126px + env(safe-area-inset-left)); padding-right: calc(126px + env(safe-area-inset-right)); max-width: 100%; width: 100%;"]' + ) || + document.querySelector( + '.notion-frame [style="padding-left: calc(96px + env(safe-area-inset-left)); padding-right: calc(96px + env(safe-area-inset-right)); max-width: 100%; margin-bottom: 8px; width: 100%;"]' + ) || document.querySelector('.notion-peak-renderer') || document.querySelector('.notion-frame'), icon = $container.querySelector( - '[style*="env(safe-area-inset-left)"] > .notion-record-icon img:not([src^="data:"])' + '.notion-record-icon img:not([src^="data:"])' ), img = icon && icon.getAttribute('src') diff --git a/mods/core/css/tabs.css b/mods/core/css/tabs.css index be0633e..8711940 100644 --- a/mods/core/css/tabs.css +++ b/mods/core/css/tabs.css @@ -127,7 +127,7 @@ body, font-size: 1.15em; padding: 0.2em 0.4em; text-align: left; - border-bottom: 4px solid var(--theme--table-border); + border-bottom: 0.22em solid var(--theme--table-border); opacity: 0.8; } #tabs .tab img { @@ -135,14 +135,14 @@ body, height: 1em; width: 1em; border-radius: 3px; - margin: 0 0.5em -3px 0.1em; + margin: 0 0.5em -0.16em 0.1em; } #tabs .tab:first-child { margin-top: 0.5em; } #tabs .tab:not(.new) span:not(.close) { width: 8.5em; - margin-right: 4px; + margin-right: 0.22em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -162,7 +162,7 @@ body, #tabs .tab.current { opacity: 1; background: var(--theme--selected); - border-bottom: 4px solid var(--theme--option_active-background); + border-bottom: 0.22em solid var(--theme--option_active-background); } #tabs .tab.new { background: none; @@ -179,7 +179,7 @@ body, #tabs .tab .close:hover, #tabs .tab.new span:hover, #titlebar .window-button:hover { - border-radius: 4px; + border-radius: 0.22em; background: var(--theme--table-border); box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border); } @@ -188,7 +188,7 @@ body, color: var(--theme--button_close-fill); } #tabs .tab.dragged-over { - box-shadow: inset 4px 0 0 0 var(--theme--selected); + box-shadow: inset 0.22em 0 0 0 var(--theme--selected); } .notion { diff --git a/mods/core/render.js b/mods/core/render.js index 222f1b3..8377f77 100644 --- a/mods/core/render.js +++ b/mods/core/render.js @@ -427,7 +427,6 @@ module.exports = (store, __exports) => { document.body.style.setProperty(style[0], style[1]); break; case 'enhancer:set-tab-title': - console.log(event.args[0]); if (this.state.tabs.get(+event.target.id)) { this.setState({ tabs: new Map( From ba8163a456a73ed3b39480b339612c203951371b Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 1 Nov 2020 15:00:22 +1100 Subject: [PATCH 03/10] #113 reshow hidden windows when clicking app icon in dock --- mods/core/tray.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/mods/core/tray.js b/mods/core/tray.js index 9e832a1..d85c9fe 100644 --- a/mods/core/tray.js +++ b/mods/core/tray.js @@ -7,6 +7,8 @@ 'use strict'; +const { start } = require('repl'); + let tray, enhancer_menu; module.exports = (store, __exports) => { @@ -16,7 +18,17 @@ module.exports = (store, __exports) => { is_win = process.platform === 'win32', helpers = require('../../pkg/helpers.js'); - electron.app.on('ready', () => { + electron.app.on('second-instance', (event, args, workingDirectory) => { + if (!store().openhidden) { + electron.BrowserWindow.getAllWindows().forEach((window) => { + window.show(); + window.focus(); + if (store().maximized) window.maximize(); + }); + } + }); + + electron.app.once('ready', () => { // tray tray = new electron.Tray( @@ -215,30 +227,27 @@ module.exports = (store, __exports) => { // hotkey - function showWindows() { - const windows = electron.BrowserWindow.getAllWindows(); + function showWindows(windows) { if (is_mac) electron.app.show(); if (store().maximized) windows.forEach((win) => [win.maximize()]); else windows.forEach((win) => win.show()); electron.app.focus({ steal: true }); } - function hideWindows() { - const windows = electron.BrowserWindow.getAllWindows(); + function hideWindows(windows) { windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); if (is_mac) electron.app.hide(); } function toggleWindows() { const windows = electron.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isVisible())) hideWindows(); - else showWindows(); + if (windows.some((win) => win.isVisible())) hideWindows(windows); + else showWindows(windows); } - tray.on('click', toggleWindows); electron.globalShortcut.register(store().hotkey, () => { const windows = electron.BrowserWindow.getAllWindows(); if (windows.some((win) => win.isFocused() && win.isVisible())) - hideWindows(); - else showWindows(); + hideWindows(windows); + else showWindows(windows); }); }); }; From 64c1e8bc5c2a3ab1264d5d690d800b6a54f6f1ab Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 1 Nov 2020 21:04:26 +1100 Subject: [PATCH 04/10] #113 only open a new window from the dock if already visible --- mods/core/tray.js | 40 ++++++++++++++++++++-------------------- pkg/apply.js | 13 +++++++++---- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/mods/core/tray.js b/mods/core/tray.js index d85c9fe..e729328 100644 --- a/mods/core/tray.js +++ b/mods/core/tray.js @@ -7,8 +7,6 @@ 'use strict'; -const { start } = require('repl'); - let tray, enhancer_menu; module.exports = (store, __exports) => { @@ -16,11 +14,25 @@ module.exports = (store, __exports) => { path = require('path'), is_mac = process.platform === 'darwin', is_win = process.platform === 'win32', - helpers = require('../../pkg/helpers.js'); + helpers = require('../../pkg/helpers.js'), + getAllWindows = electron.BrowserWindow.getAllWindows; + + function newWindow() { + require('./createWindow.js')( + store, + require(path.resolve(`${helpers.__notion}/app/main/createWindow.js`)) + )( + '', + getAllWindows().find((win) => win !== enhancer_menu) + ); + } electron.app.on('second-instance', (event, args, workingDirectory) => { - if (!store().openhidden) { - electron.BrowserWindow.getAllWindows().forEach((window) => { + const windows = getAllWindows(); + if (windows.some((win) => win.isVisible())) { + newWindow(); + } else { + windows.forEach((window) => { window.show(); window.focus(); if (store().maximized) window.maximize(); @@ -186,19 +198,7 @@ module.exports = (store, __exports) => { { type: 'normal', label: 'New Window', - click: () => { - require('./createWindow.js')( - store, - require(path.resolve( - `${helpers.__notion}/app/main/createWindow.js` - )) - )( - '', - electron.BrowserWindow.getAllWindows().find( - (win) => win !== enhancer_menu - ) - ); - }, + click: newWindow(), accelerator: 'CommandOrControl+Shift+N', }, { @@ -238,13 +238,13 @@ module.exports = (store, __exports) => { if (is_mac) electron.app.hide(); } function toggleWindows() { - const windows = electron.BrowserWindow.getAllWindows(); + const windows = getAllWindows(); if (windows.some((win) => win.isVisible())) hideWindows(windows); else showWindows(windows); } tray.on('click', toggleWindows); electron.globalShortcut.register(store().hotkey, () => { - const windows = electron.BrowserWindow.getAllWindows(); + const windows = getAllWindows(); if (windows.some((win) => win.isFocused() && win.isVisible())) hideWindows(windows); else showWindows(windows); diff --git a/pkg/apply.js b/pkg/apply.js index a91a6f6..3b03554 100644 --- a/pkg/apply.js +++ b/pkg/apply.js @@ -121,10 +121,15 @@ module.exports = async function ({ overwrite_version, friendly_errors } = {}) { if (err) throw err; fs.writeFile( insertion_file, - `${data.replace( - /process.platform === "win32"/g, - 'process.platform === "win32" || process.platform === "linux"' - )}\n\n//notion-enhancer\nrequire('${helpers.realpath( + `${data + .replace( + /process.platform === "win32"/g, + 'process.platform === "win32" || process.platform === "linux"' + ) + .replace( + /else \{[\s\n]+const win = createWindow_1\.createWindow\(relativeUrl\);/g, + 'else if (relativeUrl) { const win = createWindow_1.createWindow(relativeUrl);' + )}\n\n//notion-enhancer\nrequire('${helpers.realpath( __dirname )}/loader.js')(__filename, exports);`, 'utf8', From 27525428fcf329fdb3363ce13fb67fc3a10161b1 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 1 Nov 2020 22:53:11 +1100 Subject: [PATCH 05/10] README feature list updates: new mods + options --- CHANGELOG.md | 1 + CONTRIBUTING.md | 2 +- DOCUMENTATION.md | 26 ++++--- README.md | 139 ++++++++++++++++++++++++++++---------- bin.js | 2 +- mods/core/enhancerMenu.js | 57 ++++++++-------- mods/core/mod.js | 19 +++--- mods/focus-mode/mod.js | 4 +- mods/tweaks/mod.js | 6 +- 9 files changed, 162 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaff098..1915a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ a flexibility update. so system dark/light mode can be properly detected. - bugfix: make ctrl+f popover shadow less extreme. - bugfix: "weekly" calendar view name made case insensitive. +- bugfix: re-show hidden windows when clicking on the dock. - tweak: sticky table/list rows. - theme: "material ocean" = an oceanic colour palette. - theme: "dracula" = a theme based on the popular dracula color palette diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 035439f..f381af8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ npm unlink ## conventions -the enhancer can be categorised as a **core** extended by included **modules**. +the enhancer is a **core** extended by included **modules**. the core can be further split into the **installer** and the **modloader**. modules are either **extensions** or **themes**. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 7125130..d47411c 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -51,9 +51,14 @@ module.exports = { options?: Array<{ key: String, label: String, - description?: String, + desc?: String, type: String in ['toggle', 'select', 'input', 'file'], - value: Boolean or Array or String or Number or null + value: Boolean or Array or String or Number or null, + platformOverwrite?: { + darwin?: Boolean or Array or String or Number or null, + win32?: Boolean or Array or String or Number or null, + linux?: Boolean or Array or String or Number or null, + } }>, fonts: Array of font_urls, hacks?: { @@ -95,14 +100,15 @@ if you'd rather customise this, pass this object: #### options -| key | value | type | -| ----------- | ---------------------------------------------------------------------------------------- | ----------------- | -| key | **required:** key to save value to the mod `store` | _string_ | -| label | **required:** short description/name of option to be shown in menu | _string_ | -| description | **optional:** extended information to be shown on hover | _string_ | -| type | **required:** input type (see below) | _string_ | -| extensions | **optional:** allowed file extensions (only use with a file option), e.g. `['js', 'ts']` | _array\_ | -| value | **optional:** default or possible value/s for option | see below | +| key | value | type | +| ----------------- | ---------------------------------------------------------------------------------------- | ------------------------- | +| key | **required:** key to save value to the mod `store` | _string_ | +| label | **required:** short description/name of option to be shown in menu | _string_ | +| desc | **optional:** extended information to be shown on hover | _string_ | +| type | **required:** input type (see below) | _string_ | +| extensions | **optional:** allowed file extensions (only use with a file option), e.g. `['js', 'ts']` | _array\_ | +| value | **optional:** default or possible value/s for option | see below | +| platformOverwrite | **optional:** remove the option from the menu and force a value on a specific platform | __ as shown above | | type | value | | ------ | -------------------- | diff --git a/README.md b/README.md index 1decf7e..a6d6ef5 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ then execute the following lines in the terminal: ``` sudo chmod -R a+wr /usr/local/lib/node_modules sudo chmod -R a+wr /usr/local/bin -sudo chmod -R a+wr /Applications/Notion/Contents/Resources sudo chmod -R a+wr /Applications/Notion.app/Contents/Resources npm i -g notion-enhancer ``` @@ -92,35 +91,37 @@ For more info, run any command with the `--help` flag: Options: -y, --yes : skip prompts (may overwrite data) -n, --no : skip prompts (may cause failures) - -d, --dev : show detailed error messages (not recommended) + -d, --dev : show detailed error messages (for debug purposes) -h, --help : display usage information -v, --version : display version number ``` ### faq -**the themes aren't working?** +**when will the update be out?** +i code this in my free time, in-between my other commitments. there are no ETAs. +**the themes aren't working?** if you pick a dark theme it will only be applied if notion is in dark mode, and if you pick a light theme it will only work if notion is in light mode. do `CMD/CTRL+SHIFT+L` to toggle between them. **is this against notion's terms of service? can i get in trouble for using it?** - definitely not! i contacted their support team to check, and the response was awesome: -"Thanks for taking the time to share this with us. Userscripts and userstyles are definitely -cool ideas and would be helpful for many users! ... I'll also share this with the rest of the -team to take to heart for future improvements." +> "Thanks for taking the time to share this with us. Userscripts and userstyles are definitely +> cool ideas and would be helpful for many users! ... I'll also share this with the rest of the +> team to take to heart for future improvements." + +**how do i uninstall the enhancer?** +run `npm remove -g notion-enhancer`. ## features most of the enhancer's functionality is split into configurable enhancement modules, -but some basic improvements are built in by default: +but some basic improvements necessary for things to work are built in by values: - the notion:// url scheme/protocol is patched to work on linux. -- in-page columns are disabled/wrapped and pages are wider when - the window is narrower than 600px for improved responsiveness. - a tray/menubar icon: links relevant to the enhancer + buttons to manage notion windows. once applied, modules can be configured via the graphical menu, @@ -137,22 +138,54 @@ these include: **description:** the cli, modloader, menu, & tray. -**author**: [dragonwocky](https://github.com/dragonwocky/) +**author:** [dragonwocky](https://github.com/dragonwocky/) -| option | type | default | -| ----------------------------- | --------------------------------------------------------------------------------------------- | -------------------------- | -| hide app on open | toggle | no | -| auto-maximise windows | toggle | no | -| close window to the tray | toggle | yes | -| integrated titlebar | toggle | yes | -| height of frameless dragarea | number input | `15` | -| tiling window manager mode | toggle | no | -| integrated scrollbars | toggle | yes | -| window display hotkey | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+Shift+A` | -| open enhancements menu hotkey | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `Alt+E` | +| option | extended description | type | values/defaults | platform-specific details | +| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------- | ------------------------- | +| auto-resolve theme conflicts | when a theme is enabled any other themes of the same mode (light/dark) will be disabled. | toggle | no | | +| hide app on open | app can be made visible by clicking the tray icon or using the hotkey. | toggle | no | | +| auto-maximise windows | whenever a window is un-hidden or is created it will be maximised. | toggle | no | | +| close window to the tray | pressing the × close button will hide the app instead of quitting it. it can be re-shown by clicking the tray icon or using the hotkey. | toggle | yes | | +| integrated titlebar | replace the native titlebar with buttons inset into the app. | toggle | yes | macOS: forced on | +| tiling window manager mode | completely remove the close/minimise/maximise buttons - this is for a special type of window manager. if you don't understand it, don't use it. | toggle | no | macOS: forced off | +| window display hotkey | used to toggle hiding/showing all app windows. | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+Shift+A` | | +| open enhancements menu hotkey | used to toggle opening/closing this menu while notion is focused. | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `Alt+E` | | +| values/defaults page id/url | every new tab/window that isn't opening a url via the notion:// protocol will load this page. to get a page link from within the app, go to the triple-dot menu and click "copy link". leave blank to just load the last page you opened. | text input | `Alt+E` | | ![](https://user-images.githubusercontent.com/16874139/93667628-c98cb100-faca-11ea-85e2-5fdca2a93a36.png) +### tabs + +**tags:** #core #extension + +**description:** have multiple notion pages open in a single window. + +**author:** [dragonwocky](https://github.com/dragonwocky/) + +| option | type | values/defaults | +| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| tab select modifier (key+1, +2, +3, ... +9 and key+left/right arrows) | select | `Alt`, `Command`, `Control`, `Super`, `Alt+Shift`, `Command+Shift`, `Control+Shift`, `Super+Shift` | +| new tab keybinding | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+T` | +| close tab keybinding | [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) input | `CommandOrControl+W` | + +### tweaks + +**tags:** #core #extension + +**description:** common style/layout changes. + +**author:** [dragonwocky](https://github.com/dragonwocky/) + +| option | extended description | type | values/defaults | platform-specific details | +| ---------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------ | --------------- | ------------------------- | +| height of frameless dragarea | the rectangle added at the top of a window in "integrated titlebar" mode, used to drag/move the window. | number input | 15 | macOS: forced to 0 | +| width to wrap columns at | the size in pixels below which in-page columns are resized to appear full width so content isn't squished. | number input | 600 | | +| integrated scrollbars | use scrollbars that fit better into notion's ui instead of the default chrome ones. | toggle | yes | | +| snappy transitions | | toggle | no | | +| thicker bold text | | toggle | yes | | +| more readable line spacing | | toggle | no | | +| hide help button | | toggle | no | | + ### always on top **tags:** #extension @@ -160,7 +193,7 @@ these include: **description:** add an arrow/button to show the notion window on top of other windows even if it's not focused. -**author**: [dragonwocky](https://github.com/dragonwocky/) +**author:** [dragonwocky](https://github.com/dragonwocky/) ![](https://user-images.githubusercontent.com/16874139/93692700-ad742880-fb39-11ea-9650-57a61e15a37e.png) @@ -170,7 +203,7 @@ on top of other windows even if it's not focused. **description:** render links surrounded with \[\[brackets]] instead of underlined. -**author**: [arecsu](https://github.com/arecsu/) +**author:** [arecsu](https://github.com/arecsu/) ![](https://user-images.githubusercontent.com/16874139/93692762-5458c480-fb3a-11ea-94e4-b7cbfab24274.png) @@ -192,6 +225,14 @@ on top of other windows even if it's not focused. ![](https://user-images.githubusercontent.com/16874139/93692788-ce894900-fb3a-11ea-8b65-8fc6c955fe6d.png) +### cherry cola + +**tags:** #theme #dark + +**description:** a delightfully plummy, cherry cola flavored theme. + +**author:** [runargs](https://github.com/runargs) + ### custom inserts **tags:** #extension @@ -199,7 +240,7 @@ on top of other windows even if it's not focused. **description:** link files for small client-side tweaks. (not sure how to do something? check out the [tweaks](https://github.com/dragonwocky/notion-enhancer/blob/master/TWEAKS.md) collection.) -**author**: [dragonwocky](https://github.com/dragonwocky/) +**author:** [dragonwocky](https://github.com/dragonwocky/) | option | type | | --------------------- | ---- | @@ -214,12 +255,20 @@ on top of other windows even if it's not focused. **author:** [dragonwocky](https://github.com/dragonwocky/) -| option | type | default | +| option | type | values/defaults | | -------------- | ----- | ------------------ | | primary colour | color | `rgb(177, 24, 24)` | ![](https://user-images.githubusercontent.com/16874139/93667588-84687f00-faca-11ea-86c9-7d05325a22a1.png) +### dracula + +**tags:** #theme #dark + +**description:** a theme based on the popular dracula color palette originally by zeno rocha and friends. + +**author:** //todo + ### emoji sets **tags:** #extension @@ -228,7 +277,7 @@ on top of other windows even if it's not focused. **author:** [dragonwocky](https://github.com/dragonwocky/) -| option | type | values | +| option | type | values/defaults | | ------ | ------ | -------------------------------------------------------------------------------------------------------------------------- | | style | select | twitter, apple, google, microsoft, samsung, whatsapp, facebook, joypixels, openmoji, emojidex, messenger, lg, htc, mozilla | @@ -242,6 +291,10 @@ on top of other windows even if it's not focused. **author:** [arecsu](https://github.com/arecsu/) +| option | extended description | type | values/defaults | +| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | --------------- | +| add padding to bottom of the page | will only take effect when the sidebar is hidden. aims to make the canvas as symmetrical/consistent as possible: if there is empty space on 3 sides, the 4th should follow. | toggle | on | + ![](https://user-images.githubusercontent.com/16874139/93694447-2336bf00-fb4f-11ea-82f3-84c14e000602.png) ### font chooser @@ -272,16 +325,6 @@ the font you would like to use, or leave it blank to not change anything. ![](https://user-images.githubusercontent.com/16874139/93667677-1bcdd200-facb-11ea-89a2-f2a674d70d6c.png) -### hide help - -**tags:** #extension - -**description:** hide the help button if you don't need it. - -**author**: [coryzibell](https://github.com/coryzibell/) - -![](https://user-images.githubusercontent.com/16874139/93692964-01ccd780-fb3d-11ea-9c58-893d37c4a53b.png) - ### littlepig dark **tags:** #theme #dark @@ -292,6 +335,14 @@ the font you would like to use, or leave it blank to not change anything. ![](https://user-images.githubusercontent.com/16874139/93667715-55064200-facb-11ea-949e-3f7494dfa498.png) +### material ocean + +**tags:** #theme #dark + +**description:** an oceanic colour palette. + +**author:** [blacksuan19](https://github.com/blacksuan19) + ### littlepig light **tags:** #theme #light @@ -350,6 +401,20 @@ the font you would like to use, or leave it blank to not change anything. ![](https://user-images.githubusercontent.com/16874139/93693026-bd8e0700-fb3d-11ea-9808-c259ef075d53.png) +### scroll to top + +**tags:** #extension + +**description:** add an arrow above the help button to scroll back to the top of a page. + +**author:** [CloudHill](https://github.com/CloudHill/) + +| option | type | values/defaults | +| --------------------------------------- | ------------ | --------------- | +| smooth scrolling | toggle | on | +| distance scrolled until button is shown | number input | 50 | +| unit to measure distance with | select | percent, pixels | + ### weekly view **tags:** #extension diff --git a/bin.js b/bin.js index d2ba145..d084773 100755 --- a/bin.js +++ b/bin.js @@ -21,7 +21,7 @@ const cli = require('cac')('notion-enhancer'), cli.option('-y, --yes', ': skip prompts (may overwrite data)'); cli.option('-n, --no', ': skip prompts (may cause failures)'); -cli.option('-d, --dev', ': show detailed error messages'); +cli.option('-d, --dev', ': show detailed error messages (for debug purposes)'); cli .command('apply', ': add the enhancer to the notion app') diff --git a/mods/core/enhancerMenu.js b/mods/core/enhancerMenu.js index de09afa..906198c 100644 --- a/mods/core/enhancerMenu.js +++ b/mods/core/enhancerMenu.js @@ -403,10 +403,10 @@ window['__start'] = async () => { ).toString(); function createOption(opt, id) { let $opt; - const description = opt.description + const desc = opt.desc ? question_icon.replace( ' { `; break; case 'select': $opt = ` - + @@ -444,7 +440,7 @@ window['__start'] = async () => { break; case 'color': $opt = ` - + `; break; @@ -460,7 +456,7 @@ window['__start'] = async () => { }>