]> Repos - mime-chat/commitdiff
WIP: tray icon image tray_menu
authorEnrique H. Oliva <hernandeze2@xavier.edu>
Thu, 29 Jul 2021 14:04:35 +0000 (09:04 -0500)
committerEnrique H. Oliva <hernandeze2@xavier.edu>
Thu, 29 Jul 2021 14:04:35 +0000 (09:04 -0500)
package.json
src/images/icon.png [new file with mode: 0644]
src/images/icon@2x.png [new file with mode: 0644]
src/images/icon_32x32.png [new file with mode: 0644]
src/images/icon_32x32@2x.png [new file with mode: 0644]
src/main.ts
yarn.lock

index b11c9db461eb3884e39bb506b6445336b5403a48..3cc50ff249f466a342c450924d1d2bf0628a80bf 100644 (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",
diff --git a/src/images/icon.png b/src/images/icon.png
new file mode 100644 (file)
index 0000000..b925c06
Binary files /dev/null and b/src/images/icon.png differ
diff --git a/src/images/icon@2x.png b/src/images/icon@2x.png
new file mode 100644 (file)
index 0000000..7bf880c
Binary files /dev/null and b/src/images/icon@2x.png differ
diff --git a/src/images/icon_32x32.png b/src/images/icon_32x32.png
new file mode 100644 (file)
index 0000000..7bf880c
Binary files /dev/null and b/src/images/icon_32x32.png differ
diff --git a/src/images/icon_32x32@2x.png b/src/images/icon_32x32@2x.png
new file mode 100644 (file)
index 0000000..2a9f925
Binary files /dev/null and b/src/images/icon_32x32@2x.png differ
index 334a6fe34481e24f604f13244ebc5b46722e8355..2cb205cd153f154d8710e5dbdd4384e8eaeebd47 100644 (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();
 
index e79f19f4206b26a835d230a4d20b7b4993018baf..55fa251eb63d294a51dcc0e90e2becf12b6e957d 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"