WIP: tray icon image

This commit is contained in:
Enrique H. Oliva 2021-07-29 09:04:35 -05:00
commit 95e73f7c28
7 changed files with 34 additions and 5 deletions

View file

@ -55,7 +55,7 @@
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"@wasm-tool/wasm-pack-plugin": "^1.3.1",
"electron": "^9.0.0",
"electron": "^8.3.3",
"electron-devtools-installer": "^3.1.0",
"electron-log": "^4.3.4",
"eslint": "^6.7.2",

BIN
src/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
src/images/icon@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

BIN
src/images/icon_32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -13,8 +13,37 @@ import initIpcMain from "@/ipc/index";
import { accountAuth } from "./account";
import createWindow from "./window";
import { Menu, Tray } from 'electron';
const nativeImage = require('electron').nativeImage
import path, {resolve} from 'path';
let tray = null
export default async function main() {
// TODO: fix image paths
// currently looking in dist-electron directory
// should be looking in source
console.log(resolve(__dirname, './images', 'icon.png'))
console.log(path.join(__dirname, './images/icon.png'))
try {
const image = nativeImage.createFromPath(resolve(__dirname, 'images', 'icon_16x16.png'));
const urlImage = nativeImage.createFromDataURL('https://github.com/vladimiry-playground/electron-quick-start-tray-issue/blob/master/icon.png');
console.log(image)
console.log(urlImage)
tray = new Tray(resolve(__dirname, 'images', 'icon_16x16.png'))
} catch(e) {
console.log(e)
}
// const contextMenu = Menu.buildFromTemplate([
// { label: 'Item1', type: 'radio' },
// { label: 'Item2', type: 'radio' },
// { label: 'Item3', type: 'radio', checked: true },
// { label: 'Item4', type: 'radio' }
// ])
// tray.setToolTip('This is my application.')
// tray.setContextMenu(contextMenu)
/* initiate controls for frontend to use when needed */
initIpcMain();

View file

@ -5077,10 +5077,10 @@ electron-updater@^4.3.8:
lodash.isequal "^4.5.0"
semver "^7.3.4"
electron@^9.0.0:
version "9.3.3"
resolved "https://registry.yarnpkg.com/electron/-/electron-9.3.3.tgz#99a6619d5df68f97697a5d1d82ef3a8a63fcdf36"
integrity sha512-xghKeUY1qgnEcJ5w2rXo/toH+8NT2Dktx2aAxBNPV7CIJr3mejJJAPwLbycwtddzr37tgKxHeHlc8ivfKtMkJQ==
electron@^8.3.3:
version "8.5.5"
resolved "https://registry.yarnpkg.com/electron/-/electron-8.5.5.tgz#17b12bd70139c0099f750fc5de0d480bf03acb96"
integrity sha512-e355H+tRDial0m+X2v+l+0SnaATAPw4sNjv9qmdk/6MJz/glteVJwVJEnxTjPfEELIJSChrBWDBVpjdDvoBF4Q==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"