diff options
author | Devine Lu Linvega <[email protected]> | 2018-12-09 13:09:22 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-12-09 13:09:22 +1200 |
commit | 5d888fa9ece5008dda835d3e012a51ff70cb7bc4 (patch) | |
tree | 866b168f47fbe98e5ded3d5f33cf2a61051f82d0 | |
parent | 5c31ece4a376df80d92eb36cc5ff05efaa16d796 (diff) | |
download | Orca-5d888fa9ece5008dda835d3e012a51ff70cb7bc4.tar.gz Orca-5d888fa9ece5008dda835d3e012a51ff70cb7bc4.zip |
Added theme open
-rw-r--r-- | desktop/sources/index.html | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/lib/theme.js | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/desktop/sources/index.html b/desktop/sources/index.html index 34cdac2..ce82658 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -63,7 +63,8 @@ terminal.controller.add("default","Theme","Default Theme",() => { terminal.theme.noir(); },"CmdOrCtrl+Shift+1") terminal.controller.add("default","Theme","Light Theme",() => { terminal.theme.pale(); },"CmdOrCtrl+Shift+2") - terminal.controller.add("default","Theme","Get More..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes'); }) + terminal.controller.add("default","Theme","Open Theme",() => { terminal.theme.open(); },"CmdOrCtrl+Shift+o") + terminal.controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes'); }) terminal.controller.commit() terminal.start() diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js index 9b8ac21..4b9e3b1 100644 --- a/desktop/sources/scripts/lib/theme.js +++ b/desktop/sources/scripts/lib/theme.js @@ -2,6 +2,8 @@ function Theme (noir, pale) { const themer = this + const fs = require('fs') + const { dialog, app } = require('electron').remote this.collection = { noir: noir, pale: pale } this.active = this.collection.noir @@ -80,6 +82,16 @@ function Theme (noir, pale) { reader.readAsText(file) } + this.open = function () { + console.log('Open') + let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'] }) + if (!paths) { console.log('Nothing to load') } + fs.readFile(paths[0], 'utf8', function (err, data) { + if (err) throw err + themer.load(data) + }) + } + window.addEventListener('dragover', this.drag) window.addEventListener('drop', this.drop) |