From c3436d372abd90617668803aeb4a3e36f79446a0 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Mon, 1 Jun 2020 20:08:01 +1000 Subject: [PATCH] theme support + hotkey focusing improvement --- resources/theme.css | 37 +++++++++++++++++++++++++------------ resources/tray.js | 30 ++++++++++++++---------------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/resources/theme.css b/resources/theme.css index b1ca2d5..83f4fa9 100644 --- a/resources/theme.css +++ b/resources/theme.css @@ -7,8 +7,8 @@ :root { /** backgrounds **/ - --theme-main: rgb(10, 10, 10); - --theme-sidebar: rgb(0, 0, 0); + --theme-main: rgb(5, 5, 5); + --theme-sidebar: rgb(1, 1, 1); --theme-primary: rgb(177, 24, 24); --theme-primary_hover: rgb(202, 26, 26); --theme-primary_click: rgb(219, 41, 41); @@ -17,6 +17,12 @@ /** databases **/ --theme-card: rgb(4, 4, 4); --theme-card_border: rgba(59, 59, 59, 0.7); + --theme-button: rgb(15, 15, 15); + --theme-button_border: rgba(78, 78, 78, 0.7); + + /** scrollbars **/ + --theme-scrollbar: #232425; + --theme-scrollbar_hover: #373838; /** colours **/ --theme-text_gray: rgba(151, 154, 155, 0.95); @@ -33,17 +39,13 @@ --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(77, 171, 154); + --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); } -.notion-dark-theme .window-buttons:hover { - background: rgb(23, 23, 23); -} - /** backgrounds **/ [style*='background: rgb(55, 60, 63)'] { @@ -56,17 +58,16 @@ } /** databases **/ + [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { box-shadow: none !important; } -[style*='background: rgba(202, 204, 206, 0.3)'] { - background: rgba(119, 119, 119, 0.3) !important; -} .notion-table-view > :first-child > :first-child, +.notion-dark-theme .window-buttons:hover, [style*='background: rgb(71, 76, 80)'], [style*='background: rgb(98, 102, 104)'] { - background: rgb(15, 15, 15) !important; - box-shadow: 0 0 0 0.5px rgba(78, 78, 78, 0.7); + background: var(--theme-button) !important; + box-shadow: 0 0 0 0.5px var(--theme-button_border); } [style*='background: rgb(63, 68, 71)'] { background: var(--theme-card) !important; @@ -75,6 +76,18 @@ border: 0.5px solid var(--theme-card_border); } +/* 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)'] { diff --git a/resources/tray.js b/resources/tray.js index 3dd046e..d7afd91 100644 --- a/resources/tray.js +++ b/resources/tray.js @@ -90,22 +90,20 @@ function enhancements() { ]); tray.setContextMenu(contextMenu); - tray.on('click', function () { - const win = electron_1.BrowserWindow.getAllWindows()[0]; - if ((win.isVisible() && win.isMinimized()) || !store.maximised) { - win.show(); - } else if (win.isVisible()) { - win.hide(); - } else win.maximize(); - }); - - const hotkey = '☃☃☃hotkey☃☃☃'; // will be set by python script - electron_1.globalShortcut.register(hotkey, () => { + tray.on('click', () => { const windows = electron_1.BrowserWindow.getAllWindows(); - if (windows.some((win) => !win.isVisible())) { - if (store.maximised) { - windows.forEach((win) => win.maximize()); - } else windows.forEach((win) => win.show()); - } else windows.forEach((win) => win.hide()); + if (windows.some((win) => win.isVisible())) + windows.forEach((win) => win.hide()); + else if (store.maximised) windows.forEach((win) => win.maximize()); + else windows.forEach((win) => win.show()); + }); + const hotkey = '☃☃☃hotkey☃☃☃'; // will be set by python script; + electron_1.globalShortcut.register(hotkey, () => { + const windows = electron_1.BrowserWindow.getAllWindows(), + focused = electron_1.BrowserWindow.getFocusedWindow(); + if (windows.some((win) => win.isVisible() && focused)) + windows.forEach((win) => win.hide()); + else if (store.maximised) windows.forEach((win) => win.maximize()); + else windows.forEach((win) => win.show()); }); }