Skip to content

Commit

Permalink
New icon, menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Trofimov committed May 17, 2019
1 parent 23e91c9 commit 85a68d5
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 24 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# una-desktop-app
UNA Desktop App
# UNA Desktop App

## Rebranding

Change the following values to your own in `src/index.js` file:
```js
const BASE_URL = 'https://una.io/';
const TEMPLATE = 'protean';
const TITLE = 'UNA.IO Messenger';
const TRAY_TOOLTIP = 'UNA.IO Messenger (double-click - hide, click - focus)';
```

## Generate Icons

Make `1024x1024` icon and place it instead of `res/AppIcon.png`.
To generate `AppIcon.icns` you can use use (IconGenerator)[https://github.com/onmyway133/IconGenerator] app.
To generate `AppIcon.ico` use any tool to resize it to `150x150` and convert to `.ico` format, for example (GIMP)[https://www.gimp.org].
Tray icons are needed for Windows only and can created using any suitable image editor.

## Packaging

Windows build must be made on Windows - run `package-win.bat`.
Mac build must be made on Mac only - run `package-mac.sh`.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "UNAMessenger",
"productName": "UNAMessenger",
"version": "1.0.0",
"version": "1.1.0",
"description": "una.io desktop messenger app",
"main": "src/index.js",
"scripts": {
Expand Down
Binary file modified res/AppIcon.icns
Binary file not shown.
Binary file modified res/AppIcon.ico
Binary file not shown.
Binary file modified res/AppIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 42 additions & 21 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/**
* Copyright (c) UNA, Inc - https://una.io
* MIT License - https://opensource.org/licenses/MIT
*/

import { app, session, shell, nativeImage, ipcMain, BrowserWindow, Menu, Tray } from 'electron';

const BASE_URL = 'https://una.io/'; // 'http://hihi.una.io/';
const TEMPLATE = 'protean';
const TITLE = 'UNA.IO Messenger';
const TRAY_TOOLTIP = 'UNA.IO Messenger (double-click - hide, click - focus)';

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
app.quit();
}

const BASE_URL = 'https://una.io/'; // 'http://hihi.una.io/';
const TEMPLATE = 'protean';
// allow to play sound by default
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');

let tray;
let win;
Expand Down Expand Up @@ -40,33 +50,44 @@ function createWindow () {
win = null;
});


// application's main menu for mac
const menuTemplate = [{
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:" }
]}, {
label: "View",
submenu: [
{ role: "zoomIn" },
{ role: "zoomOut" },
{ type: "separator" },
{ role: "forceReload" },
]}
];

if ('darwin' === process.platform) {
// application's main menu for mac
var template = [{
label: "UNA.IO Messenger",
menuTemplate.unshift({
label: TITLE,
submenu: [
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
]}, {
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:" }
]}
];

Menu.setApplicationMenu(Menu.buildFromTemplate(template));
]
});
}

Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));

if ('win32' === process.platform) {
// tray icon for windows
tray = new Tray(__dirname + '/../res/tray.png');
tray.setTitle('UNA.IO Messenger');
tray.setToolTip('UNA.IO Messenger (double-click - hide, click - focus)');
tray.setTitle(TITLE);
tray.setToolTip(TRAY_TOOLTIP);
tray.on('double-click', () => {
win.isVisible() ? win.hide() : win.show()
});
Expand Down

0 comments on commit 85a68d5

Please sign in to comment.