fix: position window titlebar buttons correctly in Ubuntu on Wayland (#48603)
fix: position window titlebar buttons correctly in Ubuntu on Wayland (#48490) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Mitchell Cohen <mitch.cohen@me.com>
This commit is contained in:
parent
6e61de6878
commit
d801ecbdd7
4 changed files with 8 additions and 43 deletions
|
|
@ -162,27 +162,6 @@ require('@electron/internal/browser/api/web-contents-view');
|
|||
// Set main startup script of the app.
|
||||
const mainStartupScript = packageJson.main || 'index.js';
|
||||
|
||||
const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']);
|
||||
|
||||
function currentPlatformSupportsAppIndicator () {
|
||||
if (process.platform !== 'linux') return false;
|
||||
const currentDesktop = process.env.XDG_CURRENT_DESKTOP;
|
||||
|
||||
if (!currentDesktop) return false;
|
||||
if (KNOWN_XDG_DESKTOP_VALUES.has(currentDesktop)) return true;
|
||||
// ubuntu based or derived session (default ubuntu one, communitheme…) supports
|
||||
// indicator too.
|
||||
if (/ubuntu/ig.test(currentDesktop)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Workaround for electron/electron#5050 and electron/electron#9046
|
||||
process.env.ORIGINAL_XDG_CURRENT_DESKTOP = process.env.XDG_CURRENT_DESKTOP;
|
||||
if (currentPlatformSupportsAppIndicator()) {
|
||||
process.env.XDG_CURRENT_DESKTOP = 'Unity';
|
||||
}
|
||||
|
||||
// Quit when all windows are closed and no other one is listening to this.
|
||||
app.on('window-all-closed', () => {
|
||||
if (app.listenerCount('window-all-closed') === 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue