diff --git a/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.test.mjs b/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.test.mjs index 0e64eb2c8..b50a83809 100644 --- a/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.test.mjs +++ b/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.test.mjs @@ -194,6 +194,38 @@ describe('LinuxPortalShortcutsManager consent', () => { }); } + for (const desktop of ['other', 'kde', 'hyprland']) { + test(`a denied bind on ${desktop} means the backend cannot bind, not a user decline`, async () => { + const harness = createHarness({consent: 'unset', desktop}); + harness.bindResults.push({outcome: 'denied'}); + await harness.manager.activate(); + await harness.manager.setUp(); + assert.equal(harness.manager.getState(), 'unsupported'); + assert.equal(harness.manager.getStatus().canRecheck, true); + assert.equal(harness.consent, 'unset'); + }); + } + + test('try again after an old stored decline on a non-GNOME desktop settles on unsupported', async () => { + const harness = createHarness({consent: 'declined', desktop: 'other'}); + harness.bindResults.push({outcome: 'denied'}); + await harness.manager.activate(); + await harness.manager.probe(); + assert.equal(harness.manager.getState(), 'declined'); + await harness.manager.setUp(); + assert.equal(harness.manager.getState(), 'unsupported'); + assert.equal(harness.consent, 'unset'); + }); + + test('a cancelled bind on KDE is still a user decline', async () => { + const harness = createHarness({consent: 'unset', desktop: 'kde'}); + harness.bindResults.push({outcome: 'cancelled'}); + await harness.manager.activate(); + await harness.manager.setUp(); + assert.equal(harness.manager.getState(), 'declined'); + assert.equal(harness.consent, 'declined'); + }); + test('a failed bind is an error that keeps consent untouched', async () => { const harness = createHarness({consent: 'unset'}); harness.bindResults.push({outcome: 'failed', code: 3}); diff --git a/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.ts b/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.ts index 51ac4a140..5326ec74b 100644 --- a/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.ts +++ b/fluxer_desktop/src/main/LinuxGlobalShortcutsPortal.ts @@ -412,8 +412,16 @@ export class LinuxPortalShortcutsManager { this.deps.setConsent('granted'); this.setState('bound', null); return; - case 'cancelled': case 'denied': + if (this.deps.desktop !== 'gnome') { + this.deps.setConsent('unset'); + this.setState('unsupported', null); + return; + } + this.deps.setConsent('declined'); + this.setState('declined', null); + return; + case 'cancelled': this.deps.setConsent('declined'); this.setState('declined', null); return;