Files
Clipboard/tray-menu.js
2026-09-12 13:59:12 +08:00

22 lines
732 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
/**
* 构建托盘右键菜单模板。纯函数,不 require electron便于单测。
*
* 托盘只负责三件事:开关历史窗口、进入设置、退出。
* 主题 / 强调色 / 快捷键 / 关于一律在设置窗口里,不要往这儿加。
*
* @param {{onShow: () => void, onSettings: () => void, onQuit: () => void}} actions
* @returns {Array<object>} 交给 Menu.buildFromTemplate() 的模板数组
*/
function buildTrayMenuTemplate({ onShow, onSettings, onQuit }) {
return [
{ label: '显示历史', click: onShow },
{ label: '设置...', click: onSettings },
{ type: 'separator' },
{ label: '退出', click: onQuit },
];
}
module.exports = { buildTrayMenuTemplate };