mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-05 05:09:03 +00:00
separate always-on-top into separate mod
This commit is contained in:
parent
58ff18724b
commit
ecdf9a70c0
@ -20,20 +20,21 @@ a feature and cleanup update.
|
||||
- bugfix: blue select tags are no longer purple.
|
||||
- bugfix: page titles now respond to small-text mode.
|
||||
- bugfix: weekly calendar view height is now sized correctly according to its contents.
|
||||
- bugfix: made the open enhancements menu hotkey configurable and changed the default to `alt + e`
|
||||
to remove conflict with the inline code highlight shortcut.
|
||||
- themes: "littlepig" (light + dark) = monospaced themes using emojis and colourful text.
|
||||
- extension: "font chooser" = customize fonts. for each option, type in the name of the font you would like to use,
|
||||
or leave it blank to not change anything.
|
||||
- bugfix: made the open enhancements menu hotkey configurable and changed the default to `alt + e`
|
||||
to remove conflict with the inline code highlight shortcut.
|
||||
- extension: "always on top" = add an arrow/button to show the notion window on top of other windows
|
||||
even if it's not focused.
|
||||
|
||||
// todo
|
||||
|
||||
- improved: extensions menu search now includes options.
|
||||
- improved: added individual text-colour rules for different background colours.
|
||||
- improved: added variables for callout colouring.
|
||||
- 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.
|
||||
|
20
mods/alwaysontop/mod.js
Normal file
20
mods/alwaysontop/mod.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* always on top
|
||||
* (c) 2020 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
|
||||
* under the MIT license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// this is actually just a pseudo mod to "separate" the button
|
||||
// from the core module, but the core still handles actually
|
||||
// making it work.
|
||||
module.exports = {
|
||||
id: '72886371-dada-49a7-9afc-9f275ecf29d3',
|
||||
tags: ['extension'],
|
||||
name: 'always on top',
|
||||
desc:
|
||||
"add an arrow/button to show the notion window on top of other windows even if it's not focused.",
|
||||
version: '0.1.1',
|
||||
author: 'dragonwocky',
|
||||
};
|
@ -15,7 +15,10 @@ module.exports = (store) => {
|
||||
buttons = {
|
||||
element: helpers.createElement('<div class="window-buttons-area"></div>'),
|
||||
insert: [
|
||||
'alwaysontop',
|
||||
...((store('mods')['72886371-dada-49a7-9afc-9f275ecf29d3'] || {})
|
||||
.enabled
|
||||
? ['alwaysontop']
|
||||
: []),
|
||||
...(store().frameless && !store().tiling_mode && !is_mac
|
||||
? ['minimize', 'maximize', 'close']
|
||||
: []),
|
||||
|
@ -105,19 +105,18 @@ s {
|
||||
|
||||
#menu-titlebar {
|
||||
display: flex;
|
||||
padding: 0.4em;
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
#menu-titlebar button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
#menu-titlebar :first-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
#menu-titlebar {
|
||||
background: var(--theme--dragarea);
|
||||
}
|
||||
#menu-titlebar:empty {
|
||||
#menu-titlebar > .window-buttons-area {
|
||||
margin: 0.4em 0.4em 0.4em auto;
|
||||
}
|
||||
#menu-titlebar > .window-buttons-area:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -15,32 +15,44 @@ const store = require('../../pkg/store.js'),
|
||||
browser = electron.remote.getCurrentWindow();
|
||||
|
||||
window['__start'] = async () => {
|
||||
if (!store(id).tiling_mode) {
|
||||
const buttons = require('./buttons.js')(() => ({ frameless: true }));
|
||||
document.querySelector('#menu-titlebar').appendChild(buttons.element);
|
||||
}
|
||||
const buttons = require('./buttons.js')(() => ({
|
||||
'72886371-dada-49a7-9afc-9f275ecf29d3': {
|
||||
enabled: (store('mods')['72886371-dada-49a7-9afc-9f275ecf29d3'] || {})
|
||||
.enabled,
|
||||
},
|
||||
tiling_mode: store('0f0bf8b6-eae6-4273-b307-8fc43f2ee082').tiling_mode,
|
||||
frameless: true,
|
||||
}));
|
||||
document.querySelector('#menu-titlebar').appendChild(buttons.element);
|
||||
|
||||
document.defaultView.addEventListener('keyup', (event) => {
|
||||
if (event.code === 'F5') location.reload();
|
||||
if (!(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey) {
|
||||
const meta =
|
||||
!(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey;
|
||||
if (
|
||||
meta &&
|
||||
document.activeElement.parentElement.id === 'tags' &&
|
||||
event.key === 'Enter'
|
||||
)
|
||||
document.activeElement.click();
|
||||
if (document.activeElement.tagName.toLowerCase() === 'input') {
|
||||
if (document.activeElement.type === 'checkbox' && event.key === 'Enter')
|
||||
document.activeElement.checked = !document.activeElement.checked;
|
||||
if (
|
||||
document.activeElement.parentElement.id === 'tags' &&
|
||||
event.key === 'Enter'
|
||||
['Escape', 'Enter'].includes(event.key) &&
|
||||
document.activeElement.type !== 'checkbox' &&
|
||||
(document.activeElement.parentElement.id !== 'search' ||
|
||||
event.key === 'Escape')
|
||||
)
|
||||
document.activeElement.click();
|
||||
if (document.activeElement.tagName.toLowerCase() === 'input') {
|
||||
if (document.activeElement.type === 'checkbox' && event.key === 'Enter')
|
||||
document.activeElement.checked = !document.activeElement.checked;
|
||||
if (
|
||||
['Escape', 'Enter'].includes(event.key) &&
|
||||
document.activeElement.type !== 'checkbox' &&
|
||||
(document.activeElement.parentElement.id !== 'search' ||
|
||||
event.key === 'Escape')
|
||||
)
|
||||
document.activeElement.blur();
|
||||
} else if (event.key === '/')
|
||||
document.querySelector('#search > input').focus();
|
||||
}
|
||||
document.activeElement.blur();
|
||||
} else if (
|
||||
(meta && event.key === '/') ||
|
||||
((event.ctrlKey || event.metaKey) &&
|
||||
event.key === 'f' &&
|
||||
!event.altKey &&
|
||||
!event.shiftKey)
|
||||
)
|
||||
document.querySelector('#search > input').focus();
|
||||
});
|
||||
|
||||
electron.ipcRenderer.send('enhancer:get-theme-vars');
|
||||
|
Loading…
Reference in New Issue
Block a user