Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions privacy-indicator/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Item {
property bool enableToast: cfg.enableToast ?? defaults.enableToast ?? true
property string activeColorKey: cfg.activeColor ?? defaults.activeColor ?? "primary"
property string micFilterRegex: cfg.micFilterRegex ?? defaults.micFilterRegex ?? ""
property string camFilterRegex: cfg.camFilterRegex ?? defaults.camFilterRegex ?? ""

PwObjectTracker {
objects: Pipewire.ready ? Pipewire.nodes.values : []
Expand All @@ -44,8 +45,25 @@ Item {
onStreamFinished: {
var appsString = this.text.trim();
var apps = appsString.length > 0 ? appsString.split(',') : [];
root.camApps = apps;
root.camActive = apps.length > 0;

var filterRegex = null;
if (root.camFilterRegex && root.camFilterRegex.length > 0) {
try {
filterRegex = new RegExp(root.camFilterRegex);
} catch (e) {
Logger.w("PrivacyIndicator: Invalid camFilterRegex:", root.camFilterRegex);
}
}

var appNames = [];
for (var i = 0; i < apps.length; i++) {
appName = apps[i];
if (filterRegex && appName && filterRegex.test(appName)) continue;
if (appName && appNames.indexOf(appName) === -1) appNames.push(appName);
}

root.camApps = appNames;
root.camActive = appNames.length > 0;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions privacy-indicator/Settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ColumnLayout {
property string activeColor: cfg.activeColor ?? defaults.activeColor ?? "primary"
property string inactiveColor: cfg.inactiveColor ?? defaults.inactiveColor ?? "none"
property string micFilterRegex: cfg.micFilterRegex ?? defaults.micFilterRegex
property string camFilterRegex: cfg.camFilterRegex ?? defaults.camFilterRegex

spacing: Style.marginL

Expand Down Expand Up @@ -108,6 +109,15 @@ ColumnLayout {
text: root.micFilterRegex
onTextChanged: root.micFilterRegex = text
}

NTextInput {
Layout.fillWidth: true
label: pluginApi?.tr("settings.camFilterRegex.label")
description: pluginApi?.tr("settings.camFilterRegex.desc")
placeholderText: "droidcam"
text: root.camFilterRegex
onTextChanged: root.camFilterRegex = text
}
}

function saveSettings() {
Expand Down
6 changes: 5 additions & 1 deletion privacy-indicator/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"micFilterRegex": {
"desc": "Regex pattern to filter out microphone applications. Matching apps are completely excluded from detection.",
"label": "Microphone filter regex"
},
"camFilterRegex": {
"desc": "Regex pattern to filter out camera applications. Matching apps are completely excluded from detection.",
"label": "Camera filter regex"
}
},
"tooltip": {
Expand All @@ -51,4 +55,4 @@
"stopped": "Stopped"
}
}
}
}
3 changes: 2 additions & 1 deletion privacy-indicator/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"iconSpacing": 4,
"activeColor": "primary",
"inactiveColor": "none",
"micFilterRegex": ""
"micFilterRegex": "",
"camFilterRegex": ""
}
}
}