Skip to content

Commit

Permalink
Initial commit with generator-electron
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Bento committed Oct 24, 2017
0 parents commit 552c77f
Show file tree
Hide file tree
Showing 10 changed files with 2,759 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
/dist
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Lucas Bento <lucas.bsilva@outlook.com> (https://github.com/lucasbento)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# menubar-brightness

> My wicked app

## References

- https://github.com/kevva/brightness
- Hide dock icon as default (https://github.com/electron/electron/issues/422#issuecomment-293518966)

## Dev

```
$ npm install
```

### Run

```
$ npm start
```

### Build

```
$ npm run build
```

Builds the app for macOS, Linux, and Windows, using [electron-packager](https://github.com/electron-userland/electron-packager).


## License

MIT © [Lucas Bento](https://github.com/lucasbento)
27 changes: 27 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
html,
body {
padding: 0;
margin: 0;
}

body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}

header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}

header h1 {
font-size: 60px;
font-weight: 100;
margin: 0;
padding: 0;
}
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Electron boilerplate</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<header>
<h1>Electron boilerplate</h1>
</header>
<section class="main"></section>
<footer></footer>
</div>
</body>
</html>
40 changes: 40 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';
const electron = require('electron');
const menubar = require('menubar');

const app = electron.app;
const menu = menubar();

// adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();

// prevent window being garbage collected
let mainWindow;

function onClosed() {
// dereference the window
// for multiple windows store them in an array
mainWindow = null;
}

function createMainWindow() {
menu.app.on('closed', onClosed);

return menu.app;
}

menu.app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

menu.app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow();
}
});

menu.app.on('ready', () => {
mainWindow = createMainWindow();
});
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "menubar-brightness",
"productName": "MenubarBrightness",
"version": "0.0.0",
"description": "My wicked app",
"license": "MIT",
"repository": "lucasbento/menubar-brightness",
"author": {
"name": "Lucas Bento",
"email": "lucas.bsilva@outlook.com",
"url": "github.com/lucasbento"
},
"scripts": {
"test": "xo",
"start": "electron .",
"build": "electron-packager . --out=dist --asar --overwrite --all"
},
"files": [
"index.js",
"index.html",
"index.css"
],
"keywords": [
"electron-app",
"electron"
],
"dependencies": {
"electron-debug": "^1.0.0",
"menubar": "^5.2.3"
},
"devDependencies": {
"devtron": "^1.1.0",
"electron": "^1.3.3",
"electron-packager": "^8.0.0",
"xo": "^0.16.0"
},
"xo": {
"esnext": true,
"envs": [
"node",
"browser"
]
}
}
Loading

0 comments on commit 552c77f

Please sign in to comment.