3131 property bool enableToast: cfg .enableToast ?? defaults .enableToast ?? true
3232 property string activeColorKey: cfg .activeColor ?? defaults .activeColor ?? " primary"
3333 property string micFilterRegex: cfg .micFilterRegex ?? defaults .micFilterRegex ?? " "
34+ property string camFilterRegex: cfg .camFilterRegex ?? defaults .camFilterRegex ?? " "
3435
3536 PwObjectTracker {
3637 objects: Pipewire .ready ? Pipewire .nodes .values : []
@@ -44,8 +45,25 @@ Item {
4445 onStreamFinished: {
4546 var appsString = this .text .trim ();
4647 var apps = appsString .length > 0 ? appsString .split (' ,' ) : [];
47- root .camApps = apps;
48- root .camActive = apps .length > 0 ;
48+
49+ var filterRegex = null ;
50+ if (root .camFilterRegex && root .camFilterRegex .length > 0 ) {
51+ try {
52+ filterRegex = new RegExp (root .camFilterRegex );
53+ } catch (e) {
54+ Logger .w (" PrivacyIndicator: Invalid camFilterRegex:" , root .camFilterRegex );
55+ }
56+ }
57+
58+ var appNames = [];
59+ for (var i = 0 ; i < apps .length ; i++ ) {
60+ appName = apps[i];
61+ if (filterRegex && appName && filterRegex .test (appName)) continue ;
62+ if (appName && appNames .indexOf (appName) === - 1 ) appNames .push (appName);
63+ }
64+
65+ root .camApps = appNames;
66+ root .camActive = appNames .length > 0 ;
4967 }
5068 }
5169 }
@@ -265,15 +283,15 @@ Item {
265283 property bool oldMicActive: false
266284 onMicActiveChanged: {
267285 if (enableToast && micActive && ! oldMicActive) {
268- ToastService .showNotice (pluginApi? .tr (" toast.mic-on" ) || " Microphone is active " , " " , " microphone" );
286+ ToastService .showNotice (pluginApi? .tr (" toast.mic-on" ), " " , " microphone" );
269287 }
270288 oldMicActive = micActive
271289 }
272290
273291 property bool oldCamActive: false
274292 onCamActiveChanged: {
275293 if (enableToast && camActive && ! oldCamActive) {
276- ToastService .showNotice (pluginApi? .tr (" toast.cam-on" ) || " Camera is active " , " " , " camera" );
294+ ToastService .showNotice (pluginApi? .tr (" toast.cam-on" ), " " , " camera" );
277295 }
278296 oldCamActive = camActive
279297 }
@@ -285,7 +303,7 @@ Item {
285303 property bool oldScrActive: false
286304 onScrActiveChanged: {
287305 if (enableToast && scrActive && ! oldScrActive) {
288- ToastService .showNotice (pluginApi? .tr (" toast.screen-on" ) || " Screen sharing is active " , " " , " screen-share" );
306+ ToastService .showNotice (pluginApi? .tr (" toast.screen-on" ), " " , " screen-share" );
289307 }
290308 oldScrActive = scrActive
291309 }
0 commit comments