git ssb

16+

Dominic / patchbay



Commit 747bb2d95395b5f07ec8780551fd62881c5618af

Merge pull request #132 from ssbc/save-window-settings

Save window settings
mix irving authored on 9/4/2017, 9:39:08 PM
GitHub committed on 9/4/2017, 9:39:08 PM
Parent: 2a1d0d14f4337a529079e2dd3756a304c27d7edb
Parent: 41c069304b2bd78a228c769290dcaf99d6b470c2

Files changed

app/html/app.jschanged
main.jschanged
package-lock.jsonchanged
package.jsonchanged
app/html/app.jsView
@@ -1,7 +1,8 @@
11 const nest = require('depnest')
22 const { h } = require('mutant')
33 const insertCss = require('insert-css')
4 +const electron = require('electron')
45
56 exports.gives = nest('app.html.app')
67
78 exports.needs = nest({
@@ -13,9 +14,11 @@
1314 'app.sync.addPage': 'first',
1415 'app.sync.catchKeyboardShortcut': 'first',
1516 'router.sync.router': 'first',
1617 'router.sync.normalise': 'first',
17- 'styles.css': 'reduce'
18 + 'styles.css': 'reduce',
19 + 'settings.sync.get': 'first',
20 + 'settings.sync.set': 'first'
1821 })
1922
2023 exports.create = function (api) {
2124 return nest('app.html.app', app)
@@ -55,8 +58,31 @@
5558
5659 addError(ev.error || ev)
5760 })
5861
62 + ////// TODO - extract this to keep patch-lite isolated from electron
63 + const { getCurrentWebContents, getCurrentWindow } = electron.remote
64 + window.addEventListener('resize', () => {
65 + var wc = getCurrentWebContents()
66 + wc && wc.getZoomFactor((zf) => {
67 + api.settings.sync.set({
68 + electron: {
69 + zoomFactor: zf,
70 + windowBounds: getCurrentWindow().getBounds()
71 + }
72 + })
73 + })
74 + })
75 +
76 + var zoomFactor = api.settings.sync.get('electron.zoomFactor')
77 + if (zoomFactor)
78 + getCurrentWebContents().setZoomFactor(zoomFactor)
79 +
80 + var bounds = api.settings.sync.get('electron.windowBounds')
81 + if (bounds)
82 + getCurrentWindow().setBounds(bounds)
83 + //////
84 +
5985 return App
6086 }
6187 }
6288
main.jsView
@@ -9,8 +9,9 @@
99 const bayGatherings = require('patchbay-gatherings')
1010 const patchbay = require('./')
1111 const patchContext = require('patch-context')
1212 const patchcore = require('patchcore')
13 +const patchSettings = require('patch-settings')
1314
1415 // polyfills
1516 require('setimmediate')
1617
@@ -22,8 +23,9 @@
2223 // gatherings,
2324 // bayGatherings, // TODO collect gatherings into this
2425 patchbay,
2526 patchContext,
27 + patchSettings,
2628 patchcore
2729 )
2830
2931 const api = entry(sockets, nest('app.html.app', 'first'))
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 252990 bytes
New file size: 253788 bytes
package.jsonView
@@ -6,9 +6,9 @@
66 "scripts": {
77 "lint": "standard",
88 "setup": "npm install electron electro -g",
99 "rebuild": "npm rebuild --runtime=electron --target=$(electron -v) --abi=$(electron --abi) --disturl=https://atom.io/download/atom-shell",
10- "start": "electro main.js"
10 + "start": "electro main.js -- --title patchbay"
1111 },
1212 "browserify": {
1313 "transform": [
1414 "bulkify",
@@ -55,8 +55,9 @@
5555 "patch-gatherings": "^2.4.3",
5656 "patch-hub": "^1.1.0",
5757 "patchbay-gatherings": "^1.1.2",
5858 "patchcore": "^1.10.3",
59 + "patch-settings": "^1.0.0",
5960 "pull-abortable": "^4.1.1",
6061 "pull-cat": "^1.1.11",
6162 "pull-next": "1.0.0",
6263 "pull-scroll": "^1.0.7",

Built with git-ssb-web