[gnome] Update extensions

This commit is contained in:
2026-04-09 09:51:44 -04:00
parent dadc78f2f4
commit 505c67d292
61 changed files with 1729 additions and 365 deletions

View File

@ -14,6 +14,14 @@ function getObjectLabel(name, values) {
.map(([label, value]) => `${label}: '${value}'`);
return `${name}(${labels.join(", ")})`;
}
function safeRegexTest(pattern, value) {
try {
return new RegExp(pattern).test(value);
}
catch {
return null;
}
}
function getWindowLabel(window) {
return getObjectLabel("Window", {
["Title"]: window.title,
@ -46,7 +54,11 @@ export default class JunkNotificationCleaner extends Extension {
this.log(LogLevel.DEBUG, `${windowLabel}: received ${event}`);
const excludedApps = this.settings.get_strv("excluded-apps");
for (const wmClassPattern of excludedApps) {
if (new RegExp(wmClassPattern).test(window.wmClass)) {
const result = safeRegexTest(wmClassPattern, window.wmClass);
if (result === null) {
this.log(LogLevel.WARN, `${windowLabel}: invalid regex '${wmClassPattern}'`);
}
else if (result) {
this.log(LogLevel.DEBUG, `${windowLabel}: excluded by '${wmClassPattern}'`);
return;
}
@ -78,9 +90,11 @@ export default class JunkNotificationCleaner extends Extension {
disable() {
if (this.focusListenerId !== null) {
global.display.disconnect(this.focusListenerId);
this.focusListenerId = null;
}
if (this.closeListenerId !== null) {
global.window_manager.disconnect(this.closeListenerId);
this.closeListenerId = null;
}
if (this.settings) {
this.settings = null;