mirror of
https://github.com/edu4rdshl/Strata.git
synced 2026-07-17 23:24:46 +00:00
fix: skip excluded apps before submitting to the daemon
This commit is contained in:
parent
452fb171a6
commit
7abd247247
1 changed files with 2 additions and 21 deletions
|
|
@ -65,9 +65,6 @@ export default class StrataExtension extends Extension {
|
||||||
_excludedApps = [];
|
_excludedApps = [];
|
||||||
_pendingSignalId = null;
|
_pendingSignalId = null;
|
||||||
|
|
||||||
/** @type {boolean} Re-entrancy guard for signal processing */
|
|
||||||
_busy = false;
|
|
||||||
|
|
||||||
/** @type {Set<number>} Pending GLib.idle_add source IDs to flush on disable. */
|
/** @type {Set<number>} Pending GLib.idle_add source IDs to flush on disable. */
|
||||||
_idleSources = new Set();
|
_idleSources = new Set();
|
||||||
|
|
||||||
|
|
@ -211,6 +208,7 @@ export default class StrataExtension extends Extension {
|
||||||
// copied secrets with this hint mime. Honoring it lets users keep
|
// copied secrets with this hint mime. Honoring it lets users keep
|
||||||
// their passwords out of clipboard history.
|
// their passwords out of clipboard history.
|
||||||
if (mimes.includes('x-kde-passwordManagerHint')) return;
|
if (mimes.includes('x-kde-passwordManagerHint')) return;
|
||||||
|
if (this._isExcluded(this._currentFocusedApp)) return;
|
||||||
const mime = this._pickMime(mimes);
|
const mime = this._pickMime(mimes);
|
||||||
if (!mime) return;
|
if (!mime) return;
|
||||||
|
|
||||||
|
|
@ -518,28 +516,11 @@ export default class StrataExtension extends Extension {
|
||||||
}
|
}
|
||||||
this._pendingSignalId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 50, () => {
|
this._pendingSignalId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 50, () => {
|
||||||
this._pendingSignalId = null;
|
this._pendingSignalId = null;
|
||||||
this._processItemAdded(id, mimeType, preview)
|
this._addIdleSource(() => this._panel?.prependItem(id, mimeType, preview));
|
||||||
.catch(e => logError('ItemAdded error', e));
|
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async _processItemAdded(id, mimeType, preview) {
|
|
||||||
if (this._busy) return;
|
|
||||||
this._busy = true;
|
|
||||||
try {
|
|
||||||
if (this._isExcluded(this._currentFocusedApp)) {
|
|
||||||
try {
|
|
||||||
await this._proxy?.DeleteItemAsync(id);
|
|
||||||
} catch (_) { /* item may already be gone */ }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._addIdleSource(() => this._panel?.prependItem(id, mimeType, preview));
|
|
||||||
} finally {
|
|
||||||
this._busy = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_isExcluded(appClass) {
|
_isExcluded(appClass) {
|
||||||
if (!appClass) return false;
|
if (!appClass) return false;
|
||||||
return this._excludedApps.some(ex => appClass.includes(ex.toLowerCase()));
|
return this._excludedApps.some(ex => appClass.includes(ex.toLowerCase()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue