diff --git a/.gitignore b/.gitignore index 67c8fa2..6704566 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # Logs logs *.log @@ -6,7 +5,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* -.vscode # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 73b60dc..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,85 +0,0 @@ -# changelog - -if something is ~~crossed out~~, then it is no longer a feature included by default, -but can still easily be enabled by following instructions in the [docs](README.md). - -### v0.7.0 (2020-07-09) - -- new: tray option to use system default emojis (instead of twitter's emojiset). -- new: mac support (identical functionality to others platforms with the - exception of the native minimise/maximise/close buttons being kept, as they integrate - better with the OS while not being out-of-place in notion). -- new: notion-deb-builder support for linux. -- improved: replaced button symbols with svgs for multi-platform support. -- improved: window close button is now red on hover (thanks to [@torchatlas](https://github.com/torchatlas)). -- bugfix: `cleaner.py` patched for linux. -- bugfix: tray now operates as expected on linux. -- bugfix: odd mix of `\\` and `/` being used for windows filepaths. -- bugfix: app no longer crashes when sidebar is toggled. - -### v0.6.0 (2020-06-30) - -- style: custom fonts. -- style: font resizing. -- style: hide discussions (thanks to [u/Roosmaryn](https://www.reddit.com/user/Roosmaryn/)). -- new: custom colour theming, demonstrated via the dark+ theme. -- new: linux support (thanks to [@Blacksuan19](https://github.com/Blacksuan19)). -- improved: if hotkey is pressed while notion is unfocused, it will bring it to the front rather than hiding it. -- improved: stop window buttons breaking at smaller widths. -- improved: more obviously visible drag area. -- bugfix: specify UTF-8 encoding to prevent multibyte/gbk codec errors (thanks to [@etnperlong](https://github.com/etnperlong)). - -> 📥 [notion-enhancer.v0.6.0.zip](https://github.com/dragonwocky/notion-enhancer/archive/v0.6.0.zip) - -### v0.5.0 (2020-05-23) - -- new: running from the wsl. -- new: reload window with f5. -- improved: code has been refactored and cleaned up, - inc. file renaming and a `customiser.py` that doesn't require - a run of `cleaner.py` to build modifications. - improved: scrollbar colours that fit better with notion's theming. -- bugfix: un-break having multiple notion windows open. - -> 📥 [notion-enhancer.v0.5.0.zip](https://github.com/dragonwocky/notion-enhancer/archive/v0.5.0.zip) - -_(forked by [@dragonwocky](https://github.com/dragonwocky).)_ - -### v0.4.1 (2020-02-13) - -- bugfix: wider table & the "+" button not working in database pages. - -> 📥 [notion-enhancer.v4.1.zip](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d239a3cf-d553-4ef3-ab04-8b47892d9f9a/Notion_Customization_v4.1.zip) - -### v0.4.0 - -- new: tray icon. -- new: app startup options (+ saving). -- new: `Reset.py` -- improved: better output from `Customization Patcher.py`. -- bugfix: wider tables in "short page" mode. -- bugfix: unclickable buttons/draggable area (of titlebar). - -### v0.3.0 - -- new: show/hide window hotkey. -- new: app startup options. -- ~~style: smaller table icons.~~ - -> 📥 [notion-enhancer.v3.zip](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b01aa446-5727-476a-a25e-395472bfb1be/NotionScriptsV3.zip) - -### v0.2.0 - -- new: light/dark theme support for window control buttons + scrollbars. -- new: custom styles directly linked to the enhancer resources + compatible with web version. -- ~~improved: making table column width go below 100px.~~ - -### v0.1.0 - -- new: custom window control buttons. -- removed: default titlebar/menubar. -- ~~removed: huge padding of board view.~~ -- ~~removed: huge padding of table view.~~ -- ~~optional: making table column width go below 100px.~~ -- ~~style: thinner cover image + higher content block.~~ -- style: scrollbars. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 26171ec..0000000 --- a/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2020 TarasokUA -Copyright (c) 2020 dragonwocky - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 83d4e3c..0000000 --- a/Pipfile +++ /dev/null @@ -1,14 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -pylint = "*" -autopep8 = "*" - -[packages] -pyasar = "*" - -[requires] -python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index fdf355f..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,150 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "1acd8226b318eb2516f81421b7f90e7c81f2119805d658a5a958e0699a1358d6" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.6" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "pyasar": { - "hashes": [ - "sha256:f96b322ea5c450d129dbe6990e5ba827d1d070e818822c408abffa44058f7f08" - ], - "index": "pypi", - "version": "==1.0.8" - } - }, - "develop": { - "astroid": { - "hashes": [ - "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703", - "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386" - ], - "markers": "python_version >= '3.5'", - "version": "==2.4.2" - }, - "autopep8": { - "hashes": [ - "sha256:60fd8c4341bab59963dafd5d2a566e94f547e660b9b396f772afe67d8481dbf0" - ], - "index": "pypi", - "version": "==1.5.3" - }, - "isort": { - "hashes": [ - "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", - "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.3.21" - }, - "lazy-object-proxy": { - "hashes": [ - "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", - "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", - "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", - "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", - "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", - "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", - "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", - "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", - "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", - "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", - "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", - "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", - "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", - "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", - "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", - "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", - "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", - "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", - "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", - "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", - "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.4.3" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "pycodestyle": { - "hashes": [ - "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", - "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.6.0" - }, - "pylint": { - "hashes": [ - "sha256:7dd78437f2d8d019717dbf287772d0b2dbdfd13fc016aa7faa08d67bccc46adc", - "sha256:d0ece7d223fe422088b0e8f13fa0a1e8eb745ebffcb8ed53d3e95394b6101a1c" - ], - "index": "pypi", - "version": "==2.5.3" - }, - "six": { - "hashes": [ - "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", - "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.15.0" - }, - "toml": { - "hashes": [ - "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f", - "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" - ], - "version": "==0.10.1" - }, - "typed-ast": { - "hashes": [ - "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", - "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", - "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", - "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", - "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", - "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", - "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", - "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", - "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", - "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", - "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", - "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", - "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", - "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", - "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", - "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", - "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", - "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", - "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", - "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", - "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7" - ], - "markers": "python_version < '3.8' and implementation_name == 'cpython'", - "version": "==1.4.1" - }, - "wrapt": { - "hashes": [ - "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7" - ], - "version": "==1.12.1" - } - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 689fe41..0000000 --- a/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# notion enhancer - -an enhancer/customiser for the all-in-one productivity workspace [notion.so](https://www.notion.so/) - -## supported clients - -there are a lot of ways to use notion. some official clients, many not. - -the enhancer supports: - -- the [official windows/mac releases](https://notion.so/desktop). -- the arch linux AUR [notion-app](https://aur.archlinux.org/packages/notion-app/) package -- the linux [notion-app](https://github.com/jaredallard/notion-app) installer -- the debian [notion-deb-builder](https://github.com/davidbailey00/notion-deb-builder/tree/229f2868e117e81858618783b83babd00c595000). - -there are others, yes. the enhancer does not support them. you should not expect them to work. -if for some reason you need to use one of them instead of the above listed ones, open a -[platform support](https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=enhancement&template=platform-support.md&title=) request. - -please do not modify the enhancer code specifically to work for your installation. -if you have the know-how to do so, instead open a pull request with your changes -so that proper support can be added for all users of that client. - -mobile clients are not supported and due to system limitations/restrictions cannot be. - -(the [styles](#styling) should also work for the web version. -these can be installed via an extension like [stylus](https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne?hl=en) -or a built-in feature like [userChrome.css](https://www.userchrome.org/).) - -if the script is run from the WSL, it will enhance the windows version of the app. - -## installation - -1. install node.js: [windows/macOS](https://nodejs.org/en/download/), [linux/WSL](https://github.com/mklement0/n-install). -2. install python: [windows/macOS](https://www.python.org/downloads/), [linux/WSL](https://docs.python-guide.org/starting/install3/linux/). -3. reboot. -4. in the appropriate terminal/command line, run `npm install -g asar` (check installation by running `asar`). -5. [download this enhancer](https://github.com/dragonwocky/notion-enhancer/archive/master.zip) & extract - to a location it can safely remain (if running the script from the WSL, make sure this is from a location within the windows filesystem). -6. ensure no notion processes are running - you may want to check the task manager to make sure. -7. optional: to remove previous applications of the notion enhancer, run `cleaner.py`. -8. optional: modify the `resources/user.css` file to your liking (see [styling](#styling)). -9. run `customiser.py` to build changes. (for linux run with sudo) - -done: run notion and enjoy. - -## faq - -**now the notion app won't open :(** - -1. kill any notion tasks in the task manager (`ctrl+shift+esc`). -2. run `cleaner.py`. -3. reboot. -4. follow instructions above (ensuring notion _isn't_ running! again, check task manager). - -**i tried opening the python file but it just closed instantly and nothing happened?** - -python scripts must be run from the terminal or command prompt via e.g. `python customiser.py`. - -**now that I've run the script, can I delete the enhancer folder?** - -no! user style files `resources/user.css` and `resources/theme.css` are fetched from here each time you open notion. -additionally, if you ever need to change or reset your notion build, the `customiser.py` and `cleaner.py` files will be useful. - -unless you're sure you know what you're doing (if you have to ask, you probably don't) then do not delete anything. - -**something isn't working, and the suggestions here haven't fixed it...** - -this is probably a bug. please submit a -[bug report](https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=bug&template=bug-report.md&title=). - -**can the enhancer do \_\_\_?** - -experienced problems with the notion app, or just want to add something a bit more to it? please submit a -[feature request](https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=enhancement&template=feature-request.md&title=). - -## features - -### titlebar - -default windows titlebar/frame has been replaced by one more fitting to the theme of the app. - -this includes the addition of an extra button, "always on top" -symbolised with an arrow. when toggled to point up, -notion will remain the top visible window even if not focused. - -### nicer scrollbars - -i mean, yeah. get rid of those ugly default scrollbars and use nice inconspicuous -ones that actually look as if they're part of notion. - -to add these to the web version, copy lines 74 - 105 from `user.css` into your css customiser. - -![](screenshots/app-unenhanced.jpg) -_image: before enhancement_ - -![](screenshots/app-enhanced.jpg) -_image: after default enhancement_ - -### hotkeys - -- **reload window**: in addition to the built-in `CmdOrCtrl+R` reload, - you can now reload a window with `F5`. -- **toggle all notion windows to/from the tray**: `CmdOrCtrl+Shift+A` by default. - -to set your own toggle hotkey, open `customiser.py` and change line 19 (`hotkey = 'CmdOrCtrl+Shift+A'`) -to your preference. you will need to run or re-run `customiser.py` afterwards. - -### tray - -single-click to toggle app visibility. right click to open menu. - -- **run on startup**: run notion on boot/startup. (default: true) -- **hide on open**: hide the launch of notion to the tray. (default: false) -- **open maximised**: maximize the app on open. (default: false) -- **close to tray**: close window to tray rather than closing outright - on click of `⨉`. does not apply if multiple notion windows are open. (default: false) -- **load theme.css**: loads the custom colour theme file. - see [colour theming](STYLING.md#colour-theming) for more information. (default: false) -- **use system emoji**: reverts notion to using normal emojis, rather than the twitter emojiset. (default: false) - -![](screenshots/app-tray.jpg) - -_image: open application tray_ - -## styling - -custom appearances can be applied to the app via the `resources/user.css` and `resources/theme.css` files. for more information, -and a list of various optional styling changes, see [the page on styling](STYLING.md). - -## other details - -credit where credit is due, this was originally made by Uzver (github: [@TarasokUA](https://github.com/TarasokUA), -telegram: [UserFromUkraine](https://t.me/UserFromUkraine), discord: Uzver#8760). -he has approved my go-ahead with this fork, as he himself no longer wishes to continue development on the project. - -the notion logo belongs entirely to the notion team, and was sourced from their -[media kit](https://www.notion.so/Media-Kit-205535b1d9c4440497a3d7a2ac096286). - -if you have any questions, check [my website](https://dragonwocky.me/) for contact details. diff --git a/STYLING.md b/STYLING.md deleted file mode 100644 index 484671c..0000000 --- a/STYLING.md +++ /dev/null @@ -1,333 +0,0 @@ -# styling - -to modify the appearance of the notion app, edit the style rules in `resources/user.css`, -use some of the suggested/documented optional styles below, or invent your own. - -these styles are written in a language called "CSS". if you don't know what this is and are interested, -check out some youtube videos or [try a free short course like the one on codecademy](https://www.codecademy.com/learn/learn-css). - -due to the enhancements directly fetching from the local CSS files, -changes will be applied instantly on notion reload -(no need to re-run `customiser.py` every time you want to change some styles). - -these should also work for the web version, if copied into your css customiser. - -css below will work for every instance of the element, but if you wish to hide only a specific element -(e.g. the '+ new' table row) it is recommended that you prepend each selector with -`[data-block-id='ID']`. - -## general/app-wide - -![](screenshots/app-enhanced.jpg) - -_image: the default post-customisation appearance_ - -### colour theming - -this replaces the default notion dark theme. the provided theme file is my custom dark+ theme: -if you have another you wish to share, please contact me. if a few themes are submitted i will -set up a distribution method (either including them as optionally-enableabled themes or sharing them on the website). - -to enable, see the [tray](README.md#tray) options. - -to modify, enter the `theme.css` file and change the colour values within the `:root {}` - value names -should describe what each colour will affect. - -![](screenshots/theme-dark+.jpg) - -_image: the dark+ theme_ - -### hide discussions (comment threads at the top of each page) - -```css -.notion-page-view-discussion { - display: none !important; -} -``` - -![](screenshots/discussion-default.jpg) - -_image: before styling_ - -![](screenshots/discussion-hidden.jpg) - -_image: after styling_ - -### custom fonts - -**the `@import` statement must be added to the top of the file (with nothing above it** -**except comments or other `@import` statements)** - -to change the fonts, put the relevant URL in the `@import` statement and then change the [font-family](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family) property. -plenty of other fonts that can be found on google fonts or that may be on your system already. - -```css -@import url('https://fonts.googleapis.com/css2?family=Fira+Code&family=Oxygen&family=Roboto+Slab:wght@300&display=swap'); -.notion-app-inner { - font-family: 'Oxygen', sans-serif !important; -} -[style*='monospace;'] { - font-family: 'Fira Code', monospace !important; -} -[style*=', serif;'] { - font-family: 'Roboto Slab', serif !important; -} -``` - -![](screenshots/fonts-custom.jpg) - -_image: after styling_ - -### font resizing - -**not recommended:** this can mess up container sizes. -it is suggested to instead use `ctrl+` or `ctrl-` to scale everything up/down. - -to change the size, change the value of `--font-scale`. - -```css -:root { - --font-scale: 1.4; -} -.notion-app-inner { - font-size: calc(var(--font-scale) * 16px) !important; -} -[style*='font-size: 40px'] { - font-size: calc(var(--font-scale) * 40px) !important; -} -[style*='font-size: 16px'] { - font-size: calc(var(--font-scale) * 16px) !important; -} -[style*='font-size: 14px'] { - font-size: calc(var(--font-scale) * 14px) !important; -} -[style*='font-size: 12px'] { - font-size: calc(var(--font-scale) * 12px) !important; -} -[style*='font-size: 11px'] { - font-size: calc(var(--font-scale) * 11px) !important; -} -[style*='font-size: 1.25em'] { - font-size: calc(var(--font-scale) * 1.25em) !important; -} -``` - -![](screenshots/fonts-resized.jpg) - -_image: after styling_ - -### wider page preview - -```css -.notion-peek-renderer > div:nth-child(2) { - max-width: 85vw !important; -} -``` - -![](screenshots/preview-default.jpg) - -_image: before styling_ - -![](screenshots/preview-wider.jpg) - -_image: after styling_ - -### thinner cover image - -```css -[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] { - height: 12vh !important; -} -[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] - img { - height: 12vh !important; -} -``` - -![](screenshots/cover-default.jpg) - -_image: before styling_ - -![](screenshots/cover-thinner.jpg) - -_image: after styling_ - -## tables - -![](screenshots/table-before.jpg) - -_image: before styling_ - -### table columns below 100px - -**not recommended!** this may cause buggy viewing. -as it is a per-table-column style, unlike all others here, it must be prepended with the block ID and repeated for each column. - -to see how to do this, watch [this video](https://www.youtube.com/watch?v=6V7eqShm_4w). - -```css -[data-block-id^='tableID'] - > [style^='display: flex; position: absolute; background: rgb(47, 52, 55); z-index: 82; height: 33px; color: rgba(255, 255, 255, 0.6);'] - > div:nth-child(1) - > div:nth-child(COL_NUMBER) - > div:nth-child(1), -[data-block-id^='tableID'] - > [style^='position: relative; min-width: calc(100% - 192px);'] - > [data-block-id] - > div:nth-child(COL_NUMBER), -[data-block-id^='tableID'] > div:nth-child(5) > div:nth-child(COL_NUMBER) { - width: 32px !important; -} -[data-block-id^='tableID'] - [style^='position: absolute; top: 0px; left: 0px; pointer-events: none;']:not(.notion-presence-container) { - display: none; -} -``` - -![](screenshots/table-columnunder100px.jpg) - -_image: after styling_ - -### hide '+ new' table row - -```css -.notion-table-view-add-row { - display: none !important; -} -``` - -![](screenshots/table-hideaddrow.jpg) - -_image: after styling_ - -### hide calculations table row - -```css -.notion-table-view-add-row + div { - display: none !important; -} -``` - -![](screenshots/table-hidecalculationsrow.jpg) - -_image: after styling_ - -### centre-align table column headers - -```css -.notion-table-view-header-cell > div > div { - margin: 0px auto; -} -``` - -![](screenshots/table-centredheaders.jpg) - -_image: after styling_ - -### smaller table column header icons - -```css -[style^='display: flex; position: absolute; background: rgb(47, 52, 55); z-index: 82; height: 33px; color: rgba(255, 255, 255, 0.6);'] - div:nth-child(1) - svg { - height: 10px !important; - width: 10px !important; - margin-right: -4px; -} -``` - -![](screenshots/table-smallercolumnicons.jpg) - -_image: after styling_ - -### remove icons from table column headers - -```css -.notion-table-view-header-cell [style^='margin-right: 6px;'] { - display: none !important; -} -``` - -![](screenshots/table-hidecolumnicons.jpg) - -_image: after styling_ - -### removing/decreasing side padding for tables - -```css -[style^='flex-shrink: 0; flex-grow: 1; width: 100%; max-width: 100%; display: flex; align-items: center; flex-direction: column; font-size: 16px; color: rgba(255, 255, 255, 0.9); padding: 0px 96px 30vh;'] - .notion-table-view, -[class='notion-scroller'] > .notion-table-view { - padding-left: 35px !important; - padding-right: 15px !important; - min-width: 0% !important; -} -[style^='flex-shrink: 0; flex-grow: 1; width: 100%; max-width: 100%; display: flex; align-items: center; flex-direction: column; font-size: 16px; color: rgba(255, 255, 255, 0.9); padding: 0px 96px 30vh;'] - .notion-selectable - .notion-scroller.horizontal::-webkit-scrollbar-track { - margin-left: 10px; - margin-right: 10px; -} -``` - -![](screenshots/table-shrinkpadding.jpg) - -_image: after styling_ - -## boards - -![](screenshots/board-default.jpg) - -_image: before styling_ - -### hide '+ new' board row - -```css -.notion-board-group - [style='user-select: none; transition: background 120ms ease-in 0s; cursor: pointer; display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; height: 32px; border-radius: 3px; font-size: 14px; line-height: 1.2; min-width: 0px; padding-left: 6px; padding-right: 8px; color: rgba(255, 255, 255, 0.4); width: 100%;'] { - display: none !important; -} -``` - -![](screenshots/board-hideaddnew.jpg) - -_image: after styling_ - -### hide board view hidden columns - -```css -.notion-board-view > [data-block-id] > div:nth-last-child(2), -.notion-board-view > [data-block-id] > div:first-child > div:nth-last-child(2) { - display: none !important; -} -``` - -![](screenshots/board-hidehidden.jpg) - -_image: after styling_ - -### hide board view 'add a group' - -```css -.notion-board-view > [data-block-id] > div:last-child, -.notion-board-view > [data-block-id] > div:first-child > div:last-child { - display: none !important; -} -``` - -![](screenshots/board-hideaddgroup.jpg) - -_image: after styling_ - -### removing/decreasing side padding for boards - -```css -.notion-board-view { - padding-left: 10px !important; - padding-right: 10px !important; -} -``` - -![](screenshots/board-shrinkpadding.jpg) - -_image: after styling_ diff --git a/cleaner.py b/cleaner.py deleted file mode 100644 index 146407c..0000000 --- a/cleaner.py +++ /dev/null @@ -1,75 +0,0 @@ - -# notion-enhancer -# (c) 2020 dragonwocky -# (c) 2020 TarasokUA -# (https://dragonwocky.me/) under the MIT license - -import os -import sys -import platform -import subprocess -from shutil import rmtree -from time import sleep - -# f'{bold}=== title ==={normal}' = headers -# '*' = information -# '...' = actions -# '###' = warnings -# '>' = exit - -bold = '\033[1m' -normal = '\033[0m' - -print(f'{bold}=== NOTION ENHANCER CLEANING LOG ==={normal}\n') -try: - filepath = '' - if 'microsoft' in platform.uname()[3].lower() and sys.platform == 'linux': - filepath = '/mnt/c/' + \ - subprocess.run( - ['cmd.exe', '/c', 'echo', '%localappdata%'], stdout=subprocess.PIPE).stdout \ - .rstrip().decode('utf-8')[3:].replace('\\', '/') + '/Programs/Notion/resources' - elif sys.platform == 'win32': - filepath = subprocess.run(['echo', '%localappdata%'], shell=True, capture_output=True).stdout \ - .rstrip().decode('utf-8') + '\\Programs\\Notion\\resources' - elif sys.platform == 'linux': - filepath = '/opt/notion-app' if os.path.exists( - '/opt/notion-app') else '/opt/notion' - elif sys.platform == 'darwin': - filepath = '/Applications/Notion.app/Contents/Resources' - else: - print(' > script not compatible with your os!\n (report this to dragonwocky#8449 on discord)') - exit() - - if os.path.exists(os.path.join(filepath, 'app')): - print( - f' ...removing folder {os.path.join(filepath, "app")}') - rmtree(os.path.join(filepath, 'app')) - else: - print( - f' * {os.path.join(filepath, "app")} was not found: step skipped.') - - if os.path.isfile(os.path.join(filepath, 'app.asar.bak')): - print(' ...renaming asar.app.bak to asar.app') - os.rename(os.path.join(filepath, 'app.asar.bak'), - os.path.join(filepath, 'app.asar')) - else: - print( - f' * {os.path.join(filepath, "app.asar.bak")} was not found: step skipped.') - - if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower(): - bin_path = '/usr/bin/notion-app' if os.path.exists( - '/usr/bin/notion-app') else '/usr/bin/notion' - with open(bin_path, 'r', encoding='UTF-8') as launcher: - if 'app.asar' not in launcher: - print( - f' ...patching app launcher') - subprocess.call( - ['sed', '-i', r's/electron\ app/electron\ app\.asar/', - bin_path]) - - print(f'\n{bold}>>> SUCCESSFULLY CLEANED <<<{normal}') - -except Exception as e: - print(f'\n{bold}### ERROR (report this to dragonwocky#8449 on discord) ###{normal}\n{str(e)}') - -print(f'\n{bold}=== END OF LOG ==={normal}') diff --git a/customiser.py b/customiser.py deleted file mode 100755 index ac69400..0000000 --- a/customiser.py +++ /dev/null @@ -1,239 +0,0 @@ - -# notion-enhancer -# (c) 2020 dragonwocky -# (c) 2020 TarasokUA -# (https://dragonwocky.me/) under the MIT license - -import re -import os -import sys -import platform -import subprocess -from shutil import copyfile, rmtree -from time import sleep - -# to smooth the update process -enhancer_version = '0.7.0' - -# for toggling notion visibility -hotkey = 'CmdOrCtrl+Shift+A' - -# '=== title ===' = headers -# '*' = information -# '...' = actions -# '##' = warnings -# '>' = exit - -print('=== NOTION ENHANCER CUSTOMISATION LOG ===\n') - -try: - filepath = '' - __dirname__ = os.path.dirname(__file__) - enhancer_folder = os.path.realpath(__dirname__) - if 'microsoft' in platform.uname()[3].lower() and sys.platform == 'linux': - filepath = '/mnt/c/' + \ - subprocess.run( - ['cmd.exe', '/c', 'echo', '%localappdata%'], stdout=subprocess.PIPE).stdout \ - .rstrip().decode('utf-8')[3:].replace('\\', '/') + '/Programs/Notion/resources' - drive = enhancer_folder[5].capitalize() if enhancer_folder.startswith( - '/mnt/') else 'C' - enhancer_folder = drive + ':\\' + enhancer_folder[6:] - elif sys.platform == 'win32': - filepath = subprocess.run(['echo', '%localappdata%'], shell=True, capture_output=True).stdout \ - .rstrip().decode('utf-8') + '\\Programs\\Notion\\resources' - elif sys.platform == 'linux': - if os.path.exists('/opt/notion-app'): - filepath = '/opt/notion-app' - elif os.path.exists('/opt/notion'): - filepath = '/opt/notion' - elif os.path.exists('/usr/lib/notion-desktop/resources'): - filepath = '/usr/lib/notion-desktop/resources' - elif sys.platform == 'darwin': - filepath = '/Applications/Notion.app/Contents/Resources' - else: - print(' > script not compatible with your os!\n (report this to dragonwocky#8449 on discord)') - exit() - if not filepath or not os.path.exists(filepath): - print( - ' > nothing found: exiting. notion install is either corrupted or non-existent.') - exit() - - unpacking_asar = True - if not os.path.isfile(os.path.join(filepath, 'app.asar')): - print(f' ## file {os.path.join(filepath, "app.asar")} not found!') - print(' * attempting to locate') - if os.path.exists(os.path.join(filepath, 'app')): - unpacking_asar = False - print(' * app.asar was already unpacked: checking version.') - cleaning_asar = True - if os.path.isfile(os.path.join(filepath, 'app', 'ENHANCER_VERSION.txt')): - with open(os.path.join(filepath, 'app', 'ENHANCER_VERSION.txt'), 'r', encoding='UTF-8') as content: - if content.read() == enhancer_version: - cleaning_asar = False - if cleaning_asar: - unpacking_asar = True - print(' * version does not match: cleaning.') - if os.path.exists(os.path.join(filepath, 'app')): - print( - f' ...removing folder {os.path.join(filepath, "app")}') - rmtree(os.path.join(filepath, 'app')) - else: - print( - f' * {os.path.join(filepath, "app")} was not found: step skipped.') - if os.path.isfile(os.path.join(filepath, 'app.asar.bak')): - print(' ...renaming asar.app.bak to asar.app') - os.rename(os.path.join(filepath, 'app.asar.bak'), - os.path.join(filepath, 'app.asar')) - else: - print( - f' * {os.path.join(filepath, "app.asar.bak")} was not found: exiting. notion install is corrupted.') - exit() - else: - print(' * version matches: continuing.') - else: - print( - ' > nothing found: exiting. notion install is either corrupted or non-existent.') - exit() - if unpacking_asar: - print(' ...unpacking app.asar') - subprocess.run(['asar', 'extract', os.path.join(filepath, 'app.asar'), os.path.join( - filepath, 'app')], shell=(True if sys.platform == 'win32' else False)) - print(' ...renaming asar.app to asar.app.bak') - os.rename(os.path.join(filepath, 'app.asar'), - os.path.join(filepath, 'app.asar.bak')) - with open(os.path.join(filepath, 'app', 'ENHANCER_VERSION.txt'), 'w', encoding='UTF-8') as write: - write.write(enhancer_version) - - if os.path.isfile(os.path.join(filepath, 'app', 'renderer', 'preload.js')): - print( - f' ...adding preload.js to {os.path.join(filepath, "app","renderer","preload.js")}') - with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'r', encoding='UTF-8') as content: - if '/* === INJECTION MARKER === */' in content.read(): - print(' * preload.js already added. replacing it.') - content.seek(0) - original = [] - for num, line in enumerate(content): - if '/* === INJECTION MARKER === */' in line: - break - original += line - with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'w', encoding='UTF-8') as write: - write.writelines(original) - else: - with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'a', encoding='UTF-8') as append: - append.write('\n\n') - with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'a', encoding='UTF-8') as append: - print( - f' ...linking to {os.path.join(".", "resources", "user.css")}') - with open(os.path.join(__dirname__, 'resources', 'preload.js'), 'r', encoding='UTF-8') as insert: - append.write(insert.read().replace( - '☃☃☃resources☃☃☃', os.path.join(enhancer_folder, 'resources').replace('\\', '/')) - .replace('☃☃☃version☃☃☃', enhancer_version)) - else: - print( - f' * {os.path.join(filepath, "app","renderer","preload.js")} was not found: step skipped.') - - if os.path.isfile(os.path.join(filepath, "app", "main", "createWindow.js")): - with open(os.path.join(filepath, "app", "main", "createWindow.js"), 'r', encoding='UTF-8') as content: - content = content.read() - print( - f' ...making window frameless @ {os.path.join(filepath, "app", "main", "createWindow.js")}') - if '{ frame: false, show: false' not in content: - content = content.replace( - '{ show: false', '{ frame: false, show: false') - print( - f' ...adding "open hidden" capabilities to {os.path.join(filepath, "app", "main", "createWindow.js")}') - content = re.sub('\\s*\\/\\* === INJECTION START === \\*\\/.*?\\/\\* === INJECTION END === \\*\\/\\s*', - 'window.show()', content, flags=re.DOTALL).replace('window.show()', """ - /* === INJECTION START === */ - const path = require('path'), - store = require(path.join(__dirname, '..', 'store.js'))({ - config: 'user-preferences', - defaults: { - openhidden: false, - maximized: false, - tray: false, - } - }); - if (!store.openhidden || electron_1.BrowserWindow.getAllWindows().some(win => win.isVisible())) - { window.show(); if (store.maximized) window.maximize(); } - let appQuit = false; - window.on('close', (e) => { - if (appQuit || !store.tray) window = null; - else { - e.preventDefault(); - window.hide(); - } - }); - electron_1.app.on('activate', () => window.show()); - electron_1.app.on('before-quit', () => (appQuit = true)); - /* === INJECTION END === */ - """) - with open(os.path.join(filepath, "app", "main", "createWindow.js"), 'w', encoding='UTF-8') as write: - write.write(content) - else: - print( - f' * {os.path.join(filepath, "app", "main", "createWindow.js")} was not found: step skipped.') - - if os.path.isfile(os.path.join(filepath, "app", "renderer", "index.js")): - with open(os.path.join(filepath, "app", "renderer", "index.js"), 'r', encoding='UTF-8') as content: - print( - f' ...adjusting drag area for frameless window in {os.path.join(filepath, "app", "renderer", "index.js")}') - content = content.read() - loc = content.rfind('dragRegionStyle') - content = content[:loc] + content[loc:] \ - .replace('top: 0', 'top: 1', 1) \ - .replace('height: 34', 'height: 10', 1) - with open(os.path.join(filepath, "app", "renderer", "index.js"), 'w', encoding='UTF-8') as write: - write.write(content) - else: - print( - f' * {os.path.join(filepath, "app", "renderer", "index.js")} was not found: step skipped.') - - if os.path.isfile(os.path.join(filepath, "app", "main", "main.js")): - with open(os.path.join(filepath, "app", "main", "main.js"), 'r', encoding='UTF-8') as content: - print( - f' ...adding tray support (inc. context menu with settings) to {os.path.join(filepath, "app", "main", "main.js")}') - print( - f' ...adding window toggle hotkey to {os.path.join(filepath, "app", "main", "main.js")}') - content = content.read() - with open(os.path.join(filepath, "app", "main", "main.js"), 'w', encoding='UTF-8') as write: - if '/* === INJECTION MARKER === */' in content: - print(' * tray.js already added. replacing it.') - original = [] - for line in content.splitlines(): - if '/* === INJECTION MARKER === */' in line: - break - original.append(line) - write.write('\n'.join(original)) - else: - write.write(content.replace( - 'electron_1.app.on("ready", handleReady);', - 'electron_1.app.on("ready", () => handleReady() && enhancements());') + '\n') - with open(os.path.join(filepath, "app", "main", "main.js"), 'a', encoding='UTF-8') as append: - with open(os.path.join(__dirname__, 'resources', 'tray.js'), 'r', encoding='UTF-8') as insert: - append.write('\n' + insert.read().replace( - '☃☃☃hotkey☃☃☃', hotkey).replace( - '☃☃☃resources☃☃☃', os.path.join(enhancer_folder, 'resources').replace('\\', '/')) - ) - print( - f' ...copying datastore wrapper {os.path.join(".", "resources", "store.js")} to {os.path.join(filepath, "app")}') - copyfile(os.path.join(__dirname__, 'resources', 'store.js'), - os.path.join(filepath, "app", "store.js")) - else: - print( - f' * {os.path.join(filepath, "app", "main", "main.js")} was not found: step skipped.') - - if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower(): - print( - f' ...patching app launcher') - subprocess.call( - ['sed', '-i', r's/electron\ app\.asar/electron\ app/', - '/usr/bin/notion-app' if os.path.exists('/usr/bin/notion-app') else '/usr/bin/notion']) - - print('\n>>> SUCCESSFULLY CUSTOMISED <<<') - -except Exception as e: - print( - f'\n### ERROR (report this to dragonwocky#8449 on discord) ###\n{str(e)}') - -print('\n=== END OF LOG ===') diff --git a/docs.json b/docs.json deleted file mode 100644 index f101b7e..0000000 --- a/docs.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "title": "notion enhancer", - "primary": "rgb(75, 133, 209)", - "git": "https://github.com/dragonwocky/notion-enhancer/blob/master/", - "footer": "[Edit on GitHub](__git__) // © 2020 dragonwocky & Uzver, under the [MIT license](https://choosealicense.com/licenses/mit/).", - "card": { - "description": "an enhancer/customiser for the all-in-one productivity workspace notion.so", - "url": "https://dragonwocky.me/notion-enhancer/" - }, - "icon": { - "light": "notion.png" - }, - "overwrite": true, - "exclude": [ - "cleaner.py", - "customiser.py", - "resources/*", - ".gitignore", - "Pipfile", - "Pipfile.lock" - ], - "nav": [ - ["index.html", "README.md"], - ["styling.html", "STYLING.md"], - "resources", - ["changelog.html", "CHANGELOG.md"], - [ - "license", - "https://github.com/dragonwocky/notion-enhancer/blob/master/LICENSE" - ], - ["github", "https://github.com/dragonwocky/notion-enhancer/"], - ["me (dragonwocky)", "https://dragonwocky.me/"] - ] -} diff --git a/docs/LICENSE b/docs/LICENSE deleted file mode 100644 index 26171ec..0000000 --- a/docs/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2020 TarasokUA -Copyright (c) 2020 dragonwocky - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/docs/changelog.html b/docs/changelog.html deleted file mode 100644 index 6b20c7b..0000000 --- a/docs/changelog.html +++ /dev/null @@ -1,135 +0,0 @@ -changelog | notion enhancer

notion enhancer

- -
-

- changelog -

-

if something is crossed out, then it is no longer a feature included by default, -but can still easily be enabled by following instructions in the docs.

- -
-
-

- v0.7.0 (2020-07-09) -

-
    -
  • new: tray option to use system default emojis (instead of twitter's emojiset).
  • -
  • new: mac support (identical functionality to others platforms with the -exception of the native minimise/maximise/close buttons being kept, as they integrate -better with the OS while not being out-of-place in notion).
  • -
  • new: notion-deb-builder support for linux.
  • -
  • improved: replaced button symbols with svgs for multi-platform support.
  • -
  • improved: window close button is now red on hover (thanks to @torchatlas).
  • -
  • bugfix: cleaner.py patched for linux.
  • -
  • bugfix: tray now operates as expected on linux.
  • -
  • bugfix: odd mix of \\ and / being used for windows filepaths.
  • -
  • bugfix: app no longer crashes when sidebar is toggled.
  • -
- -
-
-

- v0.6.0 (2020-06-30) -

-
    -
  • style: custom fonts.
  • -
  • style: font resizing.
  • -
  • style: hide discussions (thanks to u/Roosmaryn).
  • -
  • new: custom colour theming, demonstrated via the dark+ theme.
  • -
  • new: linux support (thanks to @Blacksuan19).
  • -
  • improved: if hotkey is pressed while notion is unfocused, it will bring it to the front rather than hiding it.
  • -
  • improved: stop window buttons breaking at smaller widths.
  • -
  • improved: more obviously visible drag area.
  • -
  • bugfix: specify UTF-8 encoding to prevent multibyte/gbk codec errors (thanks to @etnperlong).
  • -
-
-

📥 notion-enhancer.v0.6.0.zip

-
- -
-
-

- v0.5.0 (2020-05-23) -

-
    -
  • new: running from the wsl.
  • -
  • new: reload window with f5.
  • -
  • improved: code has been refactored and cleaned up, -inc. file renaming and a customiser.py that doesn't require -a run of cleaner.py to build modifications. -improved: scrollbar colours that fit better with notion's theming.
  • -
  • bugfix: un-break having multiple notion windows open.
  • -
-
-

📥 notion-enhancer.v0.5.0.zip

-
-

(forked by @dragonwocky.)

- -
-
-

- v0.4.1 (2020-02-13) -

-
    -
  • bugfix: wider table & the "+" button not working in database pages.
  • -
-
-

📥 notion-enhancer.v4.1.zip

-
- -
-
-

- v0.4.0 -

-
    -
  • new: tray icon.
  • -
  • new: app startup options (+ saving).
  • -
  • new: Reset.py
  • -
  • improved: better output from Customization Patcher.py.
  • -
  • bugfix: wider tables in "short page" mode.
  • -
  • bugfix: unclickable buttons/draggable area (of titlebar).
  • -
- -
-
-

- v0.3.0 -

-
    -
  • new: show/hide window hotkey.
  • -
  • new: app startup options.
  • -
  • style: smaller table icons.
  • -
-
-

📥 notion-enhancer.v3.zip

-
- -
-
-

- v0.2.0 -

-
    -
  • new: light/dark theme support for window control buttons + scrollbars.
  • -
  • new: custom styles directly linked to the enhancer resources + compatible with web version.
  • -
  • improved: making table column width go below 100px.
  • -
- -
-
-

- v0.1.0 -

-
    -
  • new: custom window control buttons.
  • -
  • removed: default titlebar/menubar.
  • -
  • removed: huge padding of board view.
  • -
  • removed: huge padding of table view.
  • -
  • optional: making table column width go below 100px.
  • -
  • style: thinner cover image + higher content block.
  • -
  • style: scrollbars.
  • -
- -
\ No newline at end of file diff --git a/docs/docs.css b/docs/docs.css deleted file mode 100644 index c24ffcc..0000000 --- a/docs/docs.css +++ /dev/null @@ -1,501 +0,0 @@ -/* - * Documentative Styling - * (c) 2020 dragonwocky - * (https://dragonwocky.me/) under the MIT license - */ -:root { - --primary: #4b85d1; - --absolute: #000; - --contrast: #fff; - --text: rgba(0, 0, 0, 0.84); - --link: var(--primary); - --grey: #6f6f6f; - --bg: #fbfcfc; - --box: #f2f3f4; - --code: #f7f9f9; - --button: #eee; - --border: #e5e7e9; - --shadow: #eee; - --glow: transparent; - --scroll: #e9e9e9; - --hover: #dedede; - --code-lang: #555; - --hljs-html: #000080; - --hljs-attr: #008080; - --hljs-obj: #2c426b; - --hljs-string: #d14; - --hljs-builtin: #0086b3; - --hljs-keyword: rgba(0, 0, 0, 0.84); - --hljs-selector: #900; - --hljs-type: #458; - --hljs-regex: #009926; - --hljs-symbol: #990073; - --hljs-meta: #999; - --hljs-comment: #707070; - --hljs-deletion: #e8b9b8; - --hljs-deletion-text: #4c232d; - --hljs-addition: #b9e0d3; - --hljs-addition-text: #1e4839; -} -@media (prefers-color-scheme: dark) { - :root { - --absolute: #fff; - --contrast: #000; - --text: #ddd; - --link: #a6c3e8; - --grey: #52555c; - --bg: #0e0f0f; - --box: #050505; - --code: #000; - --button: #2d2d2d; - --border: #2d2e2f; - --shadow: #070707; - --glow: var(--primary); - --scroll: #202225; - --hover: #36393f; - --code-lang: #ccc; - --hljs-html: #46db8c; - --hljs-attr: #dd1111; - --hljs-obj: #c6cbda; - --hljs-string: #abcdef; - --hljs-builtin: #b8528d; - /* bd1a79, 926956 */ - --hljs-keyword: #2d8b59; - --hljs-comment: #a0a0a0; - --hljs-deletion: #4c232d; - --hljs-deletion-text: #e8b9b8; - --hljs-addition: #1e4839; - --hljs-addition-text: #b9e0d3; - } -} -* { - box-sizing: border-box; - word-break: break-word; - text-decoration: none; - text-size-adjust: 100%; -} -html, -body { - width: 100%; - height: 100%; - margin: 0; - padding: 0; -} -body { - color: var(--text); - background-color: var(--bg); - font-family: 'Nunito Sans', sans-serif; -} -::-webkit-scrollbar { - width: 2px; - height: 2px; -} -::-webkit-scrollbar-corner, -::-webkit-scrollbar-track { - background-color: transparent; -} -::-webkit-scrollbar-thumb { - background-color: var(--scroll); - border-radius: 5px; -} -::-webkit-scrollbar-thumb:hover { - background: var(--hover); -} -aside { - display: flex; - flex-direction: column; - background-color: var(--box); - overflow-x: auto; -} -aside .title { - display: flex; - flex-direction: row; -} -aside .title h1 { - font: 1.8em 'Source Code Pro', monospace; - margin: 0 0 1em 1.5rem; - padding: 1em 8px 2.5px 0; - letter-spacing: -2px; - border-bottom: 5px solid var(--primary); - color: var(--absolute); -} -aside .title .icon { - margin: auto 0.5em; -} -aside .title .icon img { - width: 2.5em; - margin: auto 0.5em; -} -aside > ul:first-child > li:first-child { - padding-top: 1em; -} -aside ul { - list-style-type: none; - padding-inline-start: 0; - margin: 0; -} -aside ul li p { - font-weight: bold; - letter-spacing: -0.5px; - margin-bottom: 0; - padding: 2px 1.3em; - font-size: 1.1em; - color: var(--hljs-comment); -} -aside ul li a { - color: var(--text); - padding-bottom: 0.1em 5em; - display: block; - padding: 2px 1.5em; -} -aside ul li a:hover, -aside ul li a:active { - background: var(--scroll); -} -aside ul li a.active { - color: var(--link); - font-weight: bold; - text-shadow: 0 0 0.75em var(--glow); -} -aside ul li.entry > a { - text-decoration: underline var(--border); -} -aside ul li.level-1 > a { - padding-left: 1.75em; -} -aside ul li.level-2 > a { - padding-left: calc(1.5em + calc(0.75em * 1)); -} -aside ul li.level-3 > a { - padding-left: calc(1.5em + calc(0.75em * 2)); -} -aside ul li.level-4 > a { - padding-left: calc(1.5em + calc(0.75em * 3)); -} -aside ul li.level-5 > a { - padding-left: calc(1.5em + calc(0.75em * 4)); -} -aside ul li.level-6 > a { - padding-left: calc(1.5em + calc(0.75em * 5)); -} -aside .mark { - text-align: right; - margin-top: auto; - padding: 1.5em 1.5em 2px 1.5em; - font-size: 0.8em; -} -aside .mark a { - color: var(--grey); -} -.wrapper { - height: 100%; - width: 100%; - overflow-y: hidden; -} -.wrapper .documentative { - height: 100%; - overflow-y: auto; - padding: 0 1.5em; - padding-bottom: 4em; - display: flex; - flex-direction: column; -} -.wrapper .documentative .block { - margin: 1.5em; - word-wrap: break-word; -} -.wrapper .documentative .block:first-child { - margin: 0 1.5em 1.5em 1.5em; -} -.wrapper .documentative .example { - margin-top: 1em; - padding: 1em; - background-color: var(--box); - box-shadow: 0.4em 0.4em 1em var(--shadow); -} -.wrapper .documentative .example p:first-child { - margin-top: 0; -} -.wrapper .documentative .example p:last-child { - margin-bottom: 0; -} -.wrapper .documentative nav { - width: 75%; - position: fixed; - bottom: 1em; - right: 0; - pointer-events: none; -} -.wrapper .documentative nav .prev { - float: left; - padding-right: 0.13em; -} -.wrapper .documentative nav .next { - float: right; - padding-left: 0.13em; -} -.wrapper .documentative nav .prev, -.wrapper .documentative nav .next { - opacity: 1; - transition: opacity 200ms ease; - pointer-events: all; - border-radius: 50%; - width: 1.75em; - height: 1.75em; - margin: 0 1em; - font: 1.5em 'Source Code Pro', monospace; - line-height: 1.75em; - text-align: center; - color: var(--text); - text-shadow: none !important; - background-color: var(--button); -} -.wrapper .documentative .footer { - text-align: right; - color: var(--grey); - margin: auto 1.5em 0; -} -.wrapper .documentative .footer hr { - border-color: var(--grey); -} -.wrapper .documentative .footer a { - color: var(--grey); - font-weight: bold; - text-shadow: none; - text-decoration: dotted underline; -} -.wrapper .documentative h1, -.wrapper .documentative h2, -.wrapper .documentative h3, -.wrapper .documentative h4, -.wrapper .documentative h5, -.wrapper .documentative h6 { - margin: 0; - padding-top: 1em; -} -.wrapper .documentative h1 a, -.wrapper .documentative h2 a, -.wrapper .documentative h3 a, -.wrapper .documentative h4 a, -.wrapper .documentative h5 a, -.wrapper .documentative h6 a { - color: var(--text); - text-shadow: none; -} -.wrapper .documentative h1 { - padding-top: 1.5em; -} -.wrapper .documentative a { - color: var(--link); - text-shadow: 0 0 0.75em var(--glow); -} -.wrapper .documentative img { - max-width: 100%; -} -.wrapper .documentative blockquote { - margin-left: 0; - padding-left: 1em; - border-left: 0.25em solid var(--border); -} -.wrapper .documentative h1 + table, -.wrapper .documentative h2 + table, -.wrapper .documentative h3 + table, -.wrapper .documentative h4 + table, -.wrapper .documentative h5 + table, -.wrapper .documentative h6 + table { - margin-top: 1em; -} -.wrapper .documentative table { - width: 100%; - border-collapse: collapse; -} -.wrapper .documentative table, -.wrapper .documentative th, -.wrapper .documentative td { - padding: 0.2em 0.7em; - border: 1px solid var(--border); -} -.wrapper .documentative code { - font-size: 0.8em; - background-color: var(--code); - overflow-x: auto; - position: relative; - display: block; - font-family: 'Source Code Pro', monospace; -} -.wrapper .documentative *:not(pre) > code { - padding: 0.275em 0.35em; - border-radius: 2px; - display: inline; -} -.wrapper .documentative pre { - position: relative; -} -.wrapper .documentative pre code { - padding: 1.8em; - border-radius: 5px; - position: static; -} -.wrapper .documentative pre code::before { - position: absolute; - right: 0; - top: 0; - color: var(--code-lang); - font-size: 0.65em; - padding: 0.5em 0.8em; -} -@media (min-width: 769px) { - body { - display: grid; - grid-template-columns: 25% 75%; - } - aside::-webkit-scrollbar-corner, - aside::-webkit-scrollbar-track { - background-color: var(--bg); - } - .toggle { - display: none; - } -} -@media (max-width: 768px) { - aside { - z-index: 1; - height: 100%; - display: flex; - position: fixed; - top: 0; - left: calc(4.5em - 100%); - width: calc(100% - 4.5em); - transition: left 300ms ease; - } - .wrapper { - display: flex; - flex-direction: column; - position: fixed; - top: 0; - left: 0; - transition: left 300ms ease; - } - .wrapper .documentative { - flex-shrink: 1; - } - .wrapper .documentative nav { - width: 100%; - } - .wrapper .toggle { - display: flex; - flex-direction: row; - flex-shrink: 0; - padding: 0.8em 0; - background-color: var(--box); - } - .wrapper .toggle h1 { - letter-spacing: -2px; - font-size: 1.8em; - padding-top: 1.5px; - margin: auto 1.5rem auto 0; - } - .wrapper .toggle button { - font-size: 1.8em; - width: 2.5em; - margin: auto 0.5em; - color: var(--absolute); - border: none; - background: none; - text-align: center; - transition: transform 150ms ease; - -webkit-appearance: none; - -moz-appearance: none; - } - .wrapper .toggle button:hover, - .wrapper .toggle button:focus { - color: var(--text); - } - .wrapper .toggle button:active { - transform: scale(0.95); - } - .mobilemenu aside { - left: 0; - } - .mobilemenu .wrapper { - left: calc(100% - 4.75em); - } - .mobilemenu .wrapper .prev, - .mobilemenu .wrapper .next { - opacity: 0 !important; - pointer-events: none !important; - } -} -.hljs-subst { - color: var(--text); -} -.hljs-comment, -.hljs-quote { - color: var(--hljs-comment); - font-style: italic; -} -.hljs-keyword, -.hljs-selector-tag { - color: var(--hljs-keyword); - font-weight: bold; -} -.hljs-attr { - color: var(--hljs-obj); -} -.hljs-number, -.hljs-literal, -.hljs-variable, -.hljs-template-variable, -.hljs-tag .hljs-attr { - color: var(--hljs-attr); -} -.hljs-string, -.hljs-doctag { - color: var(--hljs-string); -} -.hljs-name, -.hljs-attribute { - color: var(--hljs-html); -} -.hljs-built_in, -.hljs-builtin-name { - color: var(--hljs-builtin); -} -.hljs-title, -.hljs-section, -.hljs-selector-id { - color: var(--hljs-selector); - font-weight: bold; -} -.hljs-type, -.hljs-class .hljs-title { - color: var(--hljs-type); - font-weight: bold; -} -.hljs-regexp, -.hljs-link { - color: var(--hljs-regex); -} -.hljs-symbol, -.hljs-bullet { - color: var(--hljs-symbol); -} -.hljs-meta { - color: var(--hljs-meta); - font-weight: bold; -} -.hljs-deletion { - background: var(--hljs-deletion); - color: var(--hljs-deletion-text); -} -.hljs-addition { - background: var(--hljs-addition); - color: var(--hljs-addition-text); -} -.hljs-emphasis { - font-style: italic; -} -.hljs-strong { - font-weight: bold; -} -.documentative pre .lang-css::before { content: 'CSS'; } \ No newline at end of file diff --git a/docs/docs.js b/docs/docs.js deleted file mode 100644 index 10f5650..0000000 --- a/docs/docs.js +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Documentative - * (c) 2020 dragonwocky - * (https://dragonwocky.me/) under the MIT license - */ - -class Scrollnav { - constructor(menu, content, options) { - if (!(menu instanceof HTMLElement)) - throw Error('scrollnav: invalid element provided'); - if (!(content instanceof HTMLElement)) - throw Error('scrollnav: invalid element provided'); - if (typeof options !== 'object') options = {}; - - if (Scrollnav.prototype.INITIATED) - throw Error('scrollnav: only 1 instance per page allowed!'); - Scrollnav.prototype.INITIATED = true; - - this.ID; - this.ticking = []; - this._menu = menu; - this._content = content; - this._links = []; - this._sections = [...this._menu.querySelectorAll('ul li a')].reduce( - (list, link) => { - if (!link.getAttribute('href').startsWith('#')) return list; - let section = this._content.querySelector(link.getAttribute('href')); - if (!section) return list; - - this._links.push(link); - link.onclick = async ev => { - ev.preventDefault(); - const ID = link.getAttribute('href'); - this.highlightHeading(ID); - this.scrollContent(ID); - this.setHash(ID); - }; - - return [...list, section]; - }, - [] - ); - this._topheading = `#${this._sections[0].id}`; - - window.onhashchange = this.watchHash.bind(this); - this._content.addEventListener('scroll', ev => { - if (!this.ticking.length) { - this.ticking.push(1); - requestAnimationFrame(() => { - this.watchScroll(ev); - this.ticking.pop(); - }); - } - }); - - this.set(null, false); - return this; - } - - set(ID, smooth) { - this.highlightHeading(ID); - this.scrollMenu(ID, smooth); - this.scrollContent(ID, smooth); - this.setHash(ID); - } - - parseID(ID) { - if (!ID || typeof ID !== 'string') ID = location.hash || this._topheading; - if (!ID.startsWith('#')) ID = `#${ID}`; - if (!this._links.find(el => el.getAttribute('href') === ID)) - ID = this._topheading; - this.ID = ID; - return ID; - } - highlightHeading(ID) { - this.parseID(ID); - this._links.forEach(el => - el.getAttribute('href') === this.ID - ? el.classList.add('active') - : el.classList.remove('active') - ); - return true; - } - - watchHash(ev) { - ev.preventDefault(); - if (ev.newURL !== ev.oldURL) { - this.set(); - } - } - setHash(ID) { - if (!history.replaceState) return false; - this.parseID(ID); - history.replaceState(null, null, ID === this._topheading ? '#' : this.ID); - return true; - } - - scrollContent(ID, smooth = true) { - this.ticking.push(1); - this.parseID(ID); - let offset = this._sections.find(el => `#${el.id}` === this.ID).offsetTop; - if (offset < this._content.clientHeight / 2) offset = 0; - this._content.scroll({ - top: offset, - behavior: smooth ? 'smooth' : 'auto' - }); - setTimeout(() => this.ticking.pop(), 1000); - return true; - } - scrollMenu(ID, smooth = true) { - this.parseID(ID); - let offset = this._links.find(el => el.getAttribute('href') === this.ID) - .offsetTop; - if (offset < this._menu.clientHeight / 2) offset = 0; - this._menu.scroll({ - top: offset, - behavior: smooth ? 'smooth' : 'auto' - }); - return true; - } - watchScroll(ev) { - const viewport = this._content.clientHeight, - ID = this._sections.reduce( - (carry, el) => { - const rect = el.getBoundingClientRect(), - height = rect.bottom - rect.top, - visible = { - top: rect.top >= 0 && rect.top < viewport, - bottom: rect.bottom > 0 && rect.top < viewport - }; - let pixels = 0; - if (visible.top && visible.bottom) { - pixels = height; // whole el - } else if (visible.top) { - pixels = viewport - rect.top; - } else if (visible.bottom) { - pixels = rect.bottom; - } else if (height > viewport && rect.top < 0) { - const absolute = Math.abs(rect.top); - if (absolute < height) pixels = height - absolute; // part of el - } - pixels = (pixels / height) * 100; - return pixels > carry[0] ? [pixels, el] : carry; - }, - [0, null] - )[1].id; - this.ID = ID; - this.scrollMenu(this.ID); - clearTimeout(this.afterScroll); - this.afterScroll = setTimeout( - () => void (this.highlightHeading(this.ID) && this.setHash(this.ID)), - 100 - ); - } -} - -let constructed = false; -const construct = () => { - if (document.readyState !== 'complete' || constructed) return false; - constructed = true; - - if ( - location.pathname.endsWith('index.html') && - window.location.protocol === 'https:' - ) - location.replace('./' + location.hash); - - new Scrollnav( - document.querySelector('aside'), - document.querySelector('.documentative') - ); - - document.querySelector('.toggle button').onclick = () => - document.body.classList.toggle('mobilemenu'); - - if (window.matchMedia) { - let prev; - const links = [...document.head.querySelectorAll('link[rel*="icon"]')], - pointer = document.createElement('link'); - pointer.setAttribute('rel', 'icon'); - document.head.appendChild(pointer); - setInterval(() => { - const match = links.find(link => window.matchMedia(link.media).matches); - if (!match || match.media === prev) return; - prev = match.media; - pointer.setAttribute('href', match.getAttribute('href')); - }, 500); - links.forEach(link => document.head.removeChild(link)); - } -}; - -construct(); -document.addEventListener('readystatechange', construct); diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index f756a3e..0000000 --- a/docs/index.html +++ /dev/null @@ -1,160 +0,0 @@ -notion enhancer

notion enhancer

- -
-

- notion enhancer -

-

an enhancer/customiser for the all-in-one productivity workspace notion.so

- -
-
-

- supported clients -

-

there are a lot of ways to use notion. some official clients, many not.

-

the enhancer supports:

- -

there are others, yes. the enhancer does not support them. you should not expect them to work. -if for some reason you need to use one of them instead of the above listed ones, open a -platform support request.

-

please do not modify the enhancer code specifically to work for your installation. -if you have the know-how to do so, instead open a pull request with your changes -so that proper support can be added for all users of that client.

-

mobile clients are not supported and due to system limitations/restrictions cannot be.

-

(the styles should also work for the web version. -these can be installed via an extension like stylus -or a built-in feature like userChrome.css.)

-

if the script is run from the WSL, it will enhance the windows version of the app.

- -
-
-

- installation -

-
    -
  1. install node.js: windows/macOS, linux/WSL.
  2. -
  3. install python: windows/macOS, linux/WSL.
  4. -
  5. reboot.
  6. -
  7. in the appropriate terminal/command line, run npm install -g asar (check installation by running asar).
  8. -
  9. download this enhancer & extract -to a location it can safely remain (if running the script from the WSL, make sure this is from a location within the windows filesystem).
  10. -
  11. ensure no notion processes are running - you may want to check the task manager to make sure.
  12. -
  13. optional: to remove previous applications of the notion enhancer, run cleaner.py.
  14. -
  15. optional: modify the resources/user.css file to your liking (see styling).
  16. -
  17. run customiser.py to build changes. (for linux run with sudo)
  18. -
-

done: run notion and enjoy.

- -
-
-

- faq -

-

now the notion app won't open :(

-
    -
  1. kill any notion tasks in the task manager (ctrl+shift+esc).
  2. -
  3. run cleaner.py.
  4. -
  5. reboot.
  6. -
  7. follow instructions above (ensuring notion isn't running! again, check task manager).
  8. -
-

i tried opening the python file but it just closed instantly and nothing happened?

-

python scripts must be run from the terminal or command prompt via e.g. python customiser.py.

-

now that I've run the script, can I delete the enhancer folder?

-

no! user style files resources/user.css and resources/theme.css are fetched from here each time you open notion. -additionally, if you ever need to change or reset your notion build, the customiser.py and cleaner.py files will be useful.

-

unless you're sure you know what you're doing (if you have to ask, you probably don't) then do not delete anything.

-

something isn't working, and the suggestions here haven't fixed it...

-

this is probably a bug. please submit a -bug report.

-

can the enhancer do ___?

-

experienced problems with the notion app, or just want to add something a bit more to it? please submit a -feature request.

- -
-
-

- features -

- -
-
-

- titlebar -

-

default windows titlebar/frame has been replaced by one more fitting to the theme of the app.

-

this includes the addition of an extra button, "always on top" -symbolised with an arrow. when toggled to point up, -notion will remain the top visible window even if not focused.

- -
-
-

- nicer scrollbars -

-

i mean, yeah. get rid of those ugly default scrollbars and use nice inconspicuous -ones that actually look as if they're part of notion.

-

to add these to the web version, copy lines 74 - 105 from user.css into your css customiser.

-

-image: before enhancement

-

-image: after default enhancement

- -
-
-

- hotkeys -

-
    -
  • reload window: in addition to the built-in CmdOrCtrl+R reload, -you can now reload a window with F5.
  • -
  • toggle all notion windows to/from the tray: CmdOrCtrl+Shift+A by default.
  • -
-

to set your own toggle hotkey, open customiser.py and change line 19 (hotkey = 'CmdOrCtrl+Shift+A') -to your preference. you will need to run or re-run customiser.py afterwards.

- -
-
-

- tray -

-

single-click to toggle app visibility. right click to open menu.

-
    -
  • run on startup: run notion on boot/startup. (default: true)
  • -
  • hide on open: hide the launch of notion to the tray. (default: false)
  • -
  • open maximised: maximize the app on open. (default: false)
  • -
  • close to tray: close window to tray rather than closing outright -on click of . does not apply if multiple notion windows are open. (default: false)
  • -
  • load theme.css: loads the custom colour theme file. -see colour theming for more information. (default: false)
  • -
  • use system emoji: reverts notion to using normal emojis, rather than the twitter emojiset. (default: false)
  • -
-

-

image: open application tray

- -
-
-

- styling -

-

custom appearances can be applied to the app via the resources/user.css and resources/theme.css files. for more information, -and a list of various optional styling changes, see the page on styling.

- -
-
-

- other details -

-

credit where credit is due, this was originally made by Uzver (github: @TarasokUA, -telegram: UserFromUkraine, discord: Uzver#8760). -he has approved my go-ahead with this fork, as he himself no longer wishes to continue development on the project.

-

the notion logo belongs entirely to the notion team, and was sourced from their -media kit.

-

if you have any questions, check my website for contact details.

- -
\ No newline at end of file diff --git a/docs/notion.png b/docs/notion.png deleted file mode 100644 index 83412d4..0000000 Binary files a/docs/notion.png and /dev/null differ diff --git a/docs/screenshots/app-enhanced.jpg b/docs/screenshots/app-enhanced.jpg deleted file mode 100644 index b127943..0000000 Binary files a/docs/screenshots/app-enhanced.jpg and /dev/null differ diff --git a/docs/screenshots/app-tray.jpg b/docs/screenshots/app-tray.jpg deleted file mode 100644 index bcfd5a3..0000000 Binary files a/docs/screenshots/app-tray.jpg and /dev/null differ diff --git a/docs/screenshots/app-unenhanced.jpg b/docs/screenshots/app-unenhanced.jpg deleted file mode 100644 index ead86d0..0000000 Binary files a/docs/screenshots/app-unenhanced.jpg and /dev/null differ diff --git a/docs/screenshots/board-default.jpg b/docs/screenshots/board-default.jpg deleted file mode 100644 index 46dfe51..0000000 Binary files a/docs/screenshots/board-default.jpg and /dev/null differ diff --git a/docs/screenshots/board-hideaddgroup.jpg b/docs/screenshots/board-hideaddgroup.jpg deleted file mode 100644 index 690162a..0000000 Binary files a/docs/screenshots/board-hideaddgroup.jpg and /dev/null differ diff --git a/docs/screenshots/board-hideaddnew.jpg b/docs/screenshots/board-hideaddnew.jpg deleted file mode 100644 index aa209a8..0000000 Binary files a/docs/screenshots/board-hideaddnew.jpg and /dev/null differ diff --git a/docs/screenshots/board-hidehidden.jpg b/docs/screenshots/board-hidehidden.jpg deleted file mode 100644 index 83700d6..0000000 Binary files a/docs/screenshots/board-hidehidden.jpg and /dev/null differ diff --git a/docs/screenshots/board-shrinkpadding.jpg b/docs/screenshots/board-shrinkpadding.jpg deleted file mode 100644 index e2ef451..0000000 Binary files a/docs/screenshots/board-shrinkpadding.jpg and /dev/null differ diff --git a/docs/screenshots/cover-default.jpg b/docs/screenshots/cover-default.jpg deleted file mode 100644 index 078dc42..0000000 Binary files a/docs/screenshots/cover-default.jpg and /dev/null differ diff --git a/docs/screenshots/cover-thinner.jpg b/docs/screenshots/cover-thinner.jpg deleted file mode 100644 index cf6f8b3..0000000 Binary files a/docs/screenshots/cover-thinner.jpg and /dev/null differ diff --git a/docs/screenshots/discussion-default.jpg b/docs/screenshots/discussion-default.jpg deleted file mode 100644 index fb85493..0000000 Binary files a/docs/screenshots/discussion-default.jpg and /dev/null differ diff --git a/docs/screenshots/discussion-hidden.jpg b/docs/screenshots/discussion-hidden.jpg deleted file mode 100644 index bd97363..0000000 Binary files a/docs/screenshots/discussion-hidden.jpg and /dev/null differ diff --git a/docs/screenshots/fonts-custom.jpg b/docs/screenshots/fonts-custom.jpg deleted file mode 100644 index 79370b5..0000000 Binary files a/docs/screenshots/fonts-custom.jpg and /dev/null differ diff --git a/docs/screenshots/fonts-resized.jpg b/docs/screenshots/fonts-resized.jpg deleted file mode 100644 index 6cac6bf..0000000 Binary files a/docs/screenshots/fonts-resized.jpg and /dev/null differ diff --git a/docs/screenshots/preview-default.jpg b/docs/screenshots/preview-default.jpg deleted file mode 100644 index 8298b6a..0000000 Binary files a/docs/screenshots/preview-default.jpg and /dev/null differ diff --git a/docs/screenshots/preview-wider.jpg b/docs/screenshots/preview-wider.jpg deleted file mode 100644 index 535a337..0000000 Binary files a/docs/screenshots/preview-wider.jpg and /dev/null differ diff --git a/docs/screenshots/table-before.jpg b/docs/screenshots/table-before.jpg deleted file mode 100644 index 471d516..0000000 Binary files a/docs/screenshots/table-before.jpg and /dev/null differ diff --git a/docs/screenshots/table-centredheaders.jpg b/docs/screenshots/table-centredheaders.jpg deleted file mode 100644 index 97a462b..0000000 Binary files a/docs/screenshots/table-centredheaders.jpg and /dev/null differ diff --git a/docs/screenshots/table-columnunder100px.jpg b/docs/screenshots/table-columnunder100px.jpg deleted file mode 100644 index 5fea0ba..0000000 Binary files a/docs/screenshots/table-columnunder100px.jpg and /dev/null differ diff --git a/docs/screenshots/table-hideaddrow.jpg b/docs/screenshots/table-hideaddrow.jpg deleted file mode 100644 index 2786009..0000000 Binary files a/docs/screenshots/table-hideaddrow.jpg and /dev/null differ diff --git a/docs/screenshots/table-hidecalculationsrow.jpg b/docs/screenshots/table-hidecalculationsrow.jpg deleted file mode 100644 index 84d5a43..0000000 Binary files a/docs/screenshots/table-hidecalculationsrow.jpg and /dev/null differ diff --git a/docs/screenshots/table-hidecolumnicons.jpg b/docs/screenshots/table-hidecolumnicons.jpg deleted file mode 100644 index 1b07b1b..0000000 Binary files a/docs/screenshots/table-hidecolumnicons.jpg and /dev/null differ diff --git a/docs/screenshots/table-shrinkpadding.jpg b/docs/screenshots/table-shrinkpadding.jpg deleted file mode 100644 index 880d11a..0000000 Binary files a/docs/screenshots/table-shrinkpadding.jpg and /dev/null differ diff --git a/docs/screenshots/table-smallercolumnicons.jpg b/docs/screenshots/table-smallercolumnicons.jpg deleted file mode 100644 index 418a843..0000000 Binary files a/docs/screenshots/table-smallercolumnicons.jpg and /dev/null differ diff --git a/docs/screenshots/theme-dark+.jpg b/docs/screenshots/theme-dark+.jpg deleted file mode 100644 index 04f279a..0000000 Binary files a/docs/screenshots/theme-dark+.jpg and /dev/null differ diff --git a/docs/styling.html b/docs/styling.html deleted file mode 100644 index d5f00d6..0000000 --- a/docs/styling.html +++ /dev/null @@ -1,313 +0,0 @@ -styling | notion enhancer

notion enhancer

- -
-

- styling -

-

to modify the appearance of the notion app, edit the style rules in resources/user.css, -use some of the suggested/documented optional styles below, or invent your own.

-

these styles are written in a language called "CSS". if you don't know what this is and are interested, -check out some youtube videos or try a free short course like the one on codecademy.

-

due to the enhancements directly fetching from the local CSS files, -changes will be applied instantly on notion reload -(no need to re-run customiser.py every time you want to change some styles).

-

these should also work for the web version, if copied into your css customiser.

-

css below will work for every instance of the element, but if you wish to hide only a specific element -(e.g. the '+ new' table row) it is recommended that you prepend each selector with -[data-block-id='ID'].

- -
-
-

- general/app-wide -

-

-

image: the default post-customisation appearance

- -
-
-

- colour theming -

-

this replaces the default notion dark theme. the provided theme file is my custom dark+ theme: -if you have another you wish to share, please contact me. if a few themes are submitted i will -set up a distribution method (either including them as optionally-enableabled themes or sharing them on the website).

-

to enable, see the tray options.

-

to modify, enter the theme.css file and change the colour values within the :root {} - value names -should describe what each colour will affect.

-

-

image: the dark+ theme

- -
-
-

- hide discussions (comment threads at the top of each page) -

-
.notion-page-view-discussion {
-  display: none !important;
-}
-

-

image: before styling

-

-

image: after styling

- -
-
-

- custom fonts -

-

the @import statement must be added to the top of the file (with nothing above it -except comments or other @import statements)

-

to change the fonts, put the relevant URL in the @import statement and then change the font-family property. -plenty of other fonts that can be found on google fonts or that may be on your system already.

-
@import url('https://fonts.googleapis.com/css2?family=Fira+Code&family=Oxygen&family=Roboto+Slab:wght@300&display=swap');
-.notion-app-inner {
-  font-family: 'Oxygen', sans-serif !important;
-}
-[style*='monospace;'] {
-  font-family: 'Fira Code', monospace !important;
-}
-[style*=', serif;'] {
-  font-family: 'Roboto Slab', serif !important;
-}
-

-

image: after styling

- -
-
-

- font resizing -

-

not recommended: this can mess up container sizes. -it is suggested to instead use ctrl+ or ctrl- to scale everything up/down.

-

to change the size, change the value of --font-scale.

-
:root {
-  --font-scale: 1.4;
-}
-.notion-app-inner {
-  font-size: calc(var(--font-scale) * 16px) !important;
-}
-[style*='font-size: 40px'] {
-  font-size: calc(var(--font-scale) * 40px) !important;
-}
-[style*='font-size: 16px'] {
-  font-size: calc(var(--font-scale) * 16px) !important;
-}
-[style*='font-size: 14px'] {
-  font-size: calc(var(--font-scale) * 14px) !important;
-}
-[style*='font-size: 12px'] {
-  font-size: calc(var(--font-scale) * 12px) !important;
-}
-[style*='font-size: 11px'] {
-  font-size: calc(var(--font-scale) * 11px) !important;
-}
-[style*='font-size: 1.25em'] {
-  font-size: calc(var(--font-scale) * 1.25em) !important;
-}
-

-

image: after styling

- -
-
-

- wider page preview -

-
.notion-peek-renderer > div:nth-child(2) {
-  max-width: 85vw !important;
-}
-

-

image: before styling

-

-

image: after styling

- -
-
-

- thinner cover image -

-
[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;'] {
-  height: 12vh !important;
-}
-[style^='position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; height: 30vh;']
-  img {
-  height: 12vh !important;
-}
-

-

image: before styling

-

-

image: after styling

- -
-
-

- tables -

-

-

image: before styling

- -
-
-

- table columns below 100px -

-

not recommended! this may cause buggy viewing. -as it is a per-table-column style, unlike all others here, it must be prepended with the block ID and repeated for each column.

-

to see how to do this, watch this video.

-
[data-block-id^='tableID']
-  > [style^='display: flex; position: absolute; background: rgb(47, 52, 55); z-index: 82; height: 33px; color: rgba(255, 255, 255, 0.6);']
-  > div:nth-child(1)
-  > div:nth-child(COL_NUMBER)
-  > div:nth-child(1),
-[data-block-id^='tableID']
-  > [style^='position: relative; min-width: calc(100% - 192px);']
-  > [data-block-id]
-  > div:nth-child(COL_NUMBER),
-[data-block-id^='tableID'] > div:nth-child(5) > div:nth-child(COL_NUMBER) {
-  width: 32px !important;
-}
-[data-block-id^='tableID']
-  [style^='position: absolute; top: 0px; left: 0px; pointer-events: none;']:not(.notion-presence-container) {
-  display: none;
-}
-

-

image: after styling

- -
-
-

- hide '+ new' table row -

-
.notion-table-view-add-row {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- hide calculations table row -

-
.notion-table-view-add-row + div {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- centre-align table column headers -

-
.notion-table-view-header-cell > div > div {
-  margin: 0px auto;
-}
-

-

image: after styling

- -
-
-

- smaller table column header icons -

-
[style^='display: flex; position: absolute; background: rgb(47, 52, 55); z-index: 82; height: 33px; color: rgba(255, 255, 255, 0.6);']
-  div:nth-child(1)
-  svg {
-  height: 10px !important;
-  width: 10px !important;
-  margin-right: -4px;
-}
-

-

image: after styling

- -
-
-

- remove icons from table column headers -

-
.notion-table-view-header-cell [style^='margin-right: 6px;'] {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- removing/decreasing side padding for tables -

-
[style^='flex-shrink: 0; flex-grow: 1; width: 100%; max-width: 100%; display: flex; align-items: center; flex-direction: column; font-size: 16px; color: rgba(255, 255, 255, 0.9); padding: 0px 96px 30vh;']
-  .notion-table-view,
-[class='notion-scroller'] > .notion-table-view {
-  padding-left: 35px !important;
-  padding-right: 15px !important;
-  min-width: 0% !important;
-}
-[style^='flex-shrink: 0; flex-grow: 1; width: 100%; max-width: 100%; display: flex; align-items: center; flex-direction: column; font-size: 16px; color: rgba(255, 255, 255, 0.9); padding: 0px 96px 30vh;']
-  .notion-selectable
-  .notion-scroller.horizontal::-webkit-scrollbar-track {
-  margin-left: 10px;
-  margin-right: 10px;
-}
-

-

image: after styling

- -
-
-

- boards -

-

-

image: before styling

- -
-
-

- hide '+ new' board row -

-
.notion-board-group
-  [style='user-select: none; transition: background 120ms ease-in 0s; cursor: pointer; display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; height: 32px; border-radius: 3px; font-size: 14px; line-height: 1.2; min-width: 0px; padding-left: 6px; padding-right: 8px; color: rgba(255, 255, 255, 0.4); width: 100%;'] {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- hide board view hidden columns -

-
.notion-board-view > [data-block-id] > div:nth-last-child(2),
-.notion-board-view > [data-block-id] > div:first-child > div:nth-last-child(2) {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- hide board view 'add a group' -

-
.notion-board-view > [data-block-id] > div:last-child,
-.notion-board-view > [data-block-id] > div:first-child > div:last-child {
-  display: none !important;
-}
-

-

image: after styling

- -
-
-

- removing/decreasing side padding for boards -

-
.notion-board-view {
-  padding-left: 10px !important;
-  padding-right: 10px !important;
-}
-

-

image: after styling

- -
\ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..60f5aed --- /dev/null +++ b/index.js @@ -0,0 +1,46 @@ +#!/usr/bin/env node + +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/notion-enhancer) under the MIT license + */ + +'use strict'; +const meta = require('./package.json'), + cli = require('cac')(); + +// '=== title ===' +// ' ...information' +// ' * warning' +// ' > prompt' +// ' ~~ exit' +// '### error ###' + +cli.option('-y, --yes', ': skip prompts (may overwrite data)'); + +cli + .command('apply', ': add enhancements to the notion app') + .action((options) => { + require('./apply.js')(options.yes); + }); +cli + .command('remove', ': return notion to its pre-enhanced/pre-modded state') + .action((options) => { + require('./remove.js')(options.yes); + }); + +cli.globalCommand.option('-h, --help', ': display usage information'); +cli.globalCommand.helpCallback = (sections) => { + sections[0].body += '\nhttps://github.com/dragonwocky/notion-enhancer'; +}; +cli.showHelpOnExit = true; + +cli.globalCommand.option('-v, --version', ': display version number'); +cli.globalCommand.versionNumber = meta.version; +cli.showVersionOnExit = true; + +cli.parse(); + +if (!cli.matchedCommand) cli.outputHelp(); diff --git a/notion.png b/notion.png deleted file mode 100644 index 83412d4..0000000 Binary files a/notion.png and /dev/null differ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1be1a27 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,169 @@ +{ + "name": "notion-enhancer", + "version": "0.8.0-beta", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", + "optional": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "optional": true + }, + "@types/node": { + "version": "14.0.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.22.tgz", + "integrity": "sha512-emeGcJvdiZ4Z3ohbmw93E/64jRzUHAItSHt8nF7M4TGgQTiWqFVGB8KNpLGFmUHmHLvjvBgFwVlqNcq+VuGv9g==", + "optional": true + }, + "asar": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/asar/-/asar-3.0.3.tgz", + "integrity": "sha512-k7zd+KoR+n8pl71PvgElcoKHrVNiSXtw7odKbyNpmgKe7EGRF9Pnu3uLOukD37EvavKwVFxOUpqXTIZC5B5Pmw==", + "requires": { + "@types/glob": "^7.1.1", + "chromium-pickle-js": "^0.2.0", + "commander": "^5.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.4" + } + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "cac": { + "version": "6.5.12", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.5.12.tgz", + "integrity": "sha512-XUhnXoAEdDCufbxn0U1vhbPKMoTx3D/D5Dcn8s0bOl6RZmYdxFE7TsWFbMqMMAqVFGhdbnZpXN+HosiuJiGfAQ==" + }, + "chromium-pickle-js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU=" + }, + "commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "jsonfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", + "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..ab64c1a --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "notion-enhancer", + "version": "0.8.0-beta", + "description": "an enhancer/customiser for the all-in-one productivity workspace notion.so", + "main": "index.js", + "bin": { + "notion-enhancer": "index.js" + }, + "scripts": { + "test": "echo \"no test specified\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/dragonwocky/notion-enhancer.git" + }, + "keywords": [ + "notion", + "productivity", + "mod", + "loader", + "enhancer", + "hack", + "macOS", + "windows", + "linux" + ], + "author": "dragonwocky (https://dragonwocky.me/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/dragonwocky/notion-enhancer/issues" + }, + "homepage": "https://dragonwocky.me/notion-enhancer", + "dependencies": { + "asar": "^3.0.3", + "cac": "^6.5.12", + "fs-extra": "^9.0.1" + } +} diff --git a/remove.js b/remove.js new file mode 100644 index 0000000..aea2a3f --- /dev/null +++ b/remove.js @@ -0,0 +1,110 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (https://dragonwocky.me/notion-enhancer) under the MIT license + */ + +'use strict'; +const os = require('os'), + fs = require('fs-extra'), + path = require('path'), + exec = require('util').promisify(require('child_process').exec), + utils = require('./utils.js'); + +let __notion = utils.get_notion(); + +module.exports = async function (yes) { + console.info('=== NOTION RESTORATION LOG ==='); + try { + const file_operations = []; + __notion = await __notion; + + const app_folder = path.join(__notion, 'app'); + if (await fs.pathExists(app_folder)) { + console.info(` ...removing folder ${app_folder}`); + file_operations.push(fs.remove(app_folder)); + } else console.warn(` * ${app_folder} not found: step skipped.`); + + const asar_bak = path.join(__notion, 'app.asar.bak'); + if (await fs.pathExists(asar_bak)) { + console.info(' ...moving asar.app.bak to app.asar'); + + let write = true; + if (await fs.pathExists(path.join(__notion, 'app.asar'))) { + console.warn(' * app.asar already exists!'); + if (!yes) { + do { + process.stdout.write(' > overwrite? [Y/n]: '); + write = await utils.readline(); + } while (write && !['y', 'n'].includes(write.toLowerCase())); + write = !write || write.toLowerCase() == 'y'; + } else write = true; + console.info( + write + ? ' ...overwriting app.asar with app.asar.bak' + : ' ...removing app.asar.bak' + ); + } + + file_operations.push( + write + ? fs.move(asar_bak, path.join(__notion, 'app.asar'), { + overwrite: true, + }) + : fs.remove(asar_bak) + ); + } else console.warn(` * ${asar_bak} not found: step skipped.`); + + await Promise.all(file_operations); + + if ( + [ + '/opt/notion-app', // https://aur.archlinux.org/packages/notion-app/ + '/opt/notion', // https://github.com/jaredallard/notion-app + ].includes(__notion) + ) { + console.info( + ' ...patching app launcher (notion-app linux wrappers only).' + ); + const bin_path = `/usr/bin/${(await __notion).split('/')[2]}`, + bin_script = await fs.readFile(bin_path, 'utf8'); + if (!bin_script.includes('app.asar')) { + await fs.outputFile( + bin_path, + bin_script.replace('electron app\n', 'electron app.asar\n') + ); + } + } + } catch (err) { + console.error(`### ERROR ###\n${err}`); + } + console.info(' ~~ success.'); + console.info('=== END OF LOG ==='); +}; + +// getNotion() +// .then(async (__notion) => { +// console.log(__notion); +// await exec( +// `"${__dirname}/node_modules/asar/bin/asar.js" extract "${__notion}/app.asar" "${__notion}/app"` +// ); +// }) +// .catch((err) => console.log(err.message)); + +// if sys.platform == `linux` and `microsoft` not in platform.uname()[3].lower(): +// bin_path = `/usr/bin/notion-app` if os.path.exists( +// `/usr/bin/notion-app`) else `/usr/bin/notion` +// with open(bin_path, `r`, encoding=`UTF-8`) as launcher: +// if `app.asar` not in launcher: +// print( +// f` ...patching app launcher`) +// subprocess.call( +// [`sed`, `-i`, r`s/electron\ app/electron\ app\.asar/`, +// bin_path]) + +// print(f`\n{bold}>>> SUCCESSFULLY CLEANED <<<{normal}`) + +// except Exception as e: +// print(f`\n{bold}### ERROR (report this to dragonwocky#8449 on discord) ###{normal}\n{str(e)}`) + +// print(f`\n{bold}=== END OF LOG ==={normal}`) diff --git a/resources/icons/alwaysontop_off.svg b/resources/icons/alwaysontop_off.svg deleted file mode 100644 index e731f9b..0000000 --- a/resources/icons/alwaysontop_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/alwaysontop_on.svg b/resources/icons/alwaysontop_on.svg deleted file mode 100644 index b9befcd..0000000 --- a/resources/icons/alwaysontop_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/close.svg b/resources/icons/close.svg deleted file mode 100644 index 7268fb0..0000000 --- a/resources/icons/close.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/maximise_off.svg b/resources/icons/maximise_off.svg deleted file mode 100644 index e79979f..0000000 --- a/resources/icons/maximise_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/maximise_on.svg b/resources/icons/maximise_on.svg deleted file mode 100644 index 038b21e..0000000 --- a/resources/icons/maximise_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/minimise.svg b/resources/icons/minimise.svg deleted file mode 100644 index e40cd84..0000000 --- a/resources/icons/minimise.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/icons/tray.png b/resources/icons/tray.png deleted file mode 100644 index 83412d4..0000000 Binary files a/resources/icons/tray.png and /dev/null differ diff --git a/resources/icons/windows.ico b/resources/icons/windows.ico deleted file mode 100644 index b46f68c..0000000 Binary files a/resources/icons/windows.ico and /dev/null differ diff --git a/resources/preload.js b/resources/preload.js deleted file mode 100644 index 5e9e12b..0000000 --- a/resources/preload.js +++ /dev/null @@ -1,211 +0,0 @@ -/* === INJECTION MARKER === */ - -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (https://dragonwocky.me/) under the MIT license - */ - -// adds: custom styles, nicer window control buttons - -// DO NOT REMOVE THE MARKERS ABOVE. - -require('electron').remote.getGlobal('setTimeout')(() => { - const fs = require('fs'), - path = require('path'), - store = require(path.join(__dirname, '..', 'store.js'))({ - config: 'user-preferences', - defaults: { - openhidden: false, - maximized: false, - tray: false, - theme: false, - emoji: false, - }, - }), - isMac = process.platform === 'darwin'; - - const intervalID = setInterval(injection, 100); - function injection() { - if (document.querySelector('div.notion-topbar > div') == undefined) return; - clearInterval(intervalID); - - /* style injection */ - const head = document.getElementsByTagName('head')[0], - css = ['user']; - if (store.theme) css.push('theme'); - css.forEach((file) => { - file = fs.readFileSync(`☃☃☃resources☃☃☃/${file}.css`); // will be set by python script - let style = document.createElement('style'); - style.type = 'text/css'; - style.innerHTML = file; - head.appendChild(style); - }); - document.body.classList.add('enhanced'); - - const appwindow = require('electron').remote.getCurrentWindow(); - - /* titlebar */ - const buttons = document.createElement('span'), - dragarea = document.createElement('div'); - dragarea.className = 'window-dragarea'; - document.querySelector('.notion-topbar').prepend(dragarea); - buttons.className = 'window-buttons-area'; - buttons.innerHTML = ` - - `; - if (!isMac) - buttons.innerHTML += ` - - - - `; - document - .querySelector('.notion-topbar > div[style*="display: flex"]') - .appendChild(buttons); - document - .querySelector('.notion-history-back-button') - .parentElement.nextElementSibling.classList.add( - 'notion-topbar-breadcrumb' - ); - document - .querySelector('.notion-topbar-share-menu') - .parentElement.classList.add('notion-topbar-actions'); - - const button_icons_raw = { - alwaysontop_on: fs.readFileSync( - '☃☃☃resources☃☃☃/icons/alwaysontop_on.svg' - ), - alwaysontop_off: fs.readFileSync( - '☃☃☃resources☃☃☃/icons/alwaysontop_off.svg' - ), - minimize: fs.readFileSync('☃☃☃resources☃☃☃/icons/minimise.svg'), - maximize_on: fs.readFileSync('☃☃☃resources☃☃☃/icons/maximise_on.svg'), - maximize_off: fs.readFileSync('☃☃☃resources☃☃☃/icons/maximise_off.svg'), - close: fs.readFileSync('☃☃☃resources☃☃☃/icons/close.svg'), - }, - button_icons = { - alwaysontop() { - return appwindow.isAlwaysOnTop() - ? button_icons_raw.alwaysontop_on - : button_icons_raw.alwaysontop_off; // '🠙' : '🠛' - }, - minimize() { - return button_icons_raw.minimize; // '⚊' - }, - maximize() { - return appwindow.isMaximized() - ? button_icons_raw.maximize_on - : button_icons_raw.maximize_off; // '🗗' : '🗖' - }, - close() { - return button_icons_raw.close; // '⨉' - }, - }, - button_actions = { - alwaysontop() { - appwindow.setAlwaysOnTop(!appwindow.isAlwaysOnTop()); - this.innerHTML = button_icons.alwaysontop(); - }, - minimize() { - appwindow.minimize(); - }, - maximize() { - appwindow.isMaximized() - ? appwindow.unmaximize() - : appwindow.maximize(); - this.innerHTML = button_icons.maximize(); - }, - close(event = null) { - if ( - store.tray && - require('electron').remote.BrowserWindow.getAllWindows().length === - 1 - ) { - if (event) event.preventDefault(); - appwindow.hide(); - } else appwindow.close(); - }, - }, - button_elements = { - alwaysontop: document.querySelector('.window-button.btn-alwaysontop'), - minimize: document.querySelector('.window-button.btn-minimize'), - maximize: document.querySelector('.window-button.btn-maximize'), - close: document.querySelector('.window-button.btn-close'), - }; - - button_elements.alwaysontop.innerHTML = button_icons.alwaysontop(); - button_elements.alwaysontop.onclick = button_actions.alwaysontop; - - if (!isMac) { - button_elements.minimize.innerHTML = button_icons.minimize(); - button_elements.minimize.onclick = button_actions.minimize; - - button_elements.maximize.innerHTML = button_icons.maximize(); - button_elements.maximize.onclick = button_actions.maximize; - setInterval(() => { - if (button_elements.maximize.innerHTML != button_icons.maximize()) - button_elements.maximize.innerHTML = button_icons.maximize(); - }, 1000); - - button_elements.close.innerHTML = button_icons.close(); - button_elements.close.onclick = button_actions.close; - } - - /* emoji */ - if (store.emoji) { - const observer = new MutationObserver((list, observer) => { - document - .querySelectorAll('.notion-record-icon .notion-emoji') - .forEach((el) => { - el.outerHTML = ` - ${el.getAttribute('alt')} - `; - }); - document.querySelectorAll('.notion-emoji').forEach((el) => { - el.outerHTML = `${el.getAttribute('alt')}`; - }); - }); - observer.observe(document, { - childList: true, - subtree: true, - }); - } - - /* update checker */ - fetch( - `https://api.github.com/repos/dragonwocky/notion-enhancer/releases/latest` - ) - .then((res) => res.json()) - .then((res) => { - const local_version = '☃☃☃version☃☃☃'.split('~')[0], - repo_version = res.tag_name.slice(1); - // compare func from https://github.com/substack/semver-compare - if ( - local_version != repo_version && - [local_version, repo_version].sort((a, b) => { - var pa = a.split('.'); - var pb = b.split('.'); - for (var i = 0; i < 3; i++) { - var na = Number(pa[i]); - var nb = Number(pb[i]); - if (na > nb) return 1; - if (nb > na) return -1; - if (!isNaN(na) && isNaN(nb)) return 1; - if (isNaN(na) && !isNaN(nb)) return -1; - } - return 0; - })[0] == local_version - ) - alert('notion-enhancer update available!'); - }); - - /* hotkey: reload window */ - document.defaultView.addEventListener( - 'keyup', - (ev) => void (ev.code === 'F5' ? appwindow.reload() : 0), - true - ); - } -}, 100); diff --git a/resources/store.js b/resources/store.js deleted file mode 100644 index 3b94a0a..0000000 --- a/resources/store.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (https://dragonwocky.me/) under the MIT license - */ - -// a wrapper for accessing data stored in a JSON file. -// editing this WILL break things if you don't know what you're doing. - -const path = require('path'), - fs = require('fs'); - -function getJSON(from) { - try { - return JSON.parse(fs.readFileSync(from)); - } catch { - return {}; - } -} - -module.exports = (opts) => { - opts = { - config: 'user-preferences', - defaults: {}, - ...opts, - }; - const config = path.join(__dirname, opts.config + '.json'); - return new Proxy( - {}, - { - get(obj, prop) { - obj = { ...opts.defaults, ...getJSON(config) }; - return obj[prop]; - }, - set(obj, prop, val) { - obj = { ...opts.defaults, ...getJSON(config) }; - obj[prop] = val; - fs.writeFileSync(config, JSON.stringify(obj)); - return true; - }, - } - ); -}; diff --git a/resources/theme.css b/resources/theme.css deleted file mode 100644 index e0fa1f6..0000000 --- a/resources/theme.css +++ /dev/null @@ -1,245 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (https://dragonwocky.me/) under the MIT license - */ - -:root { - /** backgrounds **/ - --theme-main: rgb(5, 5, 5); - --theme-sidebar: rgb(1, 1, 1); - --theme-drag: #030303; - --theme-primary: rgb(177, 24, 24); - --theme-primary_hover: rgb(202, 26, 26); - --theme-primary_click: rgb(219, 41, 41); - --theme-primary_indicator: rgb(202, 26, 26); - - /** databases **/ - --theme-card: rgb(4, 4, 4); - --theme-card_border: rgba(10, 10, 10, 0.7); - --theme-button: rgb(15, 15, 15); - --theme-button_border: rgba(78, 78, 78, 0.7); - --theme-table_border: rgba(255, 255, 255, 0.1); - - /** scrollbars **/ - --theme-scrollbar: #232425; - --theme-scrollbar_hover: #373838; - - /** colours **/ - --theme-text_gray: rgba(151, 154, 155, 0.95); - --theme-text_brown: rgb(147, 114, 100); - --theme-text_orange: rgb(255, 163, 68); - --theme-text_yellow: rgb(255, 220, 73); - --theme-text_green: rgb(50, 169, 104); - --theme-text_blue: rgb(82, 156, 202); - --theme-text_purple: rgb(154, 109, 215); - --theme-text_pink: rgb(226, 85, 161); - --theme-text_red: rgb(218, 47, 35); - --theme-bg_gray: rgba(126, 128, 129, 0.5); - --theme-bg_brown: #50331f; - --theme-bg_orange: rgba(255, 155, 0, 0.58); - --theme-bg_yellow: rgba(183, 155, 0, 1); - --theme-bg_green: rgb(50, 129, 47); - --theme-bg_blue: rgba(0, 90, 146, 0.71); - --theme-bg_purple: rgba(91, 49, 148, 0.74); - --theme-bg_pink: rgba(243, 61, 159, 0.5); - --theme-bg_red: rgb(122, 20, 20); - --theme-line_gray: rgba(126, 128, 129, 0.301); - --theme-line_brown: #50331fad; - --theme-line_orange: rgba(255, 153, 0, 0.315); - --theme-line_yellow: rgba(183, 156, 0, 0.445); - --theme-line_green: rgba(50, 129, 47, 0.39); - --theme-line_blue: rgba(0, 90, 146, 0.521); - --theme-line_purple: rgba(90, 49, 148, 0.349); - --theme-line_pink: rgba(243, 61, 158, 0.301); - --theme-line_red: rgba(122, 20, 20, 0.623); -} - -/** backgrounds **/ - -.notion-dark-theme .window-dragarea { - background: var(--theme-drag); -} - -[style*='background: rgb(55, 60, 63)'], -[style*='background: rgba(69, 75, 78, 0.3)'] { - background: var(--theme-sidebar) !important; -} -.notion-dark-theme .window-button, -.notion-body.dark, -[style*='background: rgb(47, 52, 55)'] { - background: var(--theme-main) !important; -} - -/** databases **/ - -[style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { - box-shadow: none !important; -} -.notion-table-view > :first-child > :first-child, -.notion-dark-theme .window-button:hover, -[style*='background: rgb(71, 76, 80)'], -[style*='background: rgb(80, 85, 88)'], -[style*='background: rgb(98, 102, 104)'] { - background: var(--theme-button) !important; - box-shadow: 0 0 0 0.5px var(--theme-button_border); -} -.window-button.btn-close:hover { - background: #e81123 !important; -} - -[style*='background: rgb(63, 68, 71)'] { - background: var(--theme-card) !important; -} -.notion-frame [style*='background: rgb(63, 68, 71)'] { - border: 0.5px solid var(--theme-card_border); -} - -[style*='border-top: 1px solid rgba(255, 255, 255, 0.14)'], -[style*='border-top: 1px solid rgba(255, 255, 255, 0.07)'] { - border-top: 1px solid var(--theme-table_border) !important; -} -[style*='box-shadow: rgba(255, 255, 255, 0.14) -1px 0px 0px'] { - box-shadow: var(--theme-table_border) -1px 0px 0px !important; -} -[style*='border-bottom: 1px solid rgba(255, 255, 255, 0.14)'], -[style*='border-bottom: 1px solid rgba(255, 255, 255, 0.07)'] { - border-bottom: 1px solid var(--theme-table_border) !important; -} -[style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px'] { - box-shadow: var(--theme-table_border) 0px 1px 0px !important; -} -[style*='border-right: 1px solid rgba(255, 255, 255, 0.14)'], -[style*='border-right: 1px solid rgba(255, 255, 255, 0.07)'] { - border-right: 1px solid var(--theme-table_border) !important; -} -[style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { - box-shadow: var(--theme-table_border) 0px -1px 0px !important; -} -[style*='border-left: 1px solid rgba(255, 255, 255, 0.14)'], -[style*='border-left: 1px solid rgba(255, 255, 255, 0.07)'] { - border-left: 1px solid var(--theme-table_border) !important; -} -[style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'] { - box-shadow: var(--theme-table_border) 0px 1px 0px inset !important; -} - -/* scrollbars */ - -.notion-dark-theme ::-webkit-scrollbar-corner { - background-color: transparent; /* for overlap */ -} -.notion-dark-theme ::-webkit-scrollbar-thumb { - border-radius: 5px; - background-color: var(--theme-scrollbar); -} -.notion-dark-theme ::-webkit-scrollbar-thumb:hover { - background: var(--theme-scrollbar_hover); -} - -/** colours **/ - -[style*='background: rgb(46, 170, 220)'] { - background: var(--theme-primary) !important; -} -[style*='background: rgb(6, 156, 205)'] { - background: var(--theme-primary_hover) !important; -} -[style*='background: rgb(0, 141, 190)'] { - background: var(--theme-primary_click) !important; -} -[style*='background: rgb(235, 87, 87)'] { - background: var(--theme-primary_indicator) !important; -} - -[style*='color:rgba(151,154,155,0.95)'] { - color: var(--theme-text_gray) !important; -} -[style*='background: rgba(151, 154, 155, 0.5)'], -[style*='background:rgb(69,75,78)'] { - background: var(--theme-bg_gray) !important; -} -[style*='background: rgb(69, 75, 78)'] { - background: var(--theme-line_gray) !important; -} -[style*='color:rgb(147,114,100)'] { - color: var(--theme-text_brown) !important; -} -[style*='background: rgba(147, 114, 100, 0.5)'], -[style*='background:rgb(67,64,64)'] { - background: var(--theme-bg_brown) !important; -} -[style*='background: rgb(67, 64, 64)'] { - background: var(--theme-line_brown) !important; -} -[style*='color:rgb(255,163,68)'] { - color: var(--theme-text_orange) !important; -} -[style*='background: rgba(255, 163, 68, 0.5)'], -[style*='background:rgb(89,74,58)'] { - background: var(--theme-bg_orange) !important; -} -[style*='background: rgb(89, 74, 58)'] { - background: var(--theme-line_orange) !important; -} -[style*='color:rgb(255,220,73)'] { - color: var(--theme-text_yellow) !important; -} -[style*='background: rgba(255, 220, 73, 0.5)'], -[style*='background:rgb(89,86,59)'] { - background: var(--theme-bg_yellow) !important; -} -[style*='background: rgb(89, 86, 59)'] { - background: var(--theme-line_yellow) !important; -} -[style*='color:rgb(77,171,154)'] { - color: var(--theme-text_green) !important; -} -[style*='background: rgba(77, 171, 154, 0.5)'], -[style*='background:rgb(53,76,75)'] { - background: var(--theme-bg_green) !important; -} -[style*='background: rgb(53, 76, 75)'] { - background: var(--theme-line_green) !important; -} -[style*='color:rgb(82,156,202)'] { - color: var(--theme-text_blue) !important; -} -[style*='background: rgba(82, 156, 202, 0.5)'], -[style*='background:rgb(54,73,84)'] { - background: var(--theme-bg_blue) !important; -} -[style*='background: rgb(54, 73, 84)'] { - background: var(--theme-line_blue) !important; -} -[style*='color:rgb(154,109,215)'] { - color: var(--theme-text_purple) !important; -} -[style*='background: rgba(154, 109, 215, 0.5)'], -[style*='background:rgb(68,63,87)'] { - background: var(--theme-bg_purple) !important; -} -[style*='background: rgb(68, 63, 87)'] { - background: var(--theme-line_purple) !important; -} -[style*='color:rgb(226,85,161)'] { - color: var(--theme-text_pink) !important; -} -[style*='background: rgba(226, 85, 161, 0.5)'], -[style*='background:rgb(83,59,76)'] { - background: var(--theme-bg_pink) !important; -} -[style*='background: rgb(83, 59, 76)'] { - background: var(--theme-line_pink) !important; -} -[style*='color:rgb(255,115,105)'] { - color: var(--theme-text_red) !important; -} -[style*='background: rgba(255, 115, 105, 0.5);'], -[style*='background:rgb(89,65,65)'] { - background: var(--theme-bg_red) !important; -} -[style*='background: rgb(89, 65, 65)'] { - background: var(--theme-line_red) !important; -} diff --git a/resources/tray.js b/resources/tray.js deleted file mode 100644 index 5708313..0000000 --- a/resources/tray.js +++ /dev/null @@ -1,136 +0,0 @@ -/* === INJECTION MARKER === */ - -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (https://dragonwocky.me/) under the MIT license - */ - -// adds: tray support (inc. context menu with settings), window toggle hotkey - -// DO NOT REMOVE THE MARKERS ABOVE. -// DO NOT CHANGE THE NAME OF THE 'enhancements()' FUNCTION. - -let tray; - -function enhancements() { - const { Tray, Menu, nativeImage, app } = require('electron'), - isMac = process.platform === 'darwin', - isWin = process.platform === 'win32', - path = require('path'), - store = require(path.join(__dirname, '..', 'store.js'))({ - config: 'user-preferences', - defaults: { - openhidden: false, - maximized: false, - tray: false, - theme: false, - emoji: false, - }, - }); - tray = new Tray( - isWin - ? '☃☃☃resources☃☃☃/icons/windows.ico' - : new nativeImage.createFromPath('☃☃☃resources☃☃☃/icons/tray.png').resize( - { - width: 16, - height: 16, - } - ) - ); - const contextMenu = Menu.buildFromTemplate([ - { - id: 'startup', - label: 'Run on startup', - type: 'checkbox', - checked: electron_1.app.getLoginItemSettings().openAtLogin, - click: () => { - contextMenu.getMenuItemById('startup').checked - ? electron_1.app.setLoginItemSettings({ openAtLogin: true }) - : electron_1.app.setLoginItemSettings({ openAtLogin: false }); - }, - }, - { - id: 'openhidden', - label: 'Hide on open', - type: 'checkbox', - checked: store.openhidden, - click: () => { - store.openhidden = contextMenu.getMenuItemById('openhidden').checked; - }, - }, - { - id: 'maximized', - label: 'Open maximised', - type: 'checkbox', - checked: store.maximized, - click: () => { - store.maximized = contextMenu.getMenuItemById('maximized').checked; - }, - }, - { - id: 'tray', - label: 'Close to tray', - type: 'checkbox', - checked: store.tray, - click: () => { - store.tray = contextMenu.getMenuItemById('tray').checked; - }, - }, - { - id: 'theme', - label: 'Load theme.css', - type: 'checkbox', - checked: store.theme, - click: () => { - store.theme = contextMenu.getMenuItemById('theme').checked; - electron_1.BrowserWindow.getAllWindows().forEach((win) => win.reload()); - }, - }, - { - id: 'emoji', - label: 'Use system emoji', - type: 'checkbox', - checked: store.emoji, - click: () => { - store.emoji = contextMenu.getMenuItemById('emoji').checked; - electron_1.BrowserWindow.getAllWindows().forEach((win) => win.reload()); - }, - }, - { - type: 'separator', - }, - { - label: 'Quit', - role: 'quit', - }, - ]); - tray.setContextMenu(contextMenu); - tray.setToolTip('Notion Enhancements'); - - function showWindows() { - const windows = electron_1.BrowserWindow.getAllWindows(); - if (isMac) app.show(); - if (store.maximized) windows.forEach((win) => [win.maximize()]); - else windows.forEach((win) => win.show()); - app.focus({ steal: true }); - } - function hideWindows() { - const windows = electron_1.BrowserWindow.getAllWindows(); - windows.forEach((win) => [win.isFocused() && win.blur(), win.hide()]); - if (isMac) app.hide(); - } - tray.on('click', () => { - const windows = electron_1.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isVisible())) hideWindows(); - else showWindows(); - }); - // hotkey will be set by python script - electron_1.globalShortcut.register('CmdOrCtrl+Shift+A', () => { - const windows = electron_1.BrowserWindow.getAllWindows(); - if (windows.some((win) => win.isFocused() && win.isVisible())) - hideWindows(); - else showWindows(); - }); -} diff --git a/resources/user.css b/resources/user.css deleted file mode 100644 index fa98c88..0000000 --- a/resources/user.css +++ /dev/null @@ -1,126 +0,0 @@ -/* - * notion-enhancer - * (c) 2020 dragonwocky - * (c) 2020 TarasokUA - * (https://dragonwocky.me/) under the MIT license - */ - -/* titlebar */ -.notion-topbar { - height: 55px !important; -} -.window-dragarea { - height: 10px; - width: 100%; -} -.notion-light-theme .window-dragarea { - background: #e6e6e6; -} -.notion-dark-theme .window-dragarea { - background: #272d2f; -} -.window-buttons-area { - display: flex; - align-items: center; - font-size: 14px; -} -@media (max-width: 760px) { - .notion-topbar { - height: 95px !important; - } - .notion-topbar > :nth-child(2) { - display: grid !important; - height: 85px !important; - grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr; - } - .window-buttons-area { - grid-row: 1; - grid-column: 9 / span end; - justify-content: flex-end; - } - .notion-topbar-breadcrumb { - grid-row: 2; - grid-column: 1 / span 8; - } - .notion-topbar-actions { - grid-row: 2; - grid-column: 9 / span end; - justify-content: flex-end; - } -} -/* window control buttons */ -.window-button { - background: transparent; - border: 0; - margin: 0px 0px 0px 9px; - width: 32px; - line-height: 26px; - border-radius: 4px; - font-size: 16px; - transition-duration: 0.2s; - cursor: default; /* -- not sure? on windows native window buttons have the default cursor, - but other buttons in the titlebar have cursor: pointer */ -} -.window-button svg { - margin-top: 8px; - width: 14px; - height: 14px; -} -.window-button svg path { - fill: currentColor; -} -.window-button svg line { - stroke: currentColor; -} -.window-button.btn-close:hover { - background: #e81123 !important; -} -.window-button.btn-close:hover svg line { - stroke: white; -} - -/* window control buttons: light theme */ -.notion-light-theme .window-button { - font-weight: bold; -} -.notion-light-theme .window-button:hover { - background: rgb(239, 239, 239); -} - -/* window control buttons: dark theme */ -.notion-dark-theme .window-button:hover { - background: rgb(71, 76, 80); -} - -/* scrollbar: pointer */ -.notion-scroller { - cursor: auto; -} -/* scrollbar: size */ -::-webkit-scrollbar { - width: 8px; /* for vertical */ - height: 8px; /* for horizontal */ -} -/* scrollbar: light theme */ -.notion-light-theme ::-webkit-scrollbar-corner { - background-color: transparent; /* for overlap */ -} -.notion-light-theme ::-webkit-scrollbar-thumb { - border-radius: 5px; - background-color: #d9d8d6; - border: 1px solid #cacac8; -} -.notion-light-theme ::-webkit-scrollbar-thumb:hover { - background: #cacac8; -} -/* scrollbar: dark theme */ -.notion-dark-theme ::-webkit-scrollbar-corner { - background-color: transparent; /* for overlap */ -} -.notion-dark-theme ::-webkit-scrollbar-thumb { - border-radius: 5px; - background-color: #505457; -} -.notion-dark-theme ::-webkit-scrollbar-thumb:hover { - background: #696d6f; -} diff --git a/screenshots/app-enhanced.jpg b/screenshots/app-enhanced.jpg deleted file mode 100644 index b127943..0000000 Binary files a/screenshots/app-enhanced.jpg and /dev/null differ diff --git a/screenshots/app-tray.jpg b/screenshots/app-tray.jpg deleted file mode 100644 index bcfd5a3..0000000 Binary files a/screenshots/app-tray.jpg and /dev/null differ diff --git a/screenshots/app-unenhanced.jpg b/screenshots/app-unenhanced.jpg deleted file mode 100644 index ead86d0..0000000 Binary files a/screenshots/app-unenhanced.jpg and /dev/null differ diff --git a/screenshots/board-default.jpg b/screenshots/board-default.jpg deleted file mode 100644 index 46dfe51..0000000 Binary files a/screenshots/board-default.jpg and /dev/null differ diff --git a/screenshots/board-hideaddgroup.jpg b/screenshots/board-hideaddgroup.jpg deleted file mode 100644 index 690162a..0000000 Binary files a/screenshots/board-hideaddgroup.jpg and /dev/null differ diff --git a/screenshots/board-hideaddnew.jpg b/screenshots/board-hideaddnew.jpg deleted file mode 100644 index aa209a8..0000000 Binary files a/screenshots/board-hideaddnew.jpg and /dev/null differ diff --git a/screenshots/board-hidehidden.jpg b/screenshots/board-hidehidden.jpg deleted file mode 100644 index 83700d6..0000000 Binary files a/screenshots/board-hidehidden.jpg and /dev/null differ diff --git a/screenshots/board-shrinkpadding.jpg b/screenshots/board-shrinkpadding.jpg deleted file mode 100644 index e2ef451..0000000 Binary files a/screenshots/board-shrinkpadding.jpg and /dev/null differ diff --git a/screenshots/cover-default.jpg b/screenshots/cover-default.jpg deleted file mode 100644 index 078dc42..0000000 Binary files a/screenshots/cover-default.jpg and /dev/null differ diff --git a/screenshots/cover-thinner.jpg b/screenshots/cover-thinner.jpg deleted file mode 100644 index cf6f8b3..0000000 Binary files a/screenshots/cover-thinner.jpg and /dev/null differ diff --git a/screenshots/discussion-default.jpg b/screenshots/discussion-default.jpg deleted file mode 100644 index fb85493..0000000 Binary files a/screenshots/discussion-default.jpg and /dev/null differ diff --git a/screenshots/discussion-hidden.jpg b/screenshots/discussion-hidden.jpg deleted file mode 100644 index bd97363..0000000 Binary files a/screenshots/discussion-hidden.jpg and /dev/null differ diff --git a/screenshots/fonts-custom.jpg b/screenshots/fonts-custom.jpg deleted file mode 100644 index 79370b5..0000000 Binary files a/screenshots/fonts-custom.jpg and /dev/null differ diff --git a/screenshots/fonts-resized.jpg b/screenshots/fonts-resized.jpg deleted file mode 100644 index 6cac6bf..0000000 Binary files a/screenshots/fonts-resized.jpg and /dev/null differ diff --git a/screenshots/preview-default.jpg b/screenshots/preview-default.jpg deleted file mode 100644 index 8298b6a..0000000 Binary files a/screenshots/preview-default.jpg and /dev/null differ diff --git a/screenshots/preview-wider.jpg b/screenshots/preview-wider.jpg deleted file mode 100644 index 535a337..0000000 Binary files a/screenshots/preview-wider.jpg and /dev/null differ diff --git a/screenshots/table-before.jpg b/screenshots/table-before.jpg deleted file mode 100644 index 471d516..0000000 Binary files a/screenshots/table-before.jpg and /dev/null differ diff --git a/screenshots/table-centredheaders.jpg b/screenshots/table-centredheaders.jpg deleted file mode 100644 index 97a462b..0000000 Binary files a/screenshots/table-centredheaders.jpg and /dev/null differ diff --git a/screenshots/table-columnunder100px.jpg b/screenshots/table-columnunder100px.jpg deleted file mode 100644 index 5fea0ba..0000000 Binary files a/screenshots/table-columnunder100px.jpg and /dev/null differ diff --git a/screenshots/table-hideaddrow.jpg b/screenshots/table-hideaddrow.jpg deleted file mode 100644 index 2786009..0000000 Binary files a/screenshots/table-hideaddrow.jpg and /dev/null differ diff --git a/screenshots/table-hidecalculationsrow.jpg b/screenshots/table-hidecalculationsrow.jpg deleted file mode 100644 index 84d5a43..0000000 Binary files a/screenshots/table-hidecalculationsrow.jpg and /dev/null differ diff --git a/screenshots/table-hidecolumnicons.jpg b/screenshots/table-hidecolumnicons.jpg deleted file mode 100644 index 1b07b1b..0000000 Binary files a/screenshots/table-hidecolumnicons.jpg and /dev/null differ diff --git a/screenshots/table-shrinkpadding.jpg b/screenshots/table-shrinkpadding.jpg deleted file mode 100644 index 880d11a..0000000 Binary files a/screenshots/table-shrinkpadding.jpg and /dev/null differ diff --git a/screenshots/table-smallercolumnicons.jpg b/screenshots/table-smallercolumnicons.jpg deleted file mode 100644 index 418a843..0000000 Binary files a/screenshots/table-smallercolumnicons.jpg and /dev/null differ diff --git a/screenshots/theme-dark+.jpg b/screenshots/theme-dark+.jpg deleted file mode 100644 index 04f279a..0000000 Binary files a/screenshots/theme-dark+.jpg and /dev/null differ diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..c276d14 --- /dev/null +++ b/utils.js @@ -0,0 +1,71 @@ +/* + * notion-enhancer + * (c) 2020 dragonwocky + * (c) 2020 TarasokUA + * (https://dragonwocky.me/notion-enhancer) under the MIT license + */ + +'use strict'; +const os = require('os'), + fs = require('fs-extra'), + exec = require('util').promisify(require('child_process').exec); + +function is_wsl() { + return ( + process.platform == 'linux' && + os.release().toLowerCase().includes('microsoft') + ); +} + +async function get_notion() { + let folder = ''; + switch (process.platform) { + case 'darwin': + folder = '/Applications/Notion.app/Contents/Resources'; + break; + case 'win32': + folder = process.env.LOCALAPPDATA + '\\Programs\\Notion\\resources'; + break; + case 'linux': + if (is_wsl()) { + const { stdout } = await exec('cmd.exe /c echo %localappdata%'), + drive = stdout[0]; + folder = `/mnt/${drive.toLowerCase()}${stdout + .replace(/\\/g, '/') + .slice(2) + .trim()}/Programs/Notion/resources`; + } else { + for (let loc of [ + '/usr/lib/notion-desktop/resources', // https://github.com/davidbailey00/notion-deb-builder/ + '/opt/notion-app', // https://aur.archlinux.org/packages/notion-app/ + '/opt/notion', // https://github.com/jaredallard/notion-app + ]) { + if (await fs.pathExists(loc)) folder = loc; + } + } + } + if (!folder) + throw new Error( + ' ~~ platform not supported: exiting. open a request in the github repo:\n' + + 'https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=enhancement&template=platform-support.md' + ); + if (!(await fs.pathExists(folder))) + throw new Error( + ' ~~ nothing found: exiting. notion install is either corrupted or non-existent.' + ); + return folder; +} + +function readline() { + return new Promise((res, rej) => { + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + process.stdin.on('data', (key) => { + if (key === '\u0003') process.exit(); // CTRL+C + process.stdin.pause(); + res(key.trim()); + }); + }); +} + +module.exports = { get_notion, is_wsl, readline };