This commit is contained in:
2026-03-13 17:23:49 -05:00
parent 1432d75bb6
commit 381b5700bd
32 changed files with 814 additions and 424 deletions

View File

@@ -36,12 +36,12 @@ Item {
property var cfg: pluginApi?.pluginSettings || ({})
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
property bool hideInactive: cfg.hideInactive ?? defaults.hideInactive
property bool removeMargins: cfg.removeMargins ?? defaults.removeMargins
property int iconSpacing: cfg.iconSpacing || Style.marginXS
property string activeColorKey: cfg.activeColor ?? defaults.activeColor
property string inactiveColorKey: cfg.inactiveColor ?? defaults.inactiveColor
property bool hideInactive: cfg.hideInactive ?? defaults.hideInactive ?? false
property bool enableToast: cfg.enableToast ?? defaults.enableToast ?? true
property bool removeMargins: cfg.removeMargins ?? defaults.removeMargins ?? false
property int iconSpacing: cfg.iconSpacing ?? defaults.iconSpacing ?? 4
property string activeColorKey: cfg.activeColor ?? defaults.activeColor ?? "primary"
property string inactiveColorKey: cfg.inactiveColor ?? defaults.inactiveColor ?? "none"
readonly property color activeColor: Color.resolveColorKey(activeColorKey)
readonly property color inactiveColor: inactiveColorKey === "none" ? Qt.alpha(Color.mOnSurfaceVariant, 0.3) : Color.resolveColorKey(inactiveColorKey)

View File

@@ -25,6 +25,12 @@ Item {
property var _prevCamApps: []
property var _prevScrApps: []
// Get active color from settings or default
property var cfg: pluginApi?.pluginSettings || ({})
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
property bool enableToast: cfg.enableToast ?? defaults.enableToast ?? true
property string activeColorKey: cfg.activeColor ?? defaults.activeColor ?? "primary"
PwObjectTracker {
objects: Pipewire.ready ? Pipewire.nodes.values : []
}
@@ -236,10 +242,6 @@ Item {
}
}
// Get active color from settings or default
property var cfg: pluginApi?.pluginSettings || ({})
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
property string activeColorKey: cfg.activeColor ?? defaults.activeColor ?? "primary"
onMicAppsChanged: {
checkAppChanges(micApps, _prevMicApps, "Microphone", "microphone", activeColorKey);
@@ -248,7 +250,7 @@ Item {
// Helper to detect activation edge
property bool oldMicActive: false
onMicActiveChanged: {
if (micActive && (!oldMicActive)) {
if (enableToast && micActive && !oldMicActive) {
ToastService.showNotice(pluginApi?.tr("toast.mic-on") || "Microphone is active", "", "microphone");
}
oldMicActive = micActive
@@ -256,7 +258,7 @@ Item {
property bool oldCamActive: false
onCamActiveChanged: {
if (camActive && !oldCamActive) {
if (enableToast && camActive && !oldCamActive) {
ToastService.showNotice(pluginApi?.tr("toast.cam-on") || "Camera is active", "", "camera");
}
oldCamActive = camActive
@@ -268,7 +270,7 @@ Item {
property bool oldScrActive: false
onScrActiveChanged: {
if (scrActive && !oldScrActive) {
if (enableToast && scrActive && !oldScrActive) {
ToastService.showNotice(pluginApi?.tr("toast.screen-on") || "Screen sharing is active", "", "screen-share");
}
oldScrActive = scrActive

View File

@@ -11,11 +11,12 @@ ColumnLayout {
property var cfg: pluginApi?.pluginSettings || ({})
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
property bool hideInactive: cfg.hideInactive ?? defaults.hideInactive
property bool removeMargins: cfg.removeMargins ?? defaults.removeMargins
property int iconSpacing: cfg.iconSpacing || Style.marginXS
property string activeColor: cfg.activeColor ?? defaults.activeColor
property string inactiveColor: cfg.inactiveColor ?? defaults.inactiveColor
property bool hideInactive: cfg.hideInactive ?? defaults.hideInactive ?? false
property bool enableToast: cfg.enableToast ?? defaults.enableToast ?? true
property bool removeMargins: cfg.removeMargins ?? defaults.removeMargins ?? false
property int iconSpacing: cfg.iconSpacing ?? defaults.iconSpacing ?? 4
property string activeColor: cfg.activeColor ?? defaults.activeColor ?? "primary"
property string inactiveColor: cfg.inactiveColor ?? defaults.inactiveColor ?? "none"
spacing: Style.marginL
@@ -32,35 +33,45 @@ ColumnLayout {
description: pluginApi?.tr("settings.hideInactive.desc")
checked: root.hideInactive
onToggled: function (checked) {
onToggled: checked => {
root.hideInactive = checked;
}
}
NToggle {
label: pluginApi?.tr("settings.enableToast.label")
description: pluginApi?.tr("settings.enableToast.desc")
checked: root.enableToast
onToggled: checked => {
root.enableToast = checked;
}
}
NToggle {
label: pluginApi?.tr("settings.removeMargins.label")
description: pluginApi?.tr("settings.removeMargins.desc")
checked: root.removeMargins
onToggled: function (checked) {
onToggled: checked => {
root.removeMargins = checked;
}
}
NComboBox {
NColorChoice {
label: pluginApi?.tr("settings.activeColor.label")
description: pluginApi?.tr("settings.activeColor.desc")
model: Color.colorKeyModel
currentKey: root.activeColor
onSelected: key => root.activeColor = key
}
NComboBox {
NColorChoice {
label: pluginApi?.tr("settings.inactiveColor.label")
description: pluginApi?.tr("settings.inactiveColor.desc")
model: Color.colorKeyModel
currentKey: root.inactiveColor
onSelected: key => root.inactiveColor = key
noneColor: Qt.alpha(Color.mOnSurfaceVariant, 0.3)
noneOnColor: Qt.alpha(Color.mOnSurface, 0.7)
}
NComboBox {
@@ -96,6 +107,7 @@ ColumnLayout {
}
pluginApi.pluginSettings.hideInactive = root.hideInactive;
pluginApi.pluginSettings.enableToast = root.enableToast;
pluginApi.pluginSettings.iconSpacing = root.iconSpacing;
pluginApi.pluginSettings.removeMargins = root.removeMargins;
pluginApi.pluginSettings.activeColor = root.activeColor;

View File

@@ -6,11 +6,15 @@
"activeColor": {
"desc": "Color of the icons when active.",
"label": "Active icon color"
},
},
"hideInactive": {
"desc": "Hide microphone, camera, and screen icons when there are inactive.",
"label": "Hide inactive states"
},
"enableToast": {
"desc": "Show toast messages when one of the states changes.",
"label": "Enable toast notifications"
},
"inactiveColor": {
"desc": "Color of the icons when inactive.",
"label": "Inactive icon color"

View File

@@ -1,7 +1,7 @@
{
"id": "privacy-indicator",
"name": "Privacy Indicator",
"version": "1.2.4",
"version": "1.2.5",
"minNoctaliaVersion": "3.6.0",
"author": "Noctalia Team",
"official": true,
@@ -25,7 +25,9 @@
"metadata": {
"defaultSettings": {
"hideInactive": false,
"enableToast": true,
"removeMargins": false,
"iconSpacing": 4,
"activeColor": "primary",
"inactiveColor": "none"
}