experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #13 from autonome/groups

openWindow supports more params, slides now use it, animation gone tho

authored by

Dietrich Ayala and committed by
GitHub
748dcb1a b068cc6b

+121 -124
+23 -13
README.md
··· 120 120 * ✅ change settings shortcut from global+esc to opt+comma 121 121 122 122 Window lifecycle 123 - * ✅modularize window open/close + hidden/visible 124 - * ✅update settings, peeks, slides, scripts 125 - * hide/show window vs create fresh 126 - * modularize window close/hide/show across all windows 127 - * move animation to main, and update slides impl to use it 128 - * window settings persistence 123 + * ✅ modularize window open/close + hidden/visible 124 + * ✅ update settings, peeks, slides, scripts 125 + * ✅ hide/show window vs create fresh 126 + * ✅ update slides impl to use openWindow (x, y) 127 + * add support for private properties 128 + * figure out distinction for feature window explicit config vs settings window silent config 129 + * add window position persistence where it makes sense (settings, groups, cmd) 130 + * add window size persistence where it makes sense (slides, peeks) 131 + * add window open animation (to/from coords, time) to openWindow 132 + * update slides impl to use animation again 129 133 130 134 Core/Basic 131 135 * ✅ basic command bar to open pages 136 + * fix setting layout wrapping issue 137 + * don't blow away and re-init everything on any change 132 138 * schema migration 133 139 * basic history storage 140 + * app action metadata 134 141 * app updates 135 - * don't blow away and re-init everything on any change 136 - * fix setting layout wrapping issue 137 142 * enable/disable individual slides, peeks 138 143 * enable/disable individual scripts 139 - 140 - -> mvp 141 - 142 - ------- 143 144 144 145 Features cleanup 145 146 * enable/disable whole features 146 147 * move feature list and enablement to storage 148 + * configurable default feature to load on app open (or none) 147 149 * re-enable label previews, eg "Peek {key} - {address}" 148 - * configurable default feature to load on app open 150 + 151 + -> mvp (minimum viable preview) 152 + 153 + ------- 149 154 150 155 Web Platform 151 156 * need a web loader that's not full BrowserWindow? ··· 166 171 * Implement the Firefox "awesomebar" scoring and search algorithm so that Peek *learns* you 167 172 * Extension model designed for web user agent user interface experimentation 168 173 * Infinite lossless personal encrypted archive of web history 174 + 175 + ## Contribution 176 + 177 + * in proto stage 178 + * all dragons, no promises 169 179 170 180 ## Development 171 181
+7 -4
features/peeks/peeks.js
··· 125 125 }; 126 126 } 127 127 128 - let _windows = {}; 129 - 130 128 const executeItem = (api, item) => { 131 129 const height = item.height || 600; 132 130 const width = item.width || 800; 133 131 134 132 const params = { 135 - type: labels.featureType, 133 + // browserwindow 136 134 address: item.address, 137 135 height, 138 136 width, 139 - persistKey: item.keepLive ? 'peek:' + item.keyNum : undefined 137 + 138 + // peek 139 + type: labels.featureType, 140 + windowKey: `${labels.featureType}:${item.keyNum}`, 141 + keepLive: item.keepLive || false, 142 + persistData: item.persistData || false 140 143 }; 141 144 142 145 _api.openWindow(params);
+66 -94
features/slides/slides.js
··· 160 160 let _windows = {}; 161 161 162 162 const executeItem = (api, item) => { 163 - let win = null; 164 - 165 - const windowKey = labels.featureType + item.screenEdge; 166 - 167 - // TODO: fix stored+live windows 168 - if (_windows[windowKey]) { 169 - console.log(labels.featureType, slide.screenEdge, 'using stored window'); 170 - win = _windows[windowKey]; 171 - win.show(); 172 - } 173 - else { 174 - const { size, bounds } = screen.getPrimaryDisplay(); 175 - 176 - let x, y, height, width, center = null; 163 + let height = item.height || 600; 164 + let width = item.width || 800; 177 165 178 - switch(item.screenEdge) { 179 - case 'Up': 180 - // horizontally center 181 - x = (size.width - item.width) / 2; 166 + const { size, bounds } = screen.getPrimaryDisplay(); 182 167 183 - // y starts at screen top and stays there 184 - y = 0; 168 + let x, y, center = null; 185 169 186 - width = item.width; 187 - height = 1; 188 - break; 189 - case 'Down': 190 - // horizonally center 191 - x = (size.width - item.width) / 2; 170 + switch(item.screenEdge) { 171 + case 'Up': 172 + // horizontally center 173 + x = (size.width - item.width) / 2; 192 174 193 - // y ends up at window height from bottom 194 - // 195 - // eg: y = size.height - item.height; 196 - // 197 - // but starts at screen bottom 198 - y = size.height; 175 + // y starts at screen top and stays there 176 + y = 0; 199 177 200 - width = item.width; 201 - height = 1; 202 - break; 203 - case 'Left': 204 - // x starts and ends at at left screen edge 205 - // at left edge 206 - x = 0; 178 + width = item.width; 179 + //height = 1; 180 + break; 181 + case 'Down': 182 + // horizonally center 183 + x = (size.width - item.width) / 2; 207 184 208 - // vertically center 209 - y = (size.height - item.height) / 2; 185 + // y ends up at window height from bottom 186 + // 187 + // eg: y = size.height - item.height; 188 + // 189 + // but starts at screen bottom 190 + y = size.height; 210 191 211 - width = 1; 212 - height = item.height; 213 - break; 214 - case 'Right': 215 - // x ends at at right screen edge - window size 216 - // 217 - // eg: x = size.width - item.width; 218 - // 219 - // but starts at screen right edge, will animate in 220 - x = size.width; 192 + width = item.width; 193 + //height = 1; 194 + break; 195 + case 'Left': 196 + // x starts and ends at at left screen edge 197 + // at left edge 198 + x = 0; 221 199 222 - // vertically center 223 - y = (size.height - item.height) / 2; 200 + // vertically center 201 + y = (size.height - item.height) / 2; 224 202 225 - width = 1; 226 - height = item.height; 227 - break; 228 - default: 229 - center = true; 230 - console.log('waddafa'); 231 - } 203 + //width = 1; 204 + height = item.height; 205 + break; 206 + case 'Right': 207 + // x ends at at right screen edge - window size 208 + // 209 + // eg: x = size.width - item.width; 210 + // 211 + // but starts at screen right edge, will animate in 212 + x = size.width; 232 213 233 - win = new BrowserWindow({ 234 - height, 235 - width, 236 - x, 237 - y, 238 - skipTaskbar: true, 239 - autoHideMenuBar: true, 240 - titleBarStyle: 'hidden', 241 - // maybe worth doing instead of animating width 242 - //enableLargerThanScreen: true, 243 - webPreferences: { 244 - preload: api.preloadPath, 245 - // isolate content and do not persist it 246 - partition: Date.now() 247 - } 248 - }); 214 + // vertically center 215 + y = (size.height - item.height) / 2; 249 216 250 - //_windows[windowKey] = win; 217 + //width = 1; 218 + height = item.height; 219 + break; 220 + default: 221 + center = true; 222 + console.log('waddafa'); 251 223 } 252 224 253 - animateSlide(win, item).then(); 225 + //animateSlide(win, item).then(); 254 226 255 - const onGoAway = () => { 256 - /* 257 - if (item.keepLive) { 258 - _windows[key] = win; 259 - win.hide(); 260 - } 261 - else { 262 - win.destroy(); 263 - } 264 - */ 265 - win.destroy(); 266 - } 267 - win.on('blur', onGoAway); 268 - win.on('close', onGoAway); 227 + const params = { 228 + // browserwindow 229 + address: item.address, 230 + height, 231 + width, 269 232 270 - win.webContents.send('window', { type: labels.featureType, id: win.id, data: item }); 233 + // peek 234 + type: labels.featureType, 235 + windowKey: `${labels.featureType}:${item.screenEdge}`, 236 + keepLive: item.keepLive || false, 237 + persistData: item.persistData || false, 271 238 272 - win.loadURL(item.address); 239 + // slide 240 + x, 241 + y, 242 + }; 243 + 244 + api.openWindow(params); 273 245 }; 274 246 275 247 const initStore = (store, data) => {
+25 -13
index.js
··· 276 276 }; 277 277 278 278 const openWindow = (params) => { 279 - if (params.persistKey) { 280 - console.log('openWindow(): key', params.persistKey) 281 - const entry = windowCache.byKey(params.persistKey); 279 + if (params.keepLive == true) { 280 + const entry = windowCache.byKey(params.windowKey); 282 281 if (entry != undefined) { 283 282 const win = BrowserWindow.fromId(entry.id); 284 283 if (win) { 285 - console.log('openWindow(): opening persistent window for', params.persistKey) 284 + console.log('openWindow(): opening persistent window for', params.windowKey) 286 285 win.show(); 287 286 return; 288 287 } ··· 295 294 const width = params.width || 800; 296 295 const show = params.hasOwnProperty('show') ? params.show : true; 297 296 298 - const win = new BrowserWindow({ 297 + let webPreferences = { 298 + preload: preloadPath, 299 + }; 300 + 301 + if (!params.persistData) { 302 + // TODO: hack. this just isolates. 303 + webPreferences.partition = Date.now() 304 + } 305 + 306 + let winPreferences = { 299 307 height, 300 308 width, 301 309 show, ··· 303 311 skipTaskbar: true, 304 312 autoHideMenuBar: true, 305 313 titleBarStyle: 'hidden', 306 - webPreferences: { 307 - preload: preloadPath, 308 - // isolate content and do not persist it 309 - partition: Date.now() 314 + webPreferences 315 + }; 316 + 317 + ['x', 'y'].forEach( k => { 318 + if (params.hasOwnProperty(k)) { 319 + winPreferences[k] = params[k]; 310 320 } 311 321 }); 312 322 313 - // if persisting window, cache caller's key and window id 314 - if (params.persistKey) { 323 + const win = new BrowserWindow(winPreferences); 324 + 325 + // if persisting window, cache the caller's key and window id 326 + if (params.keepLive == true) { 315 327 windowCache.add({ 316 328 id: win.id, 317 - key: params.persistKey 329 + key: params.windowKey 318 330 }); 319 331 } 320 332 321 333 // TODO: make configurable 322 334 const onGoAway = () => { 323 - if (params.persistKey) { 335 + if (params.keepLive) { 324 336 win.hide(); 325 337 } 326 338 else {