feat: close-to-tray default + system settings entry; bump 1.0.3
This commit is contained in:
1 parent
8f686f56ca
commit
2b3fefafd0
4 files changed
+20
-4
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "open-terminal",
|
"name": "open-terminal",
|
||||||
"productName": "OpenTerminal",
|
"productName": "OpenTerminal",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "Open-source terminal with SSH, split panes, themes and fonts",
|
"description": "Open-source terminal with SSH, split panes, themes and fonts",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"author": "Bill",
|
"author": "Bill",
|
||||||
|
|||||||
+2
-2
@@ -34,7 +34,7 @@ function showMainWindow(showOrCreate: () => void): void {
|
|||||||
/** Rebuild the context menu so the close-action radio items reflect settings. */
|
/** Rebuild the context menu so the close-action radio items reflect settings. */
|
||||||
function refreshContextMenu(showOrCreate: () => void): void {
|
function refreshContextMenu(showOrCreate: () => void): void {
|
||||||
if (!tray) return
|
if (!tray) return
|
||||||
const action = loadSettings().system.closeAction ?? 'ask'
|
const action = loadSettings().system.closeAction ?? 'tray'
|
||||||
const setAction = (value: CloseAction) => (): void => {
|
const setAction = (value: CloseAction) => (): void => {
|
||||||
persistCloseAction(value)
|
persistCloseAction(value)
|
||||||
refreshContextMenu(showOrCreate)
|
refreshContextMenu(showOrCreate)
|
||||||
@@ -86,7 +86,7 @@ function hideToTray(win: BrowserWindow): void {
|
|||||||
*/
|
*/
|
||||||
export async function onMainWindowClose(win: BrowserWindow, e: Electron.Event, showOrCreate: () => void): Promise<void> {
|
export async function onMainWindowClose(win: BrowserWindow, e: Electron.Event, showOrCreate: () => void): Promise<void> {
|
||||||
if (quitting) return
|
if (quitting) return
|
||||||
const action = loadSettings().system.closeAction ?? 'ask'
|
const action = loadSettings().system.closeAction ?? 'tray'
|
||||||
if (action === 'tray') {
|
if (action === 'tray') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
hideToTray(win)
|
hideToTray(win)
|
||||||
|
|||||||
@@ -317,6 +317,22 @@ export function SystemSettingsTab(): React.JSX.Element {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<SettingRow
|
||||||
|
label="关闭按钮行为"
|
||||||
|
desc="点击窗口关闭按钮时的动作;最小化到托盘后可在托盘图标右键菜单中退出"
|
||||||
|
control={
|
||||||
|
<Select
|
||||||
|
className="settings-select"
|
||||||
|
value={settings.system.closeAction ?? 'tray'}
|
||||||
|
onChange={(value) => void updateSystem({ closeAction: value })}
|
||||||
|
options={[
|
||||||
|
{ value: 'tray', label: '最小化到托盘' },
|
||||||
|
{ value: 'exit', label: '直接退出' },
|
||||||
|
{ value: 'ask', label: '每次询问' }
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<SettingRow
|
<SettingRow
|
||||||
label="全局唤起快捷键"
|
label="全局唤起快捷键"
|
||||||
desc="Control+Shift+Alt+T 等,留空禁用"
|
desc="Control+Shift+Alt+T 等,留空禁用"
|
||||||
|
|||||||
@@ -107,5 +107,5 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
|||||||
},
|
},
|
||||||
customThemes: [],
|
customThemes: [],
|
||||||
highlightRules: DEFAULT_HIGHLIGHT_RULES,
|
highlightRules: DEFAULT_HIGHLIGHT_RULES,
|
||||||
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'ask', autoCheckUpdate: true }
|
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'tray', autoCheckUpdate: true }
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user