Skip to content
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: 5 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ function createMainWindow() {

window.on('close', (event) => {
if (!forceQuit) {
hideOrQuit();
if (SYSTEM_IS_MACOS) {
app.hide();
} else {
window.hide();
}
event?.preventDefault();
}
});
Expand Down
20 changes: 16 additions & 4 deletions src/renderer/extensions/rule-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let trayContextMenu;
// dirty translate
let t: TFunction;

async function buildTrayContextMenu() {
function buildTrayContextMenu() {
const rules: Rule[] = CoreAPI.store.get(RULE_STORE_KEY) || [];
const ruleListMenus = rules.map((item, index) => {
return {
Expand Down Expand Up @@ -87,7 +87,7 @@ all_proxy=${generateSocksProxyUrl(port)}
},
},
]);
tray.setContextMenu(trayContextMenu);
return trayContextMenu;
}

export class RuleEditor extends Extension {
Expand All @@ -98,8 +98,20 @@ export class RuleEditor extends Extension {
const image = remote.nativeImage.createFromPath(ICON_TEMPLATE_PATH);
tray = await new remote.Tray(image);

tray.on('mouse-move', buildTrayContextMenu);
tray.on('click', buildTrayContextMenu);
tray.on('mouse-move', () => {
tray.setContextMenu(buildTrayContextMenu());
});
tray.on('click', () => {
const window = remote.getCurrentWindow();
if (!window.isVisible() || window.isFullScreen()) {
window.show();
} else {
window.hide();
}
});
tray.on('right-click', () => {
tray.popUpContextMenu(buildTrayContextMenu());
});
tray.setToolTip('iProxy');
})();
}
Expand Down
18 changes: 9 additions & 9 deletions vendor/files/node/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"dependencies": {
"whistle": "../../whistle",
"whistle-start": "../../whistle-start",
"whistle.chii-internal": "../../whistle.chii-internal",
"whistle.scriptfile": "../../whistle.scriptfile",
"whistle.vase": "^2.2.0"
}
}
{
"dependencies": {
"whistle": "../../whistle",
"whistle-start": "../../whistle-start",
"whistle.chii-internal": "../../whistle.chii-internal",
"whistle.scriptfile": "../../whistle.scriptfile",
"whistle.vase": "^2.2.2"
}
}
Loading