Skip to content

Commit

Permalink
Merge pull request #68 from Sandural/master
Browse files Browse the repository at this point in the history
fix tray display in mac
  • Loading branch information
elliottzheng committed Mar 15, 2019
2 parents b2d9f26 + 725ae1c commit a75423d
Show file tree
Hide file tree
Showing 8 changed files with 10,161 additions and 14,749 deletions.
Binary file added icon@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14,746 changes: 0 additions & 14,746 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -16,7 +16,7 @@
"postinstall": "electron-builder install-app-deps",
"rebuild": "npm rebuild --runtime=electron --target=3.0.0 --disturl=https://atom.io/download/atom-shell --abi=64",
"prebuild": "tsc ./src/prebuild.ts && node ./src/prebuild.js && npm run clean",
"clean": "del src\\*.js /s",
"clean": "rm -f src\\*.js /s",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"docs:deploy": "sh docs/.vuepress/release/sync.sh deploy"
Expand Down
4 changes: 4 additions & 0 deletions src/tools/envConfig.ts
Expand Up @@ -3,6 +3,7 @@ const path = require("path");
const fs = require("fs");

const iconName = os.type() == "Windows_NT" ? "icon.ico" : "icon.png";
const trayIconName = 'icon@2x.png';

function mkdir(path: string) {
if (fs.existsSync(path)) {
Expand All @@ -23,6 +24,7 @@ interface SharedConfig {
interface DiffConfig {
systemLocaleDir: string;
iconPath: string;
trayIconPath:string;
styleTemplate: string;
}

Expand All @@ -42,12 +44,14 @@ const sharedConfig: SharedConfig = {
const ProductionConfig: DiffConfig = {
systemLocaleDir: path.join(process.resourcesPath, "locales"),
iconPath: path.join(process.resourcesPath, iconName),
trayIconPath: path.join(process.resourcesPath, trayIconName),
styleTemplate: path.join(process.resourcesPath, "styles.css")
};

const DevConfig: DiffConfig = {
systemLocaleDir: path.join(process.cwd(), "dist_locales"),
iconPath: path.join(process.cwd(), iconName),
trayIconPath: path.join(process.cwd(), trayIconName),
styleTemplate: path.join(process.cwd(), "src", "styles.css")
};

Expand Down
2 changes: 1 addition & 1 deletion src/tools/tray.ts
Expand Up @@ -6,7 +6,7 @@ class TrayManager {
tray: Tray | undefined;
constructor() {}
init() {
this.tray = new Tray(envConfig.diffConfig.iconPath);
this.tray = new Tray(envConfig.diffConfig.trayIconPath);
this.tray.setToolTip(constants.appName);
this.tray.on("right-click", event => {
(<any>global).controller.action.popup("Tray");
Expand Down
4 changes: 3 additions & 1 deletion src/tools/windows.ts
Expand Up @@ -195,7 +195,9 @@ class WindowWrapper {
y: param.y,
width: param.width,
height: param.height,
frame: false
minWidth: 800,
minHeight: 600,
// frame: false
});
this.load(routeName);
this.window.on("closed", () => {
Expand Down
6 changes: 6 additions & 0 deletions vue.config.js
@@ -1,6 +1,8 @@
const iconName =
require("os").type() === "Windows_NT" ? "icon.ico" : "icon.png";

const trayIconName = require('os').platform() === 'darwin' ? 'icon@2x.png' : "icon.png"

module.exports = {
pluginOptions: {
electronBuilder: {
Expand All @@ -12,6 +14,10 @@ module.exports = {
from: `dist_locales`,
to: `locales`
},
{
from: trayIconName,
to: trayIconName
},
{
from: iconName,
to: iconName
Expand Down

0 comments on commit a75423d

Please sign in to comment.