Permalink
Browse files

reorg for clarity and convert to 2-space tabs

  • Loading branch information...
pfrazee committed May 26, 2016
1 parent 5570389 commit ec2ae2b652dd9883bde29dedf55f451c913ae019
View
@@ -3,7 +3,7 @@ root = true
[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
View
@@ -5,19 +5,28 @@ This is a highly opinionated and standards-noncompliant browser.
It has its own APIs for decentralized software.
It's semi-compatible with the Web.
It's not stable.
It's for experimenting.
That's why it's called beaker.
It's for experimenting, that's why it's called beaker.
## plans
### basic ui
Just needs to get the job done, not a lot of features here
- [ ] tabs, address bar
- [ ] inpage find ui
- [ ] keybindings
- [ ] swipe gestures
- browser controls
- [ ] tabs / window-management
- [ ] favicon render
- [ ] address bar
- [ ] tab pinning
- [ ] always-on-top pin
- builtin pages
- [ ] start page
- inpage controls
- [ ] find ui
- [ ] context menu
- input
- [ ] keybindings
- [ ] swipe gestures
### privacy, security
@@ -3,23 +3,22 @@
// It doesn't have any windows which you can see on screen, but we can open
// window from here.
import { app, Menu, BrowserWindow } from 'electron'
import buildMenu from './main/window-menu'
import { app, Menu } from 'electron'
import { create } from './background-process/windows'
import buildMenu from './background-process/window-menu'
import env from './env';
var mainWindow;
app.on('ready', function () {
Menu.setApplicationMenu(Menu.buildFromTemplate(buildMenu(env)));
Menu.setApplicationMenu(Menu.buildFromTemplate(buildMenu(env)));
var mainWindow = new BrowserWindow({
width: 1000,
height: 600
});
mainWindow.loadURL('https://google.com');
var mainWindow = create({
width: 1000,
height: 600
})
});
app.on('window-all-closed', function () {
app.quit();
app.quit();
});
@@ -0,0 +1,47 @@
import { app, BrowserWindow } from 'electron';
var editMenuTemplate = {
label: 'Edit',
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]
};
var devMenuTemplate = {
label: 'Development',
submenu: [{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click: function () {
BrowserWindow.getFocusedWindow().webContents.reloadIgnoringCache();
}
},{
label: 'Toggle DevTools',
accelerator: 'Alt+CmdOrCtrl+I',
click: function () {
BrowserWindow.getFocusedWindow().toggleDevTools();
}
},{
label: 'Quit',
accelerator: 'CmdOrCtrl+Q',
click: function () {
app.quit();
}
}]
};
export default function buildMenu (env) {
var menus = [editMenuTemplate];
if (env.name !== 'production') {
menus.push(devMenuTemplate);
}
return menus
}
@@ -0,0 +1,15 @@
import { BrowserWindow } from 'electron'
import path from 'path'
import log from '../log'
export function create (opts) {
var win = new BrowserWindow({
width: 1000,
height: 600
})
var startPagePath = 'file://'+path.join(__dirname, 'builtin-pages/start.html')
win.loadURL(startPagePath)
log('Opening', startPagePath)
return win
}
@@ -0,0 +1,2 @@
<!doctype html>
<html><body>start page!</body></html>
View
@@ -4,9 +4,9 @@ import jetpack from 'fs-jetpack';
var app;
if (process.type === 'renderer') {
app = require('electron').remote.app;
app = require('electron').remote.app;
} else {
app = require('electron').app;
app = require('electron').app;
}
var appDir = jetpack.cwd(app.getAppPath());
View
@@ -0,0 +1,7 @@
import env from './env'
export default function log (...args) {
if (env.name !== 'production') {
console.log.apply(console, args)
}
}
View

This file was deleted.

Oops, something went wrong.
View
@@ -5,7 +5,7 @@
"version": "0.0.0",
"author": "Paul Frazee",
"copyright": "© 2016, Paul Frazee",
"main": "main.js",
"main": "background-process.js",
"dependencies": {
"fs-jetpack": "^0.9.0"
},

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
this is the tabs bar
</body>
</html>
File renamed without changes.
@@ -0,0 +1,59 @@
// This gives you default context menu (cut, copy, paste)
// in all input fields and textareas across your app.
(function () {
'use strict';
var remote = require('electron').remote;
var Menu = remote.Menu;
var MenuItem = remote.MenuItem;
var isAnyTextSelected = function () {
return window.getSelection().toString() !== '';
};
var cut = new MenuItem({
label: "Cut",
click: function () {
document.execCommand("cut");
}
});
var copy = new MenuItem({
label: "Copy",
click: function () {
document.execCommand("copy");
}
});
var paste = new MenuItem({
label: "Paste",
click: function () {
document.execCommand("paste");
}
});
var normalMenu = new Menu();
normalMenu.append(copy);
var textEditingMenu = new Menu();
textEditingMenu.append(cut);
textEditingMenu.append(copy);
textEditingMenu.append(paste);
document.addEventListener('contextmenu', function (e) {
switch (e.target.nodeName) {
case 'TEXTAREA':
case 'INPUT':
e.preventDefault();
textEditingMenu.popup(remote.getCurrentWindow());
break;
default:
if (isAnyTextSelected()) {
e.preventDefault();
normalMenu.popup(remote.getCurrentWindow());
}
}
}, false);
}());
View
@@ -17,9 +17,9 @@ Sits on path: `beaker-browser/app/package.json`. This is **real** manifest of th
### Project's folders
- `app` - application code.
- `app/main` - main electron process.
- `app/pages` - builtin pages.
- `app/preload` - scripts injected into web pages.
- `app/background-process` - main electron process.
- `app/builtin-pages` - builtin pages.
- `app/window-preload` - scripts injected into web pages.
- `app/stylesheets` - styles shared across the app.
- `app/ui` - the ui controls code (tabs, addressbar, etc).
- `config` - environment-specific config options.
Oops, something went wrong.

0 comments on commit ec2ae2b

Please sign in to comment.