diff --git a/source/menu.ts b/source/menu.ts index 9ad4fb569..03f6f3c5d 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -233,6 +233,7 @@ Press Command/Ctrl+R in Caprine to see your changes. }, { label: 'Always on Top', + id: 'always-on-top', type: 'checkbox', accelerator: 'CommandOrControl+Shift+T', checked: config.get('alwaysOnTop'), diff --git a/source/tray.ts b/source/tray.ts index 51284ff0c..f659576a0 100644 --- a/source/tray.ts +++ b/source/tray.ts @@ -20,6 +20,11 @@ export default { win.hide(); } else { win.show(); + + // Workaround for https://github.com/electron/electron/issues/20858 + // `setAlwaysOnTop` stops working after hiding the window on KDE Plasma. + const alwaysOnTopMenuItem = Menu.getApplicationMenu()!.getMenuItemById('always-on-top'); + win.setAlwaysOnTop(alwaysOnTopMenuItem.checked); } }