feat: improved tray functionality and ui theme settings
This commit is contained in:
parent
b371fed814
commit
0b9717780d
@ -27,7 +27,7 @@ export class ConfigManager {
|
||||
}
|
||||
|
||||
isTray(): boolean {
|
||||
return !!this.store.get('tray', false)
|
||||
return !!this.store.get('tray', true)
|
||||
}
|
||||
|
||||
setTray(value: boolean) {
|
||||
|
||||
@ -58,7 +58,10 @@ export class TrayService {
|
||||
}
|
||||
])
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
this.tray.setContextMenu(contextMenu)
|
||||
}
|
||||
|
||||
this.tray.setToolTip('Cherry Studio')
|
||||
|
||||
this.tray.on('right-click', () => {
|
||||
|
||||
@ -166,11 +166,10 @@ export class WindowService {
|
||||
}
|
||||
|
||||
private setupWindowLifecycleEvents(mainWindow: BrowserWindow) {
|
||||
mainWindow.on('close', (event) => {
|
||||
if (!configManager.isTray() && isTilingWindowManager()) {
|
||||
app.quit()
|
||||
}
|
||||
|
||||
mainWindow.on('close', (event) => {
|
||||
if (!app.isQuitting) {
|
||||
event.preventDefault()
|
||||
mainWindow.hide()
|
||||
@ -181,7 +180,7 @@ export class WindowService {
|
||||
public showMainWindow() {
|
||||
if (this.mainWindow) {
|
||||
if (this.mainWindow.isMinimized()) {
|
||||
this.mainWindow.restore()
|
||||
return this.mainWindow.restore()
|
||||
}
|
||||
this.mainWindow.show()
|
||||
this.mainWindow.focus()
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
function isTilingWindowManager() {
|
||||
if (process.platform !== 'linux') {
|
||||
if (process.platform === 'darwin') {
|
||||
return false
|
||||
}
|
||||
|
||||
if (process.platform !== 'linux') {
|
||||
return true
|
||||
}
|
||||
|
||||
const desktopEnv = process.env.XDG_CURRENT_DESKTOP?.toLowerCase()
|
||||
const tilingSystems = ['hyprland', 'i3', 'sway', 'bspwm', 'dwm', 'awesome', 'qtile', 'herbstluftwm', 'xmonad']
|
||||
|
||||
|
||||
@ -336,7 +336,7 @@
|
||||
"about.license.button": "License",
|
||||
"about.contact.button": "Email",
|
||||
"proxy.title": "Proxy Address",
|
||||
"tray.title": "Minimize to tray instead of closing",
|
||||
"tray.title": "Show Tray Icon",
|
||||
"theme.title": "Theme",
|
||||
"theme.dark": "Dark",
|
||||
"theme.light": "Light",
|
||||
|
||||
@ -324,7 +324,7 @@
|
||||
"about.license.button": "查看",
|
||||
"about.contact.button": "邮件",
|
||||
"proxy.title": "代理地址",
|
||||
"tray.title": "最小化到托盘而不是关闭",
|
||||
"tray.title": "显示任务栏图标",
|
||||
"theme.title": "主题",
|
||||
"theme.dark": "深色主题",
|
||||
"theme.light": "浅色主题",
|
||||
|
||||
@ -324,7 +324,7 @@
|
||||
"about.license.button": "查看",
|
||||
"about.contact.button": "郵件",
|
||||
"proxy.title": "代理地址",
|
||||
"tray.title": "最小化到系統列而不是關閉",
|
||||
"tray.title": "顯示工作列圖示",
|
||||
"theme.title": "主題",
|
||||
"theme.dark": "深色主題",
|
||||
"theme.light": "淺色主題",
|
||||
|
||||
@ -24,7 +24,7 @@ const persistedReducer = persistReducer(
|
||||
{
|
||||
key: 'cherry-studio',
|
||||
storage,
|
||||
version: 39,
|
||||
version: 40,
|
||||
blacklist: ['runtime'],
|
||||
migrate
|
||||
},
|
||||
|
||||
@ -673,6 +673,10 @@ const migrateConfig = {
|
||||
'39': (state: RootState) => {
|
||||
state.settings.codeStyle = 'auto'
|
||||
return state
|
||||
},
|
||||
'40': (state: RootState) => {
|
||||
state.settings.tray = true
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ const initialState: SettingsState = {
|
||||
showMessageDivider: false,
|
||||
messageFont: 'system',
|
||||
showInputEstimatedTokens: false,
|
||||
tray: true,
|
||||
theme: ThemeMode.auto,
|
||||
windowStyle: 'transparent',
|
||||
fontSize: 14,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user