notion-enhancer/repo/tray/client.mjs
dragonwocky e761b309bf tray: hotkey, run in background
window management features patched to reduce unexpected behaviour e.g. duplicate windows
2021-12-03 00:00:16 +11:00

18 lines
656 B
JavaScript

/*
* notion-enhancer: tray
* (c) 2021 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
* (https://notion-enhancer.github.io/) under the MIT license
*/
export default async function ({ env, web }, db) {
const runInBackground = await db.get(['run_in_background']);
if (!runInBackground) return;
// force new window creation on create new window hotkey
// hotkey is built into notion, so can't be changed,
// but is broken by this mod's window duplication prevention
web.addHotkeyListener([env.name === 'darwin' ? 'Meta' : 'Ctrl', 'Shift', 'N'], () => {
__enhancerElectronApi.sendMessage('create-new-window');
});
}