show a notification if window rules JSON invalid
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import org.kde.kwin 3.0
|
||||
import org.kde.notification 1.0
|
||||
import "./main.js" as Karousel
|
||||
|
||||
Item {
|
||||
@@ -16,4 +17,14 @@ Item {
|
||||
qmlBase.karouselInstance.destroy();
|
||||
print("script stopped");
|
||||
}
|
||||
|
||||
Notification {
|
||||
id: notificationInvalidWindowRules
|
||||
componentName: "plasma_workspace"
|
||||
eventId: "notification"
|
||||
title: "Karousel"
|
||||
text: "Your Window Rules JSON is malformed, please review your Karousel configuration"
|
||||
flags: Notification.Persistent
|
||||
urgency: Notification.HighUrgency
|
||||
}
|
||||
}
|
||||
|
||||
1
src/extern.d.ts
vendored
1
src/extern.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
declare const qmlBase;
|
||||
declare const notificationInvalidWindowRules;
|
||||
declare const console;
|
||||
declare const KWin;
|
||||
declare const Qt;
|
||||
|
||||
@@ -15,6 +15,7 @@ class ClientManager {
|
||||
try {
|
||||
parsedWindowRules = JSON.parse(config.windowRules);
|
||||
} catch (error: any) {
|
||||
notificationInvalidWindowRules.sendEvent();
|
||||
console.log("failed to parse windowRules:", error);
|
||||
}
|
||||
this.windowRuleEnforcer = new WindowRuleEnforcer(parsedWindowRules);
|
||||
|
||||
Reference in New Issue
Block a user