Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 6 additions & 12 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>

<title>nGIF</title>
<link rel="stylesheet" href="style.css" />
<link rel="shortcut icon" href="icon source here" type="image/x-icon">
</head>
<body>

<header id="titlebar">
<div id="drag-region">

Expand All @@ -16,20 +15,15 @@
</div>

<div id="window-controls">

<div class="button" id="min-button">
<img class="icon" srcset="icons/min-w-10.png 1x, icons/min-w-12.png 1.25x, icons/min-w-15.png 1.5x, icons/min-w-15.png 1.75x, icons/min-w-20.png 2x, icons/min-w-20.png 2.25x, icons/min-w-24.png 2.5x, icons/min-w-30.png 3x, icons/min-w-30.png 3.5x" draggable="false" />
<img class="icon" srcset="icons/min-w-10.png 1x, icons/min-w-12.png 1.25x, icons/min-w-15.png 1.5x, icons/min-w-15.png 1.75x, icons/min-w-20.png 2x, icons/min-w-20.png 2.25x, icons/min-w-24.png 2.5x, icons/min-w-30.png 3x, icons/min-w-30.png 3.5x" draggable="false" />
</div>
<div class="button" id="max-button">
<img class="icon" srcset="icons/max-w-10.png 1x, icons/max-w-12.png 1.25x, icons/max-w-15.png 1.5x, icons/max-w-15.png 1.75x, icons/max-w-20.png 2x, icons/max-w-20.png 2.25x, icons/max-w-24.png 2.5x, icons/max-w-30.png 3x, icons/max-w-30.png 3.5x" draggable="false" />
<img class="icon" id="mxr" srcset="icons/max-w-10.png 1x, icons/max-w-12.png 1.25x, icons/max-w-15.png 1.5x, icons/max-w-15.png 1.75x, icons/max-w-20.png 2x, icons/max-w-20.png 2.25x, icons/max-w-24.png 2.5x, icons/max-w-30.png 3x, icons/max-w-30.png 3.5x" draggable="false" />
</div>
<div class="button" id="restore-button">
<img class="icon" srcset="icons/restore-w-10.png 1x, icons/restore-w-12.png 1.25x, icons/restore-w-15.png 1.5x, icons/restore-w-15.png 1.75x, icons/restore-w-20.png 2x, icons/restore-w-20.png 2.25x, icons/restore-w-24.png 2.5x, icons/restore-w-30.png 3x, icons/restore-w-30.png 3.5x" draggable="false" />
<div class="button close-button" id="close-button">
<img class="icon" srcset="icons/close-w-10.png 1x, icons/close-w-12.png 1.25x, icons/close-w-15.png 1.5x, icons/close-w-15.png 1.75x, icons/close-w-20.png 2x, icons/close-w-20.png 2.25x, icons/close-w-24.png 2.5x, icons/close-w-30.png 3x, icons/close-w-30.png 3.5x" draggable="false" />
</div>
<div class="button" id="close-button">
<img class="icon" srcset="icons/close-w-10.png 1x, icons/close-w-12.png 1.25x, icons/close-w-15.png 1.5x, icons/close-w-15.png 1.75x, icons/close-w-20.png 2x, icons/close-w-20.png 2.25x, icons/close-w-24.png 2.5x, icons/close-w-30.png 3x, icons/close-w-30.png 3.5x" draggable="false" />
</div>

</div>
</div>
</header>
Expand Down
44 changes: 33 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron');
const { app, BrowserWindow, ipcMain} = require('electron');
const path = require('path');
const ipc = ipcMain;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

function createWindow () {
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
frame: false,
backgroundColor: '#FFF',
backgroundColor: '#ffffff',
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
devTools: false,
preload: path.join(__dirname, 'preload.js'),
},
icon: "icon source here"
});

ipc.on("closeApp", () => {
mainWindow.close();
});
ipc.on("minApp", () => {
mainWindow.minimize();
});
ipc.on("maxApp", () => {
if(mainWindow.isMaximized()) {
mainWindow.webContents.send("changeIr");
mainWindow.restore();
} else {
mainWindow.webContents.send("changeImx");
mainWindow.maximize();
}
});

Expand All @@ -25,10 +47,10 @@ function createWindow () {

// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
}

Expand All @@ -38,15 +60,15 @@ function createWindow () {
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', function () {
app.on('window-all-closed', function() {
// On macOS 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();
}
});

app.on('activate', function () {
app.on('activate', function() {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
Expand All @@ -55,4 +77,4 @@ app.on('activate', function () {
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// code. You can also put them in separate files and require them here.
Loading