Skip to content

Commit

Permalink
modified index files
Browse files Browse the repository at this point in the history
  • Loading branch information
matfranca committed Jun 22, 2020
1 parent 008cefb commit 6b9fb39
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
}

html {
-webkit-app-region: drag;
font-family: Roboto, sans-serif;
color: var(--title-color);
}

body {
background: var(--background-color);
-webkit-app-region: drag;
-webkit-font-smoothing: antialiased;
margin: auto;
}
Expand All @@ -37,7 +37,7 @@ header img {
max-width: 80%;
height: auto;
margin-bottom: 5px;
opacity: 100%;
/* opacity: 100%; */
}

header p {
Expand Down Expand Up @@ -95,6 +95,11 @@ form div a {
text-align: center;
}

main .button {
-webkit-app-region: drag;
padding: 15px;
}

button {
-webkit-app-region: no-drag;
width: 260px;
Expand Down
8 changes: 5 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
</div>
</div>
</form>
<button>Login</button>
<div class="button">
<button id='loginBtn'>Login</button>
</div>
</main>
</div>
<script src="/scripts/index.js"></script>
</body>

<script src="index.js"></script>
</body>
</html>
91 changes: 82 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { app, BrowserWindow, Tray } = require('electron');
const { app, BrowserWindow, Tray, Menu } = require('electron');
const { resolve } = require('path');

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
Expand All @@ -9,11 +10,12 @@ const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 340,
resizable: false,
height: 500,
maximizable: false,
frame: false,
enableLargerThanScreen: false,
opacity: 0.95,
opacity: 0.90,
titleBarStyle: "hidden",
webPreferences: {
nodeIntegration: true
Expand All @@ -25,27 +27,98 @@ const createWindow = () => {

// Open the DevTools.
// mainWindow.webContents.openDevTools();

// var menu = Menu.buildFromTemplate([
// {
// label: 'Menu',
// submenu: [
// {
// label: 'Hello',
// click() {
// console.log('World');
// }
// },
// {
// label: 'Hide from everybody',
// click() {
// app.hide(createWindow);
// }
// },
// {
// label: 'Tray On/Off',
// click() {
// tray.hide();
// }
// },
// {
// label: 'Exit',
// click(){
// app.quit;
// }
// }
// ]
// }
// ])

Menu.setApplicationMenu(menu);
};

app.whenReady().then(createWindow);

// app.dock.hide();

let tray = null;

app.on('ready', () => {
tray = new Tray('public/assets/logo_16x16.png');
const contextMenu = Menu.buildFromTemplate([
{
label: 'Opacidade Settings',
submenu: [
{
label: 'Opacidade +',
},
{
label: 'Opacidade -' ,
}
]
},
{
label: 'Sair',
click (){
createWindow.call(createWindow);
}
}
]);
tray.setToolTip('Electron App');
tray.setContextMenu(contextMenu);

// const loginBtn = document.getElementById('loginBtn');

// loginBtn.addEventListener('click', () => {
// console.log('Button clicked');
// });

// const loginBtn = document.querySelector('loginBtn').addEventListener(
// 'click', () => {
// console.log('Button clicked');
// }
// );
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
//app.on('ready', createWindow);


app.on('minimize', function(event){
event.preventDefault();
mainWindow.hide();
});
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
// if (process.platform !== 'darwin') {
// app.quit();
// }
});

app.on('activate', () => {
Expand Down

0 comments on commit 6b9fb39

Please sign in to comment.