-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
5,800 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
os: osx | ||
osx_image: xcode9.1 | ||
language: node_js | ||
node_js: | ||
- 8 | ||
script: | ||
- npm run lint | ||
- npm run dist | ||
branches: | ||
except: | ||
- "/^v\\d+\\.\\d+\\.\\d+$/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# keep-desktop-dark | ||
# Keep Dark: Destkop App with Dark Mode | ||
Google Keep Desktop application for Windows, Mac and Linux with Dark Theme. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict' | ||
const ipc = require('electron').ipcRenderer | ||
|
||
function isKeep () { | ||
return window.location.hostname === 'keep.google.com' | ||
} | ||
|
||
function injectCss (rule) { | ||
document.styleSheets[0].insertRule(rule, 0) | ||
} | ||
|
||
function handleDOMLoaded () { | ||
if (!isKeep()) return | ||
|
||
if (process.platform === 'darwin') { | ||
injectCss(` | ||
#ognwrapper { | ||
-webkit-app-region: drag; | ||
} | ||
`) | ||
|
||
injectCss(` | ||
#ognwrapper form, | ||
#ognwrapper [role="menu"], | ||
#ognwrapper [role="button"] { | ||
-webkit-app-region: no-drag; | ||
} | ||
`) | ||
|
||
injectCss(` | ||
#ognwrapper > :first-child > :nth-child(2) { | ||
padding-left: 75px; | ||
} | ||
`) | ||
} | ||
|
||
injectCss(` | ||
::-webkit-scrollbar { | ||
display: none !important; | ||
} | ||
`) | ||
} | ||
|
||
function handleClick (event) { | ||
const node = event.target | ||
|
||
if (node.nodeName === 'A' && node.target === '_blank') { | ||
event.preventDefault() | ||
ipc.send('clicklink', node.href) | ||
} | ||
} | ||
|
||
function handleNavigate (event, hash) { | ||
window.location.hash = hash | ||
} | ||
|
||
window.addEventListener('DOMContentLoaded', handleDOMLoaded, false) | ||
window.addEventListener('click', handleClick, false) | ||
ipc.on('navigate', handleNavigate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict' | ||
const Config = require('electron-config') | ||
|
||
module.exports = new Config({ | ||
defaults: { | ||
lastWindowState: { | ||
height: 768, | ||
width: 1024 | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict' | ||
const app = require('electron').app | ||
const ipc = require('electron').ipcMain | ||
const shell = require('electron').shell | ||
const config = require('./config') | ||
const createMainMenu = require('./menu') | ||
const createMainWindow = require('./window') | ||
|
||
require('electron-debug')() | ||
|
||
let mainWindow | ||
|
||
function handleResize () { | ||
if (!mainWindow.isFullScreen()) { | ||
config.set('lastWindowState', mainWindow.getBounds()) | ||
} | ||
} | ||
|
||
function handleClosed () { | ||
mainWindow = null | ||
} | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform === 'darwin') { | ||
app.hide() | ||
} else { | ||
app.quit() | ||
} | ||
}) | ||
|
||
app.on('activate', () => { | ||
if (!mainWindow) { | ||
mainWindow = createMainWindow(handleResize, handleClosed) | ||
} | ||
}) | ||
|
||
app.on('ready', () => { | ||
mainWindow = createMainWindow(handleResize, handleClosed) | ||
createMainMenu() | ||
}) | ||
|
||
ipc.on('clicklink', (event, url) => { | ||
event.preventDefault() | ||
shell.openExternal(url) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
'use strict' | ||
const app = require('electron').app | ||
const Menu = require('electron').Menu | ||
const shell = require('electron').shell | ||
|
||
module.exports = function createMainMenu () { | ||
const template = [ | ||
{ | ||
label: 'Keep Dark', | ||
submenu: [ | ||
{ | ||
label: 'Services', | ||
role: 'services', | ||
submenu: [] | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Hide Keep Dark', | ||
accelerator: 'Cmd+H', | ||
role: 'hide' | ||
}, | ||
{ | ||
label: 'Hide Others', | ||
accelerator: 'Alt+Cmd+H', | ||
role: 'hideothers' | ||
}, | ||
{ | ||
label: 'Show All', | ||
role: 'unhide' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Quit', | ||
accelerator: 'Cmd+Q', | ||
click: () => { | ||
app.quit() | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Edit', | ||
submenu: [ | ||
{ | ||
label: 'Undo', | ||
accelerator: 'CmdOrCtrl+Z', | ||
role: 'undo' | ||
}, | ||
{ | ||
label: 'Redo', | ||
accelerator: 'Shift+CmdOrCtrl+Z', | ||
role: 'redo' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Cut', | ||
accelerator: 'CmdOrCtrl+X', | ||
role: 'cut' | ||
}, | ||
{ | ||
label: 'Copy', | ||
accelerator: 'CmdOrCtrl+C', | ||
role: 'copy' | ||
}, | ||
{ | ||
label: 'Paste', | ||
accelerator: 'CmdOrCtrl+V', | ||
role: 'paste' | ||
}, | ||
{ | ||
label: 'Select All', | ||
accelerator: 'CmdOrCtrl+A', | ||
role: 'selectall' | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'View', | ||
submenu: [ | ||
{ | ||
label: 'Reload', | ||
accelerator: 'CmdOrCtrl+R', | ||
click: (item, win) => { | ||
if (win) win.reload() | ||
} | ||
}, | ||
{ | ||
label: 'Toggle Full Screen', | ||
accelerator: 'Ctrl+Cmd+F', | ||
click: (item, win) => { | ||
if (win) win.setFullScreen(!win.isFullScreen()) | ||
} | ||
}, | ||
{ | ||
label: 'Toggle Developer Tools', | ||
accelerator: 'Alt+Cmd+I', | ||
click: (item, win) => { | ||
if (win) win.webContents.toggleDevTools() | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Window', | ||
role: 'window', | ||
submenu: [ | ||
{ | ||
label: 'Minimize', | ||
accelerator: 'CmdOrCtrl+M', | ||
role: 'minimize' | ||
}, | ||
{ | ||
label: 'Close', | ||
accelerator: 'CmdOrCtrl+W', | ||
role: 'close' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Notes', | ||
accelerator: 'CmdOrCtrl+1', | ||
click: (item, win) => { | ||
win.webContents.send('navigate', 'home') | ||
}, | ||
type: 'radio', | ||
checked: true | ||
}, | ||
{ | ||
label: 'Reminders', | ||
accelerator: 'CmdOrCtrl+2', | ||
click: (item, win) => { | ||
win.webContents.send('navigate', 'reminders') | ||
}, | ||
type: 'radio' | ||
}, | ||
{ | ||
label: 'Archive', | ||
accelerator: 'CmdOrCtrl+3', | ||
click: (item, win) => { | ||
win.webContents.send('navigate', 'archive') | ||
}, | ||
type: 'radio' | ||
}, | ||
{ | ||
label: 'Trash', | ||
accelerator: 'CmdOrCtrl+4', | ||
click: (item, win) => { | ||
win.webContents.send('navigate', 'trash') | ||
}, | ||
type: 'radio' | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Help', | ||
role: 'help', | ||
submenu: [ | ||
{ | ||
label: 'View on GitHub', | ||
click: () => { | ||
shell.openExternal('https://github.com/lukassr/keep-dark-desktop') | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
const menu = Menu.buildFromTemplate(template) | ||
Menu.setApplicationMenu(menu) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const join = require('path').join | ||
const BrowserWindow = require('electron').BrowserWindow | ||
const config = require('./config') | ||
const fs = require('fs') | ||
|
||
|
||
module.exports = function createMainWindow (handleResize, handleClosed) { | ||
const lastWindowState = config.get('lastWindowState') | ||
|
||
const window = new BrowserWindow({ | ||
minWidth: 615, | ||
x: lastWindowState.x, | ||
y: lastWindowState.y, | ||
width: lastWindowState.width, | ||
height: lastWindowState.height, | ||
icon: join(__dirname, '../build/icon.png'), | ||
title: 'Keep Dark', | ||
titleBarStyle: 'hidden', | ||
webPreferences: { | ||
preload: `${__dirname}/browser.js`, | ||
partition: "persist:main" | ||
} | ||
}) | ||
|
||
window.loadURL('https://keep.google.com') | ||
window.webContents.on('did-finish-load', function() { | ||
console.log(__dirname) | ||
fs.readFile(__dirname+ '/../dark.css', "utf-8", function(error, data) { | ||
if(!error){ | ||
var formatedData = data.replace(/\s{2,10}/g, ' ').trim() | ||
window.webContents.insertCSS(formatedData) | ||
} | ||
}) | ||
}) | ||
// window.setFullScreen(true); | ||
window.on('resize', handleResize) | ||
window.on('closed', handleClosed) | ||
// const session = window.webContents.session.cookies.get({}, (error, cookies) => { | ||
// console.log("cookies", cookies); | ||
// var cookies = session.defaultSession.cookies; | ||
// cookies.on('changed', function(event, cookie, cause, removed) { | ||
// if (cookie.session && !removed) { | ||
// var url = util.format('%s://%s%s', (!cookie.httpOnly && cookie.secure) ? 'https' : 'http', cookie.domain, cookie.path); | ||
// console.log('url', url); | ||
// cookies.set({ | ||
// url: url, | ||
// name: cookie.name, | ||
// value: cookie.value, | ||
// domain: cookie.domain, | ||
// path: cookie.path, | ||
// secure: cookie.secure, | ||
// httpOnly: cookie.httpOnly, | ||
// expirationDate: Math.floor(new Date().getTime()/1000)+1209600 | ||
// }, function(err) { | ||
// if (err) { | ||
// log.error('Error trying to persist cookie', err, cookie); | ||
// } | ||
// }); | ||
// } | ||
// }); | ||
// });; | ||
|
||
return window | ||
} |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.