diff --git a/CHANGELOG.md b/CHANGELOG.md index 642a746..e0ab800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ a feature and cleanup update. - improved: halved the number of css rules used -> much better performance. - improved: font imports must be define in the `mod.js` so that they can also be used in the enhancements menu. +- improved: tiling window-manager support (can hide titlebars entirely without dragarea/buttons). - bugfix: enhancer settings should no longer reset on update (though this will not have effect until the release after this one). - bugfix: blue select tags are no longer purple. @@ -29,9 +30,10 @@ a feature and cleanup update. - improved: added individual text-colour rules for different background colours. - improved: added variables for callout colouring. -- improved: tiling window-manager support (can hide titlebars entirely without dragarea/buttons). - bugfix: block-level text colours are now changed properly. - bugfix: update property-layout to match notion changes again. +- extension: "always on top" = add an arrow/button to show the notion window on top of other windows + even if it's not focused. - extension: "calendar scroll" = a button to scroll down to the current week for you. notion-deb-builder has been discovered to not generate an app.asar and so is no longer supported. diff --git a/mods/core/buttons.js b/mods/core/buttons.js index 9b6cafd..e0cd54c 100644 --- a/mods/core/buttons.js +++ b/mods/core/buttons.js @@ -16,7 +16,7 @@ module.exports = (store) => { element: helpers.createElement('
'), insert: [ 'alwaysontop', - ...(store().frameless && !is_mac + ...(store().frameless && !store().tiling_mode && !is_mac ? ['minimize', 'maximize', 'close'] : []), ], @@ -86,7 +86,7 @@ module.exports = (store) => { document.querySelector(`.window-button#btn-${btn}`).onclick = buttons.actions[btn]; } - if (store().frameless && !is_mac) { + if (store().frameless && !store().tiling_mode && !is_mac) { window.addEventListener('resize', (event) => { Promise.resolve(buttons.icons.maximize()).then((icon) => { icon = icon.toString(); diff --git a/mods/core/client.js b/mods/core/client.js index e30b2a3..8aad84b 100644 --- a/mods/core/client.js +++ b/mods/core/client.js @@ -35,7 +35,7 @@ module.exports = (store, __exports) => { document.body.classList.add('smooth-scrollbars'); // frameless - if (store().frameless) { + if (store().frameless && !store().tiling_mode) { document.body.classList.add('frameless'); // draggable area const dragarea = helpers.createElement( @@ -154,7 +154,7 @@ module.exports = (store, __exports) => { }); let sidebar_width; function setSidebarWidth(list) { - if (!store().frameless) return; + if (!store().frameless && store().tiling_mode) return; const new_sidebar_width = list[0].target.style.height === 'auto' ? '0px' diff --git a/mods/core/css/menu.css b/mods/core/css/menu.css index 59c1a3d..8138f92 100644 --- a/mods/core/css/menu.css +++ b/mods/core/css/menu.css @@ -117,6 +117,9 @@ s { #menu-titlebar { background: var(--theme--dragarea); } +#menu-titlebar:empty { + display: none; +} /* alerts */ diff --git a/mods/core/menu.js b/mods/core/menu.js index 9d3ae39..95aae9c 100644 --- a/mods/core/menu.js +++ b/mods/core/menu.js @@ -7,6 +7,7 @@ 'use strict'; const store = require('../../pkg/store.js'), + { id } = require('./mod.js'), helpers = require('../../pkg/helpers.js'), fs = require('fs-extra'), path = require('path'), @@ -14,8 +15,10 @@ const store = require('../../pkg/store.js'), browser = electron.remote.getCurrentWindow(); window['__start'] = async () => { - const buttons = require('./buttons.js')(() => ({ frameless: true })); - document.querySelector('#menu-titlebar').appendChild(buttons.element); + if (!store(id).tiling_mode) { + const buttons = require('./buttons.js')(() => ({ frameless: true })); + document.querySelector('#menu-titlebar').appendChild(buttons.element); + } document.defaultView.addEventListener('keyup', (event) => { if (event.code === 'F5') location.reload(); diff --git a/mods/core/mod.js b/mods/core/mod.js index 25a4d27..2294d0a 100644 --- a/mods/core/mod.js +++ b/mods/core/mod.js @@ -44,6 +44,12 @@ module.exports = { type: 'input', value: 15, }, + { + key: 'tiling_mode', + label: 'tiling window manager mode', + type: 'toggle', + value: false, + }, { key: 'smooth_scrollbars', label: 'integrated scrollbars', diff --git a/mods/core/render.js b/mods/core/render.js index a6c7d58..9b17f03 100644 --- a/mods/core/render.js +++ b/mods/core/render.js @@ -16,16 +16,20 @@ module.exports = (store, __exports) => { ), default_styles = dragarea.getAttribute('style'); - document - .getElementById('notion') - .addEventListener('ipc-message', (event) => { - if (event.channel !== 'enhancer:sidebar-width') return; - dragarea.setAttribute( - 'style', - `${default_styles} top: 2px; height: ${ - store().dragarea_height - }px; left: ${event.args[0]};` - ); - }); + if (store().tiling_mode) { + dragarea.style.display = 'none'; + } else { + document + .getElementById('notion') + .addEventListener('ipc-message', (event) => { + if (event.channel !== 'enhancer:sidebar-width') return; + dragarea.setAttribute( + 'style', + `${default_styles} top: 2px; height: ${ + store().dragarea_height + }px; left: ${event.args[0]};` + ); + }); + } }; };