mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-05-20 10:52:48 +00:00
fix(desktop): rebuild tray menu in place instead of recreating the Tray
The old setupTray() called tray.destroy() before creating a new Tray. On Linux with KDE Plasma 6 Wayland, tray.destroy() does not actually remove the icon from plasmashell (electron/electron#49517), so the new Tray registers a fresh dbusmenu while plasmashell keeps talking to the orphaned one. Menu items still render (cached layout) but every com.canonical.dbusmenu.Event("clicked", ...) method call from plasmashell hits the destroyed handler and is dropped, so menu-item click callbacks stop firing after the frontend triggers a rebuild on login. Move the one-time Tray construction (icon, tooltip, click handler) behind a !tray guard and keep setContextMenu in the always-run path. The desktop:update-quick-entry-shortcut IPC handler keeps calling setupTray() and the accelerator label updates without touching the native Tray.
This commit is contained in:
committed by
kolaente
parent
10e5fa915a
commit
e624c8a296
@@ -332,12 +332,20 @@ function toggleQuickEntry() {
|
||||
|
||||
// ─── System tray ─────────────────────────────────────────────────────
|
||||
function setupTray() {
|
||||
if (tray) {
|
||||
tray.destroy()
|
||||
if (!tray) {
|
||||
const iconPath = path.join(__dirname, 'build', 'icon.png')
|
||||
const icon = nativeImage.createFromPath(iconPath).resize({width: 16, height: 16})
|
||||
tray = new Tray(icon)
|
||||
tray.setToolTip('Vikunja')
|
||||
tray.on('click', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.show()
|
||||
mainWindow.focus()
|
||||
} else {
|
||||
createMainWindow()
|
||||
}
|
||||
})
|
||||
}
|
||||
const iconPath = path.join(__dirname, 'build', 'icon.png')
|
||||
const icon = nativeImage.createFromPath(iconPath).resize({width: 16, height: 16})
|
||||
tray = new Tray(icon)
|
||||
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
@@ -366,17 +374,7 @@ function setupTray() {
|
||||
},
|
||||
])
|
||||
|
||||
tray.setToolTip('Vikunja')
|
||||
tray.setContextMenu(contextMenu)
|
||||
|
||||
tray.on('click', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.show()
|
||||
mainWindow.focus()
|
||||
} else {
|
||||
createMainWindow()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// ─── IPC handlers ────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user