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