mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
dankbar/controlcenter: add VPN, mic, brightness, battery, and printer
options for widget
This commit is contained in:
@@ -105,6 +105,11 @@ Singleton {
|
|||||||
property bool controlCenterShowNetworkIcon: true
|
property bool controlCenterShowNetworkIcon: true
|
||||||
property bool controlCenterShowBluetoothIcon: true
|
property bool controlCenterShowBluetoothIcon: true
|
||||||
property bool controlCenterShowAudioIcon: true
|
property bool controlCenterShowAudioIcon: true
|
||||||
|
property bool controlCenterShowVpnIcon: false
|
||||||
|
property bool controlCenterShowBrightnessIcon: false
|
||||||
|
property bool controlCenterShowMicIcon: false
|
||||||
|
property bool controlCenterShowBatteryIcon: false
|
||||||
|
property bool controlCenterShowPrinterIcon: false
|
||||||
property bool showPrivacyButton: true
|
property bool showPrivacyButton: true
|
||||||
property bool privacyShowMicIcon: false
|
property bool privacyShowMicIcon: false
|
||||||
property bool privacyShowCameraIcon: false
|
property bool privacyShowCameraIcon: false
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ var SPEC = {
|
|||||||
controlCenterShowNetworkIcon: { def: true },
|
controlCenterShowNetworkIcon: { def: true },
|
||||||
controlCenterShowBluetoothIcon: { def: true },
|
controlCenterShowBluetoothIcon: { def: true },
|
||||||
controlCenterShowAudioIcon: { def: true },
|
controlCenterShowAudioIcon: { def: true },
|
||||||
|
controlCenterShowVpnIcon: { def: false },
|
||||||
|
controlCenterShowBrightnessIcon: { def: false },
|
||||||
|
controlCenterShowMicIcon: { def: false },
|
||||||
|
controlCenterShowBatteryIcon: { def: false },
|
||||||
|
controlCenterShowPrinterIcon: { def: false },
|
||||||
|
|
||||||
showPrivacyButton: { def: true },
|
showPrivacyButton: { def: true },
|
||||||
privacyShowMicIcon: { def: false },
|
privacyShowMicIcon: { def: false },
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import QtQuick
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Modules.ControlCenter.Details
|
import qs.Modules.ControlCenter.Details
|
||||||
import qs.Modules.ControlCenter.Models
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -11,17 +10,21 @@ Item {
|
|||||||
property var expandedWidgetData: null
|
property var expandedWidgetData: null
|
||||||
property var bluetoothCodecSelector: null
|
property var bluetoothCodecSelector: null
|
||||||
property string screenName: ""
|
property string screenName: ""
|
||||||
|
property string screenModel: ""
|
||||||
|
|
||||||
property var pluginDetailInstance: null
|
property var pluginDetailInstance: null
|
||||||
property var widgetModel: null
|
property var widgetModel: null
|
||||||
property var collapseCallback: null
|
property var collapseCallback: null
|
||||||
|
|
||||||
function getDetailHeight(section) {
|
function getDetailHeight(section) {
|
||||||
const maxAvailable = parent ? parent.height - Theme.spacingS : 9999
|
const maxAvailable = parent ? parent.height - Theme.spacingS : 9999;
|
||||||
if (section === "wifi") return Math.min(350, maxAvailable)
|
if (section === "wifi")
|
||||||
if (section === "bluetooth") return Math.min(350, maxAvailable)
|
return Math.min(350, maxAvailable);
|
||||||
if (section.startsWith("brightnessSlider_")) return Math.min(400, maxAvailable)
|
if (section === "bluetooth")
|
||||||
return Math.min(250, maxAvailable)
|
return Math.min(350, maxAvailable);
|
||||||
|
if (section.startsWith("brightnessSlider_"))
|
||||||
|
return Math.min(400, maxAvailable);
|
||||||
|
return Math.min(250, maxAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
@@ -49,18 +52,18 @@ Item {
|
|||||||
|
|
||||||
function onDeviceNameChanged(newDeviceName) {
|
function onDeviceNameChanged(newDeviceName) {
|
||||||
if (root.expandedWidgetData && root.expandedWidgetData.id === "brightnessSlider") {
|
if (root.expandedWidgetData && root.expandedWidgetData.id === "brightnessSlider") {
|
||||||
const widgets = SettingsData.controlCenterWidgets || []
|
const widgets = SettingsData.controlCenterWidgets || [];
|
||||||
const newWidgets = widgets.map(w => {
|
const newWidgets = widgets.map(w => {
|
||||||
if (w.id === "brightnessSlider" && w.instanceId === root.expandedWidgetData.instanceId) {
|
if (w.id === "brightnessSlider" && w.instanceId === root.expandedWidgetData.instanceId) {
|
||||||
const updatedWidget = Object.assign({}, w)
|
const updatedWidget = Object.assign({}, w);
|
||||||
updatedWidget.deviceName = newDeviceName
|
updatedWidget.deviceName = newDeviceName;
|
||||||
return updatedWidget
|
return updatedWidget;
|
||||||
}
|
}
|
||||||
return w
|
return w;
|
||||||
})
|
});
|
||||||
SettingsData.set("controlCenterWidgets", newWidgets)
|
SettingsData.set("controlCenterWidgets", newWidgets);
|
||||||
if (root.collapseCallback) {
|
if (root.collapseCallback) {
|
||||||
root.collapseCallback()
|
root.collapseCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,18 +76,18 @@ Item {
|
|||||||
|
|
||||||
function onMountPathChanged(newMountPath) {
|
function onMountPathChanged(newMountPath) {
|
||||||
if (root.expandedWidgetData && root.expandedWidgetData.id === "diskUsage") {
|
if (root.expandedWidgetData && root.expandedWidgetData.id === "diskUsage") {
|
||||||
const widgets = SettingsData.controlCenterWidgets || []
|
const widgets = SettingsData.controlCenterWidgets || [];
|
||||||
const newWidgets = widgets.map(w => {
|
const newWidgets = widgets.map(w => {
|
||||||
if (w.id === "diskUsage" && w.instanceId === root.expandedWidgetData.instanceId) {
|
if (w.id === "diskUsage" && w.instanceId === root.expandedWidgetData.instanceId) {
|
||||||
const updatedWidget = Object.assign({}, w)
|
const updatedWidget = Object.assign({}, w);
|
||||||
updatedWidget.mountPath = newMountPath
|
updatedWidget.mountPath = newMountPath;
|
||||||
return updatedWidget
|
return updatedWidget;
|
||||||
}
|
}
|
||||||
return w
|
return w;
|
||||||
})
|
});
|
||||||
SettingsData.set("controlCenterWidgets", newWidgets)
|
SettingsData.set("controlCenterWidgets", newWidgets);
|
||||||
if (root.collapseCallback) {
|
if (root.collapseCallback) {
|
||||||
root.collapseCallback()
|
root.collapseCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,86 +95,97 @@ Item {
|
|||||||
|
|
||||||
onExpandedSectionChanged: {
|
onExpandedSectionChanged: {
|
||||||
if (pluginDetailInstance) {
|
if (pluginDetailInstance) {
|
||||||
pluginDetailInstance.destroy()
|
pluginDetailInstance.destroy();
|
||||||
pluginDetailInstance = null
|
pluginDetailInstance = null;
|
||||||
}
|
}
|
||||||
pluginDetailLoader.active = false
|
pluginDetailLoader.active = false;
|
||||||
coreDetailLoader.active = false
|
coreDetailLoader.active = false;
|
||||||
|
|
||||||
if (!root.expandedSection) {
|
if (!root.expandedSection) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.expandedSection.startsWith("builtin_")) {
|
if (root.expandedSection.startsWith("builtin_")) {
|
||||||
const builtinId = root.expandedSection
|
const builtinId = root.expandedSection;
|
||||||
let builtinInstance = null
|
let builtinInstance = null;
|
||||||
|
|
||||||
if (builtinId === "builtin_vpn") {
|
if (builtinId === "builtin_vpn") {
|
||||||
if (widgetModel?.vpnLoader) {
|
if (widgetModel?.vpnLoader) {
|
||||||
widgetModel.vpnLoader.active = true
|
widgetModel.vpnLoader.active = true;
|
||||||
}
|
}
|
||||||
builtinInstance = widgetModel.vpnBuiltinInstance
|
builtinInstance = widgetModel.vpnBuiltinInstance;
|
||||||
}
|
}
|
||||||
if (builtinId === "builtin_cups") {
|
if (builtinId === "builtin_cups") {
|
||||||
if (widgetModel?.cupsLoader) {
|
if (widgetModel?.cupsLoader) {
|
||||||
widgetModel.cupsLoader.active = true
|
widgetModel.cupsLoader.active = true;
|
||||||
}
|
}
|
||||||
builtinInstance = widgetModel.cupsBuiltinInstance
|
builtinInstance = widgetModel.cupsBuiltinInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!builtinInstance || !builtinInstance.ccDetailContent) {
|
if (!builtinInstance || !builtinInstance.ccDetailContent) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginDetailLoader.sourceComponent = builtinInstance.ccDetailContent
|
pluginDetailLoader.sourceComponent = builtinInstance.ccDetailContent;
|
||||||
pluginDetailLoader.active = parent.height > 0
|
pluginDetailLoader.active = parent.height > 0;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.expandedSection.startsWith("plugin_")) {
|
if (root.expandedSection.startsWith("plugin_")) {
|
||||||
const pluginId = root.expandedSection.replace("plugin_", "")
|
const pluginId = root.expandedSection.replace("plugin_", "");
|
||||||
const pluginComponent = PluginService.pluginWidgetComponents[pluginId]
|
const pluginComponent = PluginService.pluginWidgetComponents[pluginId];
|
||||||
if (!pluginComponent) {
|
if (!pluginComponent) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginDetailInstance = pluginComponent.createObject(null)
|
pluginDetailInstance = pluginComponent.createObject(null);
|
||||||
if (!pluginDetailInstance || !pluginDetailInstance.ccDetailContent) {
|
if (!pluginDetailInstance || !pluginDetailInstance.ccDetailContent) {
|
||||||
if (pluginDetailInstance) {
|
if (pluginDetailInstance) {
|
||||||
pluginDetailInstance.destroy()
|
pluginDetailInstance.destroy();
|
||||||
pluginDetailInstance = null
|
pluginDetailInstance = null;
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginDetailLoader.sourceComponent = pluginDetailInstance.ccDetailContent
|
pluginDetailLoader.sourceComponent = pluginDetailInstance.ccDetailContent;
|
||||||
pluginDetailLoader.active = parent.height > 0
|
pluginDetailLoader.active = parent.height > 0;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.expandedSection.startsWith("diskUsage_")) {
|
if (root.expandedSection.startsWith("diskUsage_")) {
|
||||||
coreDetailLoader.sourceComponent = diskUsageDetailComponent
|
coreDetailLoader.sourceComponent = diskUsageDetailComponent;
|
||||||
coreDetailLoader.active = parent.height > 0
|
coreDetailLoader.active = parent.height > 0;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.expandedSection.startsWith("brightnessSlider_")) {
|
if (root.expandedSection.startsWith("brightnessSlider_")) {
|
||||||
coreDetailLoader.sourceComponent = brightnessDetailComponent
|
coreDetailLoader.sourceComponent = brightnessDetailComponent;
|
||||||
coreDetailLoader.active = parent.height > 0
|
coreDetailLoader.active = parent.height > 0;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (root.expandedSection) {
|
switch (root.expandedSection) {
|
||||||
case "network":
|
case "network":
|
||||||
case "wifi": coreDetailLoader.sourceComponent = networkDetailComponent; break
|
case "wifi":
|
||||||
case "bluetooth": coreDetailLoader.sourceComponent = bluetoothDetailComponent; break
|
coreDetailLoader.sourceComponent = networkDetailComponent;
|
||||||
case "audioOutput": coreDetailLoader.sourceComponent = audioOutputDetailComponent; break
|
break;
|
||||||
case "audioInput": coreDetailLoader.sourceComponent = audioInputDetailComponent; break
|
case "bluetooth":
|
||||||
case "battery": coreDetailLoader.sourceComponent = batteryDetailComponent; break
|
coreDetailLoader.sourceComponent = bluetoothDetailComponent;
|
||||||
default: return
|
break;
|
||||||
|
case "audioOutput":
|
||||||
|
coreDetailLoader.sourceComponent = audioOutputDetailComponent;
|
||||||
|
break;
|
||||||
|
case "audioInput":
|
||||||
|
coreDetailLoader.sourceComponent = audioInputDetailComponent;
|
||||||
|
break;
|
||||||
|
case "battery":
|
||||||
|
coreDetailLoader.sourceComponent = batteryDetailComponent;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
coreDetailLoader.active = parent.height > 0
|
coreDetailLoader.active = parent.height > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -183,12 +197,12 @@ Item {
|
|||||||
id: bluetoothDetailComponent
|
id: bluetoothDetailComponent
|
||||||
BluetoothDetail {
|
BluetoothDetail {
|
||||||
id: bluetoothDetail
|
id: bluetoothDetail
|
||||||
onShowCodecSelector: function(device) {
|
onShowCodecSelector: function (device) {
|
||||||
if (root.bluetoothCodecSelector) {
|
if (root.bluetoothCodecSelector) {
|
||||||
root.bluetoothCodecSelector.show(device)
|
root.bluetoothCodecSelector.show(device);
|
||||||
root.bluetoothCodecSelector.codecSelected.connect(function(deviceAddress, codecName) {
|
root.bluetoothCodecSelector.codecSelected.connect(function (deviceAddress, codecName) {
|
||||||
bluetoothDetail.updateDeviceCodecDisplay(deviceAddress, codecName)
|
bluetoothDetail.updateDeviceCodecDisplay(deviceAddress, codecName);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +237,7 @@ Item {
|
|||||||
initialDeviceName: root.expandedWidgetData?.deviceName || ""
|
initialDeviceName: root.expandedWidgetData?.deviceName || ""
|
||||||
instanceId: root.expandedWidgetData?.instanceId || ""
|
instanceId: root.expandedWidgetData?.instanceId || ""
|
||||||
screenName: root.screenName
|
screenName: root.screenName
|
||||||
|
screenModel: root.screenModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -82,6 +82,7 @@ DankPopout {
|
|||||||
|
|
||||||
onShouldBeVisibleChanged: {
|
onShouldBeVisibleChanged: {
|
||||||
if (shouldBeVisible) {
|
if (shouldBeVisible) {
|
||||||
|
collapseAll();
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (NetworkService.activeService) {
|
if (NetworkService.activeService) {
|
||||||
NetworkService.activeService.autoRefreshEnabled = NetworkService.wifiEnabled;
|
NetworkService.activeService.autoRefreshEnabled = NetworkService.wifiEnabled;
|
||||||
@@ -179,6 +180,7 @@ DankPopout {
|
|||||||
bluetoothCodecSelector: bluetoothCodecSelector
|
bluetoothCodecSelector: bluetoothCodecSelector
|
||||||
colorPickerModal: root.colorPickerModal
|
colorPickerModal: root.colorPickerModal
|
||||||
screenName: root.triggerScreen?.name || ""
|
screenName: root.triggerScreen?.name || ""
|
||||||
|
screenModel: root.triggerScreen?.model || ""
|
||||||
parentScreen: root.triggerScreen
|
parentScreen: root.triggerScreen
|
||||||
onExpandClicked: (widgetData, globalIndex) => {
|
onExpandClicked: (widgetData, globalIndex) => {
|
||||||
root.expandedWidgetIndex = globalIndex;
|
root.expandedWidgetIndex = globalIndex;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.Pipewire
|
import Quickshell.Services.Pipewire
|
||||||
import qs.Common
|
import qs.Common
|
||||||
@@ -10,8 +9,8 @@ Rectangle {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool hasInputVolumeSliderInCC: {
|
property bool hasInputVolumeSliderInCC: {
|
||||||
const widgets = SettingsData.controlCenterWidgets || []
|
const widgets = SettingsData.controlCenterWidgets || [];
|
||||||
return widgets.some(widget => widget.id === "inputVolumeSlider")
|
return widgets.some(widget => widget.id === "inputVolumeSlider");
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: headerRow.height + (hasInputVolumeSliderInCC ? 0 : volumeSlider.height) + audioContent.height + Theme.spacingM
|
implicitHeight: headerRow.height + (hasInputVolumeSliderInCC ? 0 : volumeSlider.height) + audioContent.height + Theme.spacingM
|
||||||
@@ -66,7 +65,7 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (AudioService.source && AudioService.source.audio) {
|
if (AudioService.source && AudioService.source.audio) {
|
||||||
AudioService.source.audio.muted = !AudioService.source.audio.muted
|
AudioService.source.audio.muted = !AudioService.source.audio.muted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,9 +73,10 @@ Rectangle {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
name: {
|
name: {
|
||||||
if (!AudioService.source || !AudioService.source.audio) return "mic_off"
|
if (!AudioService.source || !AudioService.source.audio)
|
||||||
let muted = AudioService.source.audio.muted
|
return "mic_off";
|
||||||
return muted ? "mic_off" : "mic"
|
let muted = AudioService.source.audio.muted;
|
||||||
|
return muted ? "mic_off" : "mic";
|
||||||
}
|
}
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
color: AudioService.source && AudioService.source.audio && !AudioService.source.audio.muted && AudioService.source.audio.volume > 0 ? Theme.primary : Theme.surfaceText
|
color: AudioService.source && AudioService.source.audio && !AudioService.source.audio.muted && AudioService.source.audio.volume > 0 ? Theme.primary : Theme.surfaceText
|
||||||
@@ -97,11 +97,11 @@ Rectangle {
|
|||||||
valueOverride: actualVolumePercent
|
valueOverride: actualVolumePercent
|
||||||
thumbOutlineColor: Theme.surfaceVariant
|
thumbOutlineColor: Theme.surfaceVariant
|
||||||
|
|
||||||
onSliderValueChanged: function(newValue) {
|
onSliderValueChanged: function (newValue) {
|
||||||
if (AudioService.source && AudioService.source.audio) {
|
if (AudioService.source && AudioService.source.audio) {
|
||||||
AudioService.source.audio.volume = newValue / 100
|
AudioService.source.audio.volume = newValue / 100;
|
||||||
if (newValue > 0 && AudioService.source.audio.muted) {
|
if (newValue > 0 && AudioService.source.audio.muted) {
|
||||||
AudioService.source.audio.muted = false
|
AudioService.source.audio.muted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,22 +128,26 @@ Rectangle {
|
|||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: {
|
values: {
|
||||||
const nodes = Pipewire.nodes.values.filter(node => {
|
const nodes = Pipewire.nodes.values.filter(node => {
|
||||||
return node.audio && !node.isSink && !node.isStream
|
return node.audio && !node.isSink && !node.isStream;
|
||||||
})
|
});
|
||||||
const pins = SettingsData.audioInputDevicePins || {}
|
const pins = SettingsData.audioInputDevicePins || {};
|
||||||
const pinnedName = pins["preferredInput"]
|
const pinnedName = pins["preferredInput"];
|
||||||
|
|
||||||
let sorted = [...nodes]
|
let sorted = [...nodes];
|
||||||
sorted.sort((a, b) => {
|
sorted.sort((a, b) => {
|
||||||
// Pinned device first
|
// Pinned device first
|
||||||
if (a.name === pinnedName && b.name !== pinnedName) return -1
|
if (a.name === pinnedName && b.name !== pinnedName)
|
||||||
if (b.name === pinnedName && a.name !== pinnedName) return 1
|
return -1;
|
||||||
|
if (b.name === pinnedName && a.name !== pinnedName)
|
||||||
|
return 1;
|
||||||
// Then active device
|
// Then active device
|
||||||
if (a === AudioService.source && b !== AudioService.source) return -1
|
if (a === AudioService.source && b !== AudioService.source)
|
||||||
if (b === AudioService.source && a !== AudioService.source) return 1
|
return -1;
|
||||||
return 0
|
if (b === AudioService.source && a !== AudioService.source)
|
||||||
})
|
return 1;
|
||||||
return sorted
|
return 0;
|
||||||
|
});
|
||||||
|
return sorted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,11 +171,11 @@ Rectangle {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
name: {
|
name: {
|
||||||
if (modelData.name.includes("bluez"))
|
if (modelData.name.includes("bluez"))
|
||||||
return "headset"
|
return "headset";
|
||||||
else if (modelData.name.includes("usb"))
|
else if (modelData.name.includes("usb"))
|
||||||
return "headset"
|
return "headset";
|
||||||
else
|
else
|
||||||
return "mic"
|
return "mic";
|
||||||
}
|
}
|
||||||
size: Theme.iconSize - 4
|
size: Theme.iconSize - 4
|
||||||
color: modelData === AudioService.source ? Theme.primary : Theme.surfaceText
|
color: modelData === AudioService.source ? Theme.primary : Theme.surfaceText
|
||||||
@@ -181,9 +185,9 @@ Rectangle {
|
|||||||
Column {
|
Column {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: {
|
width: {
|
||||||
const iconWidth = Theme.iconSize
|
const iconWidth = Theme.iconSize;
|
||||||
const pinButtonWidth = pinInputRow.width + Theme.spacingS * 4 + Theme.spacingM
|
const pinButtonWidth = pinInputRow.width + Theme.spacingS * 4 + Theme.spacingM;
|
||||||
return parent.parent.width - iconWidth - parent.spacing - pinButtonWidth - Theme.spacingM * 2
|
return parent.parent.width - iconWidth - parent.spacing - pinButtonWidth - Theme.spacingM * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -215,8 +219,8 @@ Rectangle {
|
|||||||
height: 28
|
height: 28
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
color: {
|
color: {
|
||||||
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name
|
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
|
||||||
return isThisDevicePinned ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Theme.withAlpha(Theme.surfaceText, 0.05)
|
return isThisDevicePinned ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Theme.withAlpha(Theme.surfaceText, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -228,21 +232,21 @@ Rectangle {
|
|||||||
name: "push_pin"
|
name: "push_pin"
|
||||||
size: 16
|
size: 16
|
||||||
color: {
|
color: {
|
||||||
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name
|
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
|
||||||
return isThisDevicePinned ? Theme.primary : Theme.surfaceText
|
return isThisDevicePinned ? Theme.primary : Theme.surfaceText;
|
||||||
}
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name
|
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
|
||||||
return isThisDevicePinned ? "Pinned" : "Pin"
|
return isThisDevicePinned ? "Pinned" : "Pin";
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: {
|
color: {
|
||||||
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name
|
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
|
||||||
return isThisDevicePinned ? Theme.primary : Theme.surfaceText
|
return isThisDevicePinned ? Theme.primary : Theme.surfaceText;
|
||||||
}
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
@@ -252,16 +256,16 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.audioInputDevicePins || {}))
|
const pins = JSON.parse(JSON.stringify(SettingsData.audioInputDevicePins || {}));
|
||||||
const isCurrentlyPinned = pins["preferredInput"] === modelData.name
|
const isCurrentlyPinned = pins["preferredInput"] === modelData.name;
|
||||||
|
|
||||||
if (isCurrentlyPinned) {
|
if (isCurrentlyPinned) {
|
||||||
delete pins["preferredInput"]
|
delete pins["preferredInput"];
|
||||||
} else {
|
} else {
|
||||||
pins["preferredInput"] = modelData.name
|
pins["preferredInput"] = modelData.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsData.set("audioInputDevicePins", pins)
|
SettingsData.set("audioInputDevicePins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,7 +278,7 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (modelData) {
|
if (modelData) {
|
||||||
Pipewire.preferredDefaultAudioSource = modelData
|
Pipewire.preferredDefaultAudioSource = modelData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,4 +286,4 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import Quickshell
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
@@ -11,88 +9,91 @@ Rectangle {
|
|||||||
property string initialDeviceName: ""
|
property string initialDeviceName: ""
|
||||||
property string instanceId: ""
|
property string instanceId: ""
|
||||||
property string screenName: ""
|
property string screenName: ""
|
||||||
|
property string screenModel: ""
|
||||||
|
|
||||||
signal deviceNameChanged(string newDeviceName)
|
signal deviceNameChanged(string newDeviceName)
|
||||||
|
|
||||||
property string currentDeviceName: ""
|
property string currentDeviceName: ""
|
||||||
|
|
||||||
|
function getScreenPinKey() {
|
||||||
|
if (SettingsData.displayNameMode === "model" && screenModel && screenModel.length > 0) {
|
||||||
|
return screenModel;
|
||||||
|
}
|
||||||
|
return screenName || "";
|
||||||
|
}
|
||||||
|
|
||||||
function resolveDeviceName() {
|
function resolveDeviceName() {
|
||||||
if (!DisplayService.brightnessAvailable || !DisplayService.devices || DisplayService.devices.length === 0) {
|
if (!DisplayService.brightnessAvailable || !DisplayService.devices || DisplayService.devices.length === 0) {
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screenName && screenName.length > 0) {
|
const pinKey = getScreenPinKey();
|
||||||
const pins = SettingsData.brightnessDevicePins || {}
|
if (pinKey.length > 0) {
|
||||||
const pinnedDevice = pins[screenName]
|
const pins = SettingsData.brightnessDevicePins || {};
|
||||||
|
const pinnedDevice = pins[pinKey];
|
||||||
if (pinnedDevice && pinnedDevice.length > 0) {
|
if (pinnedDevice && pinnedDevice.length > 0) {
|
||||||
const found = DisplayService.devices.find(dev => dev.name === pinnedDevice)
|
const found = DisplayService.devices.find(dev => dev.name === pinnedDevice);
|
||||||
if (found) {
|
if (found)
|
||||||
return found.name
|
return found.name;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialDeviceName && initialDeviceName.length > 0) {
|
if (initialDeviceName && initialDeviceName.length > 0) {
|
||||||
const found = DisplayService.devices.find(dev => dev.name === initialDeviceName)
|
const found = DisplayService.devices.find(dev => dev.name === initialDeviceName);
|
||||||
if (found) {
|
if (found)
|
||||||
return found.name
|
return found.name;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentDeviceNameFromService = DisplayService.currentDevice
|
const currentDeviceNameFromService = DisplayService.currentDevice;
|
||||||
if (currentDeviceNameFromService) {
|
if (currentDeviceNameFromService) {
|
||||||
const found = DisplayService.devices.find(dev => dev.name === currentDeviceNameFromService)
|
const found = DisplayService.devices.find(dev => dev.name === currentDeviceNameFromService);
|
||||||
if (found) {
|
if (found)
|
||||||
return found.name
|
return found.name;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const backlight = DisplayService.devices.find(d => d.class === "backlight")
|
const backlight = DisplayService.devices.find(d => d.class === "backlight");
|
||||||
if (backlight) {
|
if (backlight)
|
||||||
return backlight.name
|
return backlight.name;
|
||||||
}
|
|
||||||
|
|
||||||
const ddc = DisplayService.devices.find(d => d.class === "ddc")
|
const ddc = DisplayService.devices.find(d => d.class === "ddc");
|
||||||
if (ddc) {
|
if (ddc)
|
||||||
return ddc.name
|
return ddc.name;
|
||||||
}
|
|
||||||
|
|
||||||
return DisplayService.devices.length > 0 ? DisplayService.devices[0].name : ""
|
return DisplayService.devices.length > 0 ? DisplayService.devices[0].name : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
currentDeviceName = resolveDeviceName()
|
currentDeviceName = resolveDeviceName();
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool isPinnedToScreen: {
|
property bool isPinnedToScreen: {
|
||||||
if (!screenName || screenName.length === 0) {
|
const pinKey = getScreenPinKey();
|
||||||
return false
|
if (!pinKey || pinKey.length === 0)
|
||||||
}
|
return false;
|
||||||
const pins = SettingsData.brightnessDevicePins || {}
|
const pins = SettingsData.brightnessDevicePins || {};
|
||||||
return pins[screenName] === currentDeviceName
|
return pins[pinKey] === currentDeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePinToScreen() {
|
function togglePinToScreen() {
|
||||||
if (!screenName || screenName.length === 0 || !currentDeviceName || currentDeviceName.length === 0) {
|
const pinKey = getScreenPinKey();
|
||||||
return
|
if (!pinKey || pinKey.length === 0 || !currentDeviceName || currentDeviceName.length === 0)
|
||||||
}
|
return;
|
||||||
|
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}));
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}))
|
|
||||||
|
|
||||||
if (isPinnedToScreen) {
|
if (isPinnedToScreen) {
|
||||||
delete pins[screenName]
|
delete pins[pinKey];
|
||||||
} else {
|
} else {
|
||||||
pins[screenName] = currentDeviceName
|
pins[pinKey] = currentDeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsData.set("brightnessDevicePins", pins)
|
SettingsData.set("brightnessDevicePins", pins);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
if (height > 0) {
|
if (height > 0) {
|
||||||
return height
|
return height;
|
||||||
}
|
}
|
||||||
return brightnessContent.height + Theme.spacingM
|
return brightnessContent.height + Theme.spacingM;
|
||||||
}
|
}
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
@@ -165,7 +166,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: screenName || "Unknown Monitor"
|
text: root.getScreenPinKey() || "Unknown Monitor"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -216,8 +217,8 @@ Rectangle {
|
|||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
property real deviceBrightness: {
|
property real deviceBrightness: {
|
||||||
DisplayService.brightnessVersion
|
DisplayService.brightnessVersion;
|
||||||
return DisplayService.getDeviceBrightness(modelData.name)
|
return DisplayService.getDeviceBrightness(modelData.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -248,19 +249,19 @@ Rectangle {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: {
|
name: {
|
||||||
const deviceClass = modelData.class || ""
|
const deviceClass = modelData.class || "";
|
||||||
const deviceName = modelData.name || ""
|
const deviceName = modelData.name || "";
|
||||||
|
|
||||||
if (deviceClass === "backlight" || deviceClass === "ddc") {
|
if (deviceClass === "backlight" || deviceClass === "ddc") {
|
||||||
if (deviceBrightness <= 33)
|
if (deviceBrightness <= 33)
|
||||||
return "brightness_low"
|
return "brightness_low";
|
||||||
if (deviceBrightness <= 66)
|
if (deviceBrightness <= 66)
|
||||||
return "brightness_medium"
|
return "brightness_medium";
|
||||||
return "brightness_high"
|
return "brightness_high";
|
||||||
} else if (deviceName.includes("kbd")) {
|
} else if (deviceName.includes("kbd")) {
|
||||||
return "keyboard"
|
return "keyboard";
|
||||||
} else {
|
} else {
|
||||||
return "lightbulb"
|
return "lightbulb";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
@@ -283,12 +284,12 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
const name = modelData.name || ""
|
const name = modelData.name || "";
|
||||||
const deviceClass = modelData.class || ""
|
const deviceClass = modelData.class || "";
|
||||||
if (deviceClass === "backlight") {
|
if (deviceClass === "backlight") {
|
||||||
return name.replace("_", " ").replace(/\b\w/g, c => c.toUpperCase())
|
return name.replace("_", " ").replace(/\b\w/g, c => c.toUpperCase());
|
||||||
}
|
}
|
||||||
return name
|
return name;
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -307,14 +308,14 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
const deviceClass = modelData.class || ""
|
const deviceClass = modelData.class || "";
|
||||||
if (deviceClass === "backlight")
|
if (deviceClass === "backlight")
|
||||||
return "Backlight device"
|
return "Backlight device";
|
||||||
if (deviceClass === "ddc")
|
if (deviceClass === "ddc")
|
||||||
return "DDC/CI monitor"
|
return "DDC/CI monitor";
|
||||||
if (deviceClass === "leds")
|
if (deviceClass === "leds")
|
||||||
return "LED device"
|
return "LED device";
|
||||||
return deviceClass
|
return deviceClass;
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
@@ -353,9 +354,9 @@ Rectangle {
|
|||||||
cornerRadius: parent.radius
|
cornerRadius: parent.radius
|
||||||
enabled: SessionData.getBrightnessExponent(modelData.name) > 1.0
|
enabled: SessionData.getBrightnessExponent(modelData.name) > 1.0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const current = SessionData.getBrightnessExponent(modelData.name)
|
const current = SessionData.getBrightnessExponent(modelData.name);
|
||||||
const newValue = Math.max(1.0, Math.round((current - 0.1) * 10) / 10)
|
const newValue = Math.max(1.0, Math.round((current - 0.1) * 10) / 10);
|
||||||
SessionData.setBrightnessExponent(modelData.name, newValue)
|
SessionData.setBrightnessExponent(modelData.name, newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,9 +396,9 @@ Rectangle {
|
|||||||
cornerRadius: parent.radius
|
cornerRadius: parent.radius
|
||||||
enabled: SessionData.getBrightnessExponent(modelData.name) < 2.5
|
enabled: SessionData.getBrightnessExponent(modelData.name) < 2.5
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const current = SessionData.getBrightnessExponent(modelData.name)
|
const current = SessionData.getBrightnessExponent(modelData.name);
|
||||||
const newValue = Math.min(2.5, Math.round((current + 0.1) * 10) / 10)
|
const newValue = Math.min(2.5, Math.round((current + 0.1) * 10) / 10);
|
||||||
SessionData.setBrightnessExponent(modelData.name, newValue)
|
SessionData.setBrightnessExponent(modelData.name, newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,8 +434,8 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const currentState = SessionData.getBrightnessExponential(modelData.name)
|
const currentState = SessionData.getBrightnessExponential(modelData.name);
|
||||||
SessionData.setBrightnessExponential(modelData.name, !currentState)
|
SessionData.setBrightnessExponential(modelData.name, !currentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,15 +448,16 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (screenName && screenName.length > 0 && modelData.name !== currentDeviceName) {
|
const pinKey = root.getScreenPinKey();
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}))
|
if (pinKey.length > 0 && modelData.name !== currentDeviceName) {
|
||||||
if (pins[screenName]) {
|
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}));
|
||||||
delete pins[screenName]
|
if (pins[pinKey]) {
|
||||||
SettingsData.set("brightnessDevicePins", pins)
|
delete pins[pinKey];
|
||||||
|
SettingsData.set("brightnessDevicePins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentDeviceName = modelData.name
|
currentDeviceName = modelData.name;
|
||||||
deviceNameChanged(modelData.name)
|
deviceNameChanged(modelData.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,17 +17,17 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onItemChanged: {
|
onItemChanged: {
|
||||||
root.vpnBuiltinInstance = item
|
root.vpnBuiltinInstance = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SettingsData
|
target: SettingsData
|
||||||
function onControlCenterWidgetsChanged() {
|
function onControlCenterWidgetsChanged() {
|
||||||
const widgets = SettingsData.controlCenterWidgets || []
|
const widgets = SettingsData.controlCenterWidgets || [];
|
||||||
const hasVpnWidget = widgets.some(w => w.id === "builtin_vpn")
|
const hasVpnWidget = widgets.some(w => w.id === "builtin_vpn");
|
||||||
if (!hasVpnWidget && vpnLoader.active) {
|
if (!hasVpnWidget && vpnLoader.active) {
|
||||||
console.log("VpnWidget: No VPN widget in control center, deactivating loader")
|
console.log("VpnWidget: No VPN widget in control center, deactivating loader");
|
||||||
vpnLoader.active = false
|
vpnLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,35 +40,36 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onItemChanged: {
|
onItemChanged: {
|
||||||
root.cupsBuiltinInstance = item
|
root.cupsBuiltinInstance = item;
|
||||||
if (item && !DMSService.activeSubscriptions.includes("cups") && !DMSService.activeSubscriptions.includes("all")) {
|
if (item && !DMSService.activeSubscriptions.includes("cups") && !DMSService.activeSubscriptions.includes("all")) {
|
||||||
DMSService.addSubscription("cups")
|
DMSService.addSubscription("cups");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if (!active) {
|
if (!active) {
|
||||||
if (DMSService.activeSubscriptions.includes("cups")) {
|
if (DMSService.activeSubscriptions.includes("cups")) {
|
||||||
DMSService.removeSubscription("cups")
|
DMSService.removeSubscription("cups");
|
||||||
}
|
}
|
||||||
root.cupsBuiltinInstance = null
|
root.cupsBuiltinInstance = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SettingsData
|
target: SettingsData
|
||||||
function onControlCenterWidgetsChanged() {
|
function onControlCenterWidgetsChanged() {
|
||||||
const widgets = SettingsData.controlCenterWidgets || []
|
const widgets = SettingsData.controlCenterWidgets || [];
|
||||||
const hasCupsWidget = widgets.some(w => w.id === "builtin_cups")
|
const hasCupsWidget = widgets.some(w => w.id === "builtin_cups");
|
||||||
if (!hasCupsWidget && cupsLoader.active) {
|
if (!hasCupsWidget && cupsLoader.active) {
|
||||||
console.log("CupsWidget: No CUPS widget in control center, deactivating loader")
|
console.log("CupsWidget: No CUPS widget in control center, deactivating loader");
|
||||||
cupsLoader.active = false
|
cupsLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var coreWidgetDefinitions: [{
|
readonly property var coreWidgetDefinitions: [
|
||||||
|
{
|
||||||
"id": "nightMode",
|
"id": "nightMode",
|
||||||
"text": "Night Mode",
|
"text": "Night Mode",
|
||||||
"description": "Blue light filter",
|
"description": "Blue light filter",
|
||||||
@@ -76,28 +77,32 @@ QtObject {
|
|||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
"enabled": DisplayService.automationAvailable,
|
"enabled": DisplayService.automationAvailable,
|
||||||
"warning": !DisplayService.automationAvailable ? "Requires night mode support" : undefined
|
"warning": !DisplayService.automationAvailable ? "Requires night mode support" : undefined
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "darkMode",
|
"id": "darkMode",
|
||||||
"text": "Dark Mode",
|
"text": "Dark Mode",
|
||||||
"description": "System theme toggle",
|
"description": "System theme toggle",
|
||||||
"icon": "contrast",
|
"icon": "contrast",
|
||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "doNotDisturb",
|
"id": "doNotDisturb",
|
||||||
"text": "Do Not Disturb",
|
"text": "Do Not Disturb",
|
||||||
"description": "Block notifications",
|
"description": "Block notifications",
|
||||||
"icon": "do_not_disturb_on",
|
"icon": "do_not_disturb_on",
|
||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "idleInhibitor",
|
"id": "idleInhibitor",
|
||||||
"text": "Keep Awake",
|
"text": "Keep Awake",
|
||||||
"description": "Prevent screen timeout",
|
"description": "Prevent screen timeout",
|
||||||
"icon": "motion_sensor_active",
|
"icon": "motion_sensor_active",
|
||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "wifi",
|
"id": "wifi",
|
||||||
"text": "Network",
|
"text": "Network",
|
||||||
"description": "Wi-Fi and Ethernet connection",
|
"description": "Wi-Fi and Ethernet connection",
|
||||||
@@ -105,7 +110,8 @@ QtObject {
|
|||||||
"type": "connection",
|
"type": "connection",
|
||||||
"enabled": NetworkService.wifiAvailable,
|
"enabled": NetworkService.wifiAvailable,
|
||||||
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "bluetooth",
|
"id": "bluetooth",
|
||||||
"text": "Bluetooth",
|
"text": "Bluetooth",
|
||||||
"description": "Device connections",
|
"description": "Device connections",
|
||||||
@@ -113,28 +119,32 @@ QtObject {
|
|||||||
"type": "connection",
|
"type": "connection",
|
||||||
"enabled": BluetoothService.available,
|
"enabled": BluetoothService.available,
|
||||||
"warning": !BluetoothService.available ? "Bluetooth not available" : undefined
|
"warning": !BluetoothService.available ? "Bluetooth not available" : undefined
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "audioOutput",
|
"id": "audioOutput",
|
||||||
"text": "Audio Output",
|
"text": "Audio Output",
|
||||||
"description": "Speaker settings",
|
"description": "Speaker settings",
|
||||||
"icon": "volume_up",
|
"icon": "volume_up",
|
||||||
"type": "connection",
|
"type": "connection",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "audioInput",
|
"id": "audioInput",
|
||||||
"text": "Audio Input",
|
"text": "Audio Input",
|
||||||
"description": "Microphone settings",
|
"description": "Microphone settings",
|
||||||
"icon": "mic",
|
"icon": "mic",
|
||||||
"type": "connection",
|
"type": "connection",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "volumeSlider",
|
"id": "volumeSlider",
|
||||||
"text": "Volume Slider",
|
"text": "Volume Slider",
|
||||||
"description": "Audio volume control",
|
"description": "Audio volume control",
|
||||||
"icon": "volume_up",
|
"icon": "volume_up",
|
||||||
"type": "slider",
|
"type": "slider",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "brightnessSlider",
|
"id": "brightnessSlider",
|
||||||
"text": "Brightness Slider",
|
"text": "Brightness Slider",
|
||||||
"description": "Display brightness control",
|
"description": "Display brightness control",
|
||||||
@@ -143,21 +153,24 @@ QtObject {
|
|||||||
"enabled": DisplayService.brightnessAvailable,
|
"enabled": DisplayService.brightnessAvailable,
|
||||||
"warning": !DisplayService.brightnessAvailable ? "Brightness control not available" : undefined,
|
"warning": !DisplayService.brightnessAvailable ? "Brightness control not available" : undefined,
|
||||||
"allowMultiple": true
|
"allowMultiple": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "inputVolumeSlider",
|
"id": "inputVolumeSlider",
|
||||||
"text": "Input Volume Slider",
|
"text": "Input Volume Slider",
|
||||||
"description": "Microphone volume control",
|
"description": "Microphone volume control",
|
||||||
"icon": "mic",
|
"icon": "mic",
|
||||||
"type": "slider",
|
"type": "slider",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "battery",
|
"id": "battery",
|
||||||
"text": "Battery",
|
"text": "Battery",
|
||||||
"description": "Battery and power management",
|
"description": "Battery and power management",
|
||||||
"icon": "battery_std",
|
"icon": "battery_std",
|
||||||
"type": "action",
|
"type": "action",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "diskUsage",
|
"id": "diskUsage",
|
||||||
"text": "Disk Usage",
|
"text": "Disk Usage",
|
||||||
"description": "Filesystem usage monitoring",
|
"description": "Filesystem usage monitoring",
|
||||||
@@ -166,14 +179,16 @@ QtObject {
|
|||||||
"enabled": DgopService.dgopAvailable,
|
"enabled": DgopService.dgopAvailable,
|
||||||
"warning": !DgopService.dgopAvailable ? "Requires 'dgop' tool" : undefined,
|
"warning": !DgopService.dgopAvailable ? "Requires 'dgop' tool" : undefined,
|
||||||
"allowMultiple": true
|
"allowMultiple": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "colorPicker",
|
"id": "colorPicker",
|
||||||
"text": "Color Picker",
|
"text": "Color Picker",
|
||||||
"description": "Choose colors from palette",
|
"description": "Choose colors from palette",
|
||||||
"icon": "palette",
|
"icon": "palette",
|
||||||
"type": "action",
|
"type": "action",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "builtin_vpn",
|
"id": "builtin_vpn",
|
||||||
"text": "VPN",
|
"text": "VPN",
|
||||||
"description": "VPN connections",
|
"description": "VPN connections",
|
||||||
@@ -182,7 +197,8 @@ QtObject {
|
|||||||
"enabled": DMSNetworkService.available,
|
"enabled": DMSNetworkService.available,
|
||||||
"warning": !DMSNetworkService.available ? "VPN not available" : undefined,
|
"warning": !DMSNetworkService.available ? "VPN not available" : undefined,
|
||||||
"isBuiltinPlugin": true
|
"isBuiltinPlugin": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"id": "builtin_cups",
|
"id": "builtin_cups",
|
||||||
"text": "Printers",
|
"text": "Printers",
|
||||||
"description": "Print Server Management",
|
"description": "Print Server Management",
|
||||||
@@ -191,78 +207,79 @@ QtObject {
|
|||||||
"enabled": CupsService.available,
|
"enabled": CupsService.available,
|
||||||
"warning": !CupsService.available ? "CUPS not available" : undefined,
|
"warning": !CupsService.available ? "CUPS not available" : undefined,
|
||||||
"isBuiltinPlugin": true
|
"isBuiltinPlugin": true
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
|
||||||
function getPluginWidgets() {
|
function getPluginWidgets() {
|
||||||
const plugins = []
|
const plugins = [];
|
||||||
const loadedPlugins = PluginService.getLoadedPlugins()
|
const loadedPlugins = PluginService.getLoadedPlugins();
|
||||||
|
|
||||||
for (var i = 0; i < loadedPlugins.length; i++) {
|
for (var i = 0; i < loadedPlugins.length; i++) {
|
||||||
const plugin = loadedPlugins[i]
|
const plugin = loadedPlugins[i];
|
||||||
|
|
||||||
if (plugin.type === "daemon") {
|
if (plugin.type === "daemon") {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginComponent = PluginService.pluginWidgetComponents[plugin.id]
|
const pluginComponent = PluginService.pluginWidgetComponents[plugin.id];
|
||||||
if (!pluginComponent || typeof pluginComponent.createObject !== 'function') {
|
if (!pluginComponent || typeof pluginComponent.createObject !== 'function') {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tempInstance = pluginComponent.createObject(null)
|
const tempInstance = pluginComponent.createObject(null);
|
||||||
if (!tempInstance) {
|
if (!tempInstance) {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasCCWidget = tempInstance.ccWidgetIcon && tempInstance.ccWidgetIcon.length > 0
|
const hasCCWidget = tempInstance.ccWidgetIcon && tempInstance.ccWidgetIcon.length > 0;
|
||||||
tempInstance.destroy()
|
tempInstance.destroy();
|
||||||
|
|
||||||
if (!hasCCWidget) {
|
if (!hasCCWidget) {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.push({
|
plugins.push({
|
||||||
"id": "plugin_" + plugin.id,
|
"id": "plugin_" + plugin.id,
|
||||||
"pluginId": plugin.id,
|
"pluginId": plugin.id,
|
||||||
"text": plugin.name || "Plugin",
|
"text": plugin.name || "Plugin",
|
||||||
"description": plugin.description || "",
|
"description": plugin.description || "",
|
||||||
"icon": plugin.icon || "extension",
|
"icon": plugin.icon || "extension",
|
||||||
"type": "plugin",
|
"type": "plugin",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"isPlugin": true
|
"isPlugin": true
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugins
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var baseWidgetDefinitions: coreWidgetDefinitions
|
readonly property var baseWidgetDefinitions: coreWidgetDefinitions
|
||||||
|
|
||||||
function getWidgetForId(widgetId) {
|
function getWidgetForId(widgetId) {
|
||||||
return WidgetUtils.getWidgetForId(baseWidgetDefinitions, widgetId)
|
return WidgetUtils.getWidgetForId(baseWidgetDefinitions, widgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWidget(widgetId) {
|
function addWidget(widgetId) {
|
||||||
WidgetUtils.addWidget(widgetId)
|
WidgetUtils.addWidget(widgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeWidget(index) {
|
function removeWidget(index) {
|
||||||
WidgetUtils.removeWidget(index)
|
WidgetUtils.removeWidget(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleWidgetSize(index) {
|
function toggleWidgetSize(index) {
|
||||||
WidgetUtils.toggleWidgetSize(index)
|
WidgetUtils.toggleWidgetSize(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveWidget(fromIndex, toIndex) {
|
function moveWidget(fromIndex, toIndex) {
|
||||||
WidgetUtils.moveWidget(fromIndex, toIndex)
|
WidgetUtils.moveWidget(fromIndex, toIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetToDefault() {
|
function resetToDefault() {
|
||||||
WidgetUtils.resetToDefault()
|
WidgetUtils.resetToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearAll() {
|
function clearAll() {
|
||||||
WidgetUtils.clearAll()
|
WidgetUtils.clearAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1144,6 +1144,8 @@ Item {
|
|||||||
return controlCenterLoader.item;
|
return controlCenterLoader.item;
|
||||||
}
|
}
|
||||||
parentScreen: barWindow.screen
|
parentScreen: barWindow.screen
|
||||||
|
screenName: barWindow.screen?.name || ""
|
||||||
|
screenModel: barWindow.screen?.model || ""
|
||||||
widgetData: parent.widgetData
|
widgetData: parent.widgetData
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|||||||
@@ -10,9 +10,138 @@ BasePill {
|
|||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
property var popoutTarget: null
|
property var popoutTarget: null
|
||||||
property var widgetData: null
|
property var widgetData: null
|
||||||
|
property string screenName: ""
|
||||||
|
property string screenModel: ""
|
||||||
property bool showNetworkIcon: SettingsData.controlCenterShowNetworkIcon
|
property bool showNetworkIcon: SettingsData.controlCenterShowNetworkIcon
|
||||||
property bool showBluetoothIcon: SettingsData.controlCenterShowBluetoothIcon
|
property bool showBluetoothIcon: SettingsData.controlCenterShowBluetoothIcon
|
||||||
property bool showAudioIcon: SettingsData.controlCenterShowAudioIcon
|
property bool showAudioIcon: SettingsData.controlCenterShowAudioIcon
|
||||||
|
property bool showVpnIcon: SettingsData.controlCenterShowVpnIcon
|
||||||
|
property bool showBrightnessIcon: SettingsData.controlCenterShowBrightnessIcon
|
||||||
|
property bool showMicIcon: SettingsData.controlCenterShowMicIcon
|
||||||
|
property bool showBatteryIcon: SettingsData.controlCenterShowBatteryIcon
|
||||||
|
property bool showPrinterIcon: SettingsData.controlCenterShowPrinterIcon
|
||||||
|
|
||||||
|
function getNetworkIconName() {
|
||||||
|
if (NetworkService.wifiToggling)
|
||||||
|
return "sync";
|
||||||
|
switch (NetworkService.networkStatus) {
|
||||||
|
case "ethernet":
|
||||||
|
return "lan";
|
||||||
|
case "vpn":
|
||||||
|
return NetworkService.ethernetConnected ? "lan" : NetworkService.wifiSignalIcon;
|
||||||
|
default:
|
||||||
|
return NetworkService.wifiSignalIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNetworkIconColor() {
|
||||||
|
if (NetworkService.wifiToggling)
|
||||||
|
return Theme.primary;
|
||||||
|
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVolumeIconName() {
|
||||||
|
if (!AudioService.sink?.audio)
|
||||||
|
return "volume_up";
|
||||||
|
if (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0)
|
||||||
|
return "volume_off";
|
||||||
|
if (AudioService.sink.audio.volume * 100 < 33)
|
||||||
|
return "volume_down";
|
||||||
|
return "volume_up";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMicIconName() {
|
||||||
|
if (!AudioService.source?.audio)
|
||||||
|
return "mic";
|
||||||
|
if (AudioService.source.audio.muted || AudioService.source.audio.volume === 0)
|
||||||
|
return "mic_off";
|
||||||
|
return "mic";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMicIconColor() {
|
||||||
|
if (!AudioService.source?.audio)
|
||||||
|
return Theme.outlineButton;
|
||||||
|
if (AudioService.source.audio.muted || AudioService.source.audio.volume === 0)
|
||||||
|
return Theme.outlineButton;
|
||||||
|
return Theme.widgetIconColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBrightnessIconName() {
|
||||||
|
const deviceName = getPinnedBrightnessDevice();
|
||||||
|
if (!deviceName)
|
||||||
|
return "brightness_medium";
|
||||||
|
const level = DisplayService.getDeviceBrightness(deviceName);
|
||||||
|
if (level <= 33)
|
||||||
|
return "brightness_low";
|
||||||
|
if (level <= 66)
|
||||||
|
return "brightness_medium";
|
||||||
|
return "brightness_high";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getScreenPinKey() {
|
||||||
|
if (SettingsData.displayNameMode === "model" && root.screenModel && root.screenModel.length > 0) {
|
||||||
|
return root.screenModel;
|
||||||
|
}
|
||||||
|
return root.screenName || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPinnedBrightnessDevice() {
|
||||||
|
const pinKey = getScreenPinKey();
|
||||||
|
if (!pinKey)
|
||||||
|
return "";
|
||||||
|
const pins = SettingsData.brightnessDevicePins || {};
|
||||||
|
return pins[pinKey] || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasPinnedBrightnessDevice() {
|
||||||
|
return getPinnedBrightnessDevice().length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleVolumeWheel(delta) {
|
||||||
|
if (!AudioService.sink?.audio)
|
||||||
|
return;
|
||||||
|
const currentVolume = AudioService.sink.audio.volume * 100;
|
||||||
|
const newVolume = delta > 0 ? Math.min(100, currentVolume + 5) : Math.max(0, currentVolume - 5);
|
||||||
|
AudioService.sink.audio.muted = false;
|
||||||
|
AudioService.sink.audio.volume = newVolume / 100;
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMicWheel(delta) {
|
||||||
|
if (!AudioService.source?.audio)
|
||||||
|
return;
|
||||||
|
const currentVolume = AudioService.source.audio.volume * 100;
|
||||||
|
const newVolume = delta > 0 ? Math.min(100, currentVolume + 5) : Math.max(0, currentVolume - 5);
|
||||||
|
AudioService.source.audio.muted = false;
|
||||||
|
AudioService.source.audio.volume = newVolume / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBrightnessWheel(delta) {
|
||||||
|
const deviceName = getPinnedBrightnessDevice();
|
||||||
|
if (!deviceName)
|
||||||
|
return;
|
||||||
|
const currentBrightness = DisplayService.getDeviceBrightness(deviceName);
|
||||||
|
const newBrightness = delta > 0 ? Math.min(100, currentBrightness + 5) : Math.max(1, currentBrightness - 5);
|
||||||
|
DisplayService.setBrightness(newBrightness, deviceName, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBatteryIconColor() {
|
||||||
|
if (!BatteryService.batteryAvailable)
|
||||||
|
return Theme.widgetIconColor;
|
||||||
|
if (BatteryService.isLowBattery && !BatteryService.isCharging)
|
||||||
|
return Theme.error;
|
||||||
|
if (BatteryService.isCharging || BatteryService.isPluggedIn)
|
||||||
|
return Theme.primary;
|
||||||
|
return Theme.widgetIconColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasPrintJobs() {
|
||||||
|
return CupsService.getTotalJobsNum() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasNoVisibleIcons() {
|
||||||
|
return !root.showNetworkIcon && !root.showBluetoothIcon && !root.showAudioIcon && !root.showVpnIcon && !root.showBrightnessIcon && !root.showMicIcon && !root.showBatteryIcon && !root.showPrinterIcon;
|
||||||
|
}
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
Item {
|
Item {
|
||||||
@@ -26,34 +155,21 @@ BasePill {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: {
|
name: root.getNetworkIconName()
|
||||||
if (NetworkService.wifiToggling) {
|
|
||||||
return "sync"
|
|
||||||
}
|
|
||||||
|
|
||||||
const status = NetworkService.networkStatus
|
|
||||||
if (status === "ethernet") {
|
|
||||||
return "lan"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === "vpn") {
|
|
||||||
return NetworkService.ethernetConnected ? "lan" : NetworkService.wifiSignalIcon
|
|
||||||
}
|
|
||||||
|
|
||||||
return NetworkService.wifiSignalIcon
|
|
||||||
}
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: {
|
color: root.getNetworkIconColor()
|
||||||
if (NetworkService.wifiToggling) {
|
|
||||||
return Theme.primary
|
|
||||||
}
|
|
||||||
|
|
||||||
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
|
||||||
}
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "vpn_lock"
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: NetworkService.vpnConnected ? Theme.primary : Theme.outlineButton
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showVpnIcon && NetworkService.vpnAvailable && NetworkService.vpnConnected
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
@@ -71,19 +187,7 @@ BasePill {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
id: audioIconV
|
id: audioIconV
|
||||||
|
name: root.getVolumeIconName()
|
||||||
name: {
|
|
||||||
if (AudioService.sink && AudioService.sink.audio) {
|
|
||||||
if (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0) {
|
|
||||||
return "volume_off"
|
|
||||||
} else if (AudioService.sink.audio.volume * 100 < 33) {
|
|
||||||
return "volume_down"
|
|
||||||
} else {
|
|
||||||
return "volume_up"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "volume_up"
|
|
||||||
}
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: Theme.widgetIconColor
|
color: Theme.widgetIconColor
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -92,31 +196,85 @@ BasePill {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
onWheel: function(wheelEvent) {
|
onWheel: function (wheelEvent) {
|
||||||
let delta = wheelEvent.angleDelta.y
|
root.handleVolumeWheel(wheelEvent.angleDelta.y);
|
||||||
let currentVolume = (AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.volume * 100) || 0
|
wheelEvent.accepted = true;
|
||||||
let newVolume
|
|
||||||
if (delta > 0) {
|
|
||||||
newVolume = Math.min(100, currentVolume + 5)
|
|
||||||
} else {
|
|
||||||
newVolume = Math.max(0, currentVolume - 5)
|
|
||||||
}
|
|
||||||
if (AudioService.sink && AudioService.sink.audio) {
|
|
||||||
AudioService.sink.audio.muted = false
|
|
||||||
AudioService.sink.audio.volume = newVolume / 100
|
|
||||||
AudioService.playVolumeChangeSoundIfEnabled()
|
|
||||||
}
|
|
||||||
wheelEvent.accepted = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: micIconV.implicitWidth + 4
|
||||||
|
height: micIconV.implicitHeight + 4
|
||||||
|
color: "transparent"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showMicIcon
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: micIconV
|
||||||
|
name: root.getMicIconName()
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: root.getMicIconColor()
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
onWheel: function (wheelEvent) {
|
||||||
|
root.handleMicWheel(wheelEvent.angleDelta.y);
|
||||||
|
wheelEvent.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: brightnessIconV.implicitWidth + 4
|
||||||
|
height: brightnessIconV.implicitHeight + 4
|
||||||
|
color: "transparent"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showBrightnessIcon && DisplayService.brightnessAvailable && root.hasPinnedBrightnessDevice()
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: brightnessIconV
|
||||||
|
name: root.getBrightnessIconName()
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: Theme.widgetIconColor
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
onWheel: function (wheelEvent) {
|
||||||
|
root.handleBrightnessWheel(wheelEvent.angleDelta.y);
|
||||||
|
wheelEvent.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable)
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: root.getBatteryIconColor()
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showBatteryIcon && BatteryService.batteryAvailable
|
||||||
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "print"
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: root.showPrinterIcon && CupsService.cupsAvailable && root.hasPrintJobs()
|
||||||
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "settings"
|
name: "settings"
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: root.isActive ? Theme.primary : Theme.widgetIconColor
|
color: root.isActive ? Theme.primary : Theme.widgetIconColor
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: !root.showNetworkIcon && !root.showBluetoothIcon && !root.showAudioIcon
|
visible: root.hasNoVisibleIcons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,38 +286,24 @@ BasePill {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
id: networkIcon
|
id: networkIcon
|
||||||
|
name: root.getNetworkIconName()
|
||||||
name: {
|
|
||||||
if (NetworkService.wifiToggling) {
|
|
||||||
return "sync"
|
|
||||||
}
|
|
||||||
|
|
||||||
const status = NetworkService.networkStatus
|
|
||||||
if (status === "ethernet") {
|
|
||||||
return "lan"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === "vpn") {
|
|
||||||
return NetworkService.ethernetConnected ? "lan" : NetworkService.wifiSignalIcon
|
|
||||||
}
|
|
||||||
|
|
||||||
return NetworkService.wifiSignalIcon
|
|
||||||
}
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: {
|
color: root.getNetworkIconColor()
|
||||||
if (NetworkService.wifiToggling) {
|
|
||||||
return Theme.primary
|
|
||||||
}
|
|
||||||
|
|
||||||
return NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton
|
|
||||||
}
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
visible: root.showNetworkIcon && NetworkService.networkAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
id: bluetoothIcon
|
id: vpnIcon
|
||||||
|
name: "vpn_lock"
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: NetworkService.vpnConnected ? Theme.primary : Theme.outlineButton
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: root.showVpnIcon && NetworkService.vpnAvailable && NetworkService.vpnConnected
|
||||||
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: bluetoothIcon
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
|
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
|
||||||
@@ -176,19 +320,7 @@ BasePill {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
id: audioIcon
|
id: audioIcon
|
||||||
|
name: root.getVolumeIconName()
|
||||||
name: {
|
|
||||||
if (AudioService.sink && AudioService.sink.audio) {
|
|
||||||
if (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0) {
|
|
||||||
return "volume_off";
|
|
||||||
} else if (AudioService.sink.audio.volume * 100 < 33) {
|
|
||||||
return "volume_down";
|
|
||||||
} else {
|
|
||||||
return "volume_up";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "volume_up";
|
|
||||||
}
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: Theme.widgetIconColor
|
color: Theme.widgetIconColor
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -196,34 +328,83 @@ BasePill {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: audioWheelArea
|
id: audioWheelArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
onWheel: function(wheelEvent) {
|
onWheel: function (wheelEvent) {
|
||||||
let delta = wheelEvent.angleDelta.y;
|
root.handleVolumeWheel(wheelEvent.angleDelta.y);
|
||||||
let currentVolume = (AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.volume * 100) || 0;
|
wheelEvent.accepted = true;
|
||||||
let newVolume;
|
}
|
||||||
if (delta > 0) {
|
}
|
||||||
newVolume = Math.min(100, currentVolume + 5);
|
}
|
||||||
} else {
|
|
||||||
newVolume = Math.max(0, currentVolume - 5);
|
Rectangle {
|
||||||
}
|
width: micIcon.implicitWidth + 4
|
||||||
if (AudioService.sink && AudioService.sink.audio) {
|
height: micIcon.implicitHeight + 4
|
||||||
AudioService.sink.audio.muted = false;
|
color: "transparent"
|
||||||
AudioService.sink.audio.volume = newVolume / 100;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
AudioService.playVolumeChangeSoundIfEnabled();
|
visible: root.showMicIcon
|
||||||
}
|
|
||||||
|
DankIcon {
|
||||||
|
id: micIcon
|
||||||
|
name: root.getMicIconName()
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: root.getMicIconColor()
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: micWheelArea
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
onWheel: function (wheelEvent) {
|
||||||
|
root.handleMicWheel(wheelEvent.angleDelta.y);
|
||||||
|
wheelEvent.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: brightnessIcon.implicitWidth + 4
|
||||||
|
height: brightnessIcon.implicitHeight + 4
|
||||||
|
color: "transparent"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: root.showBrightnessIcon && DisplayService.brightnessAvailable && root.hasPinnedBrightnessDevice()
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: brightnessIcon
|
||||||
|
name: root.getBrightnessIconName()
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: Theme.widgetIconColor
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: brightnessWheelArea
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
onWheel: function (wheelEvent) {
|
||||||
|
root.handleBrightnessWheel(wheelEvent.angleDelta.y);
|
||||||
wheelEvent.accepted = true;
|
wheelEvent.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "mic"
|
id: batteryIcon
|
||||||
|
name: Theme.getBatteryIcon(BatteryService.batteryLevel, BatteryService.isCharging, BatteryService.batteryAvailable)
|
||||||
|
size: Theme.barIconSize(root.barThickness)
|
||||||
|
color: root.getBatteryIconColor()
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: root.showBatteryIcon && BatteryService.batteryAvailable
|
||||||
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
id: printerIcon
|
||||||
|
name: "print"
|
||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: false
|
visible: root.showPrinterIcon && CupsService.cupsAvailable && root.hasPrintJobs()
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
@@ -231,9 +412,15 @@ BasePill {
|
|||||||
size: Theme.barIconSize(root.barThickness)
|
size: Theme.barIconSize(root.barThickness)
|
||||||
color: root.isActive ? Theme.primary : Theme.widgetIconColor
|
color: root.isActive ? Theme.primary : Theme.widgetIconColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: !root.showNetworkIcon && !root.showBluetoothIcon && !root.showAudioIcon
|
visible: root.hasNoVisibleIcons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ DankOSD {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property bool useVertical: isVerticalLayout
|
readonly property bool useVertical: isVerticalLayout
|
||||||
|
property int targetBrightness: {
|
||||||
|
DisplayService.brightnessVersion;
|
||||||
|
return DisplayService.brightnessLevel;
|
||||||
|
}
|
||||||
|
|
||||||
osdWidth: useVertical ? (40 + Theme.spacingS * 2) : Math.min(260, Screen.width - Theme.spacingM * 2)
|
osdWidth: useVertical ? (40 + Theme.spacingS * 2) : Math.min(260, Screen.width - Theme.spacingM * 2)
|
||||||
osdHeight: useVertical ? Math.min(260, Screen.height - Theme.spacingM * 2) : (40 + Theme.spacingS * 2)
|
osdHeight: useVertical ? Math.min(260, Screen.height - Theme.spacingM * 2) : (40 + Theme.spacingS * 2)
|
||||||
@@ -17,7 +21,7 @@ DankOSD {
|
|||||||
target: DisplayService
|
target: DisplayService
|
||||||
function onBrightnessChanged(showOsd) {
|
function onBrightnessChanged(showOsd) {
|
||||||
if (showOsd && SettingsData.osdBrightnessEnabled) {
|
if (showOsd && SettingsData.osdBrightnessEnabled) {
|
||||||
root.show()
|
root.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,13 +52,13 @@ DankOSD {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
name: {
|
name: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
|
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
|
||||||
return "brightness_medium"
|
return "brightness_medium";
|
||||||
} else if (deviceInfo.name.includes("kbd")) {
|
} else if (deviceInfo.name.includes("kbd")) {
|
||||||
return "keyboard"
|
return "keyboard";
|
||||||
} else {
|
} else {
|
||||||
return "lightbulb"
|
return "lightbulb";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
@@ -70,74 +74,50 @@ DankOSD {
|
|||||||
x: parent.gap * 2 + Theme.iconSize
|
x: parent.gap * 2 + Theme.iconSize
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
minimum: {
|
minimum: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo) return 1
|
if (!deviceInfo)
|
||||||
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id)
|
return 1;
|
||||||
|
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
|
||||||
if (isExponential) {
|
if (isExponential) {
|
||||||
return 1
|
return 1;
|
||||||
}
|
}
|
||||||
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0
|
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0;
|
||||||
}
|
}
|
||||||
maximum: {
|
maximum: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo) return 100
|
if (!deviceInfo)
|
||||||
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id)
|
return 100;
|
||||||
|
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
|
||||||
if (isExponential) {
|
if (isExponential) {
|
||||||
return 100
|
return 100;
|
||||||
}
|
}
|
||||||
return deviceInfo.displayMax || 100
|
return deviceInfo.displayMax || 100;
|
||||||
}
|
}
|
||||||
enabled: DisplayService.brightnessAvailable
|
enabled: DisplayService.brightnessAvailable
|
||||||
showValue: true
|
showValue: true
|
||||||
unit: {
|
unit: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo) return "%"
|
if (!deviceInfo)
|
||||||
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id)
|
return "%";
|
||||||
|
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
|
||||||
if (isExponential) {
|
if (isExponential) {
|
||||||
return "%"
|
return "%";
|
||||||
}
|
}
|
||||||
return deviceInfo.class === "ddc" ? "" : "%"
|
return deviceInfo.class === "ddc" ? "" : "%";
|
||||||
}
|
}
|
||||||
thumbOutlineColor: Theme.surfaceContainer
|
thumbOutlineColor: Theme.surfaceContainer
|
||||||
alwaysShowValue: SettingsData.osdAlwaysShowValue
|
alwaysShowValue: SettingsData.osdAlwaysShowValue
|
||||||
|
value: !isDragging ? root.targetBrightness : value
|
||||||
Component.onCompleted: {
|
|
||||||
if (DisplayService.brightnessAvailable) {
|
|
||||||
value = DisplayService.brightnessLevel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onSliderValueChanged: newValue => {
|
onSliderValueChanged: newValue => {
|
||||||
if (DisplayService.brightnessAvailable) {
|
if (DisplayService.brightnessAvailable) {
|
||||||
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true)
|
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
|
||||||
resetHideTimer()
|
resetHideTimer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onContainsMouseChanged: {
|
|
||||||
setChildHovered(containsMouse)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSliderDragFinished: finalValue => {
|
onContainsMouseChanged: {
|
||||||
if (DisplayService.brightnessAvailable) {
|
setChildHovered(containsMouse);
|
||||||
DisplayService.setBrightness(finalValue, DisplayService.lastIpcDevice, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: DisplayService
|
|
||||||
|
|
||||||
function onBrightnessChanged(showOsd) {
|
|
||||||
if (!brightnessSlider.pressed && brightnessSlider.value !== DisplayService.brightnessLevel) {
|
|
||||||
brightnessSlider.value = DisplayService.brightnessLevel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeviceSwitched() {
|
|
||||||
if (!brightnessSlider.pressed && brightnessSlider.value !== DisplayService.brightnessLevel) {
|
|
||||||
brightnessSlider.value = DisplayService.brightnessLevel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,13 +141,13 @@ DankOSD {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
name: {
|
name: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
|
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
|
||||||
return "brightness_medium"
|
return "brightness_medium";
|
||||||
} else if (deviceInfo.name.includes("kbd")) {
|
} else if (deviceInfo.name.includes("kbd")) {
|
||||||
return "keyboard"
|
return "keyboard";
|
||||||
} else {
|
} else {
|
||||||
return "lightbulb"
|
return "lightbulb";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
@@ -183,22 +163,26 @@ DankOSD {
|
|||||||
y: gap * 2 + Theme.iconSize
|
y: gap * 2 + Theme.iconSize
|
||||||
|
|
||||||
property bool dragging: false
|
property bool dragging: false
|
||||||
property int value: DisplayService.brightnessAvailable ? DisplayService.brightnessLevel : 0
|
property int value: !dragging ? root.targetBrightness : value
|
||||||
|
|
||||||
readonly property int minimum: {
|
readonly property int minimum: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo) return 1
|
if (!deviceInfo)
|
||||||
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id)
|
return 1;
|
||||||
if (isExponential) return 1
|
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
|
||||||
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0
|
if (isExponential)
|
||||||
|
return 1;
|
||||||
|
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property int maximum: {
|
readonly property int maximum: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
if (!deviceInfo) return 100
|
if (!deviceInfo)
|
||||||
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id)
|
return 100;
|
||||||
if (isExponential) return 100
|
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
|
||||||
return deviceInfo.displayMax || 100
|
if (isExponential)
|
||||||
|
return 100;
|
||||||
|
return deviceInfo.displayMax || 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -214,8 +198,8 @@ DankOSD {
|
|||||||
id: vertFill
|
id: vertFill
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: {
|
height: {
|
||||||
const ratio = (vertSlider.value - vertSlider.minimum) / (vertSlider.maximum - vertSlider.minimum)
|
const ratio = (vertSlider.value - vertSlider.minimum) / (vertSlider.maximum - vertSlider.minimum);
|
||||||
return ratio * parent.height
|
return ratio * parent.height;
|
||||||
}
|
}
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@@ -229,9 +213,9 @@ DankOSD {
|
|||||||
height: 8
|
height: 8
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
y: {
|
y: {
|
||||||
const ratio = (vertSlider.value - vertSlider.minimum) / (vertSlider.maximum - vertSlider.minimum)
|
const ratio = (vertSlider.value - vertSlider.minimum) / (vertSlider.maximum - vertSlider.minimum);
|
||||||
const travel = parent.height - height
|
const travel = parent.height - height;
|
||||||
return Math.max(0, Math.min(travel, travel * (1 - ratio)))
|
return Math.max(0, Math.min(travel, travel * (1 - ratio)));
|
||||||
}
|
}
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
@@ -248,50 +232,34 @@ DankOSD {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onContainsMouseChanged: {
|
onContainsMouseChanged: {
|
||||||
setChildHovered(containsMouse)
|
setChildHovered(containsMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressed: mouse => {
|
onPressed: mouse => {
|
||||||
vertSlider.dragging = true
|
vertSlider.dragging = true;
|
||||||
updateBrightness(mouse)
|
updateBrightness(mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
vertSlider.dragging = false
|
vertSlider.dragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onPositionChanged: mouse => {
|
onPositionChanged: mouse => {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
updateBrightness(mouse)
|
updateBrightness(mouse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
updateBrightness(mouse)
|
updateBrightness(mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateBrightness(mouse) {
|
function updateBrightness(mouse) {
|
||||||
if (DisplayService.brightnessAvailable) {
|
if (DisplayService.brightnessAvailable) {
|
||||||
const ratio = 1.0 - (mouse.y / height)
|
const ratio = 1.0 - (mouse.y / height);
|
||||||
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum))
|
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum));
|
||||||
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true)
|
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
|
||||||
resetHideTimer()
|
resetHideTimer();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: DisplayService
|
|
||||||
|
|
||||||
function onBrightnessChanged(showOsd) {
|
|
||||||
if (!vertSlider.dragging && vertSlider.value !== DisplayService.brightnessLevel) {
|
|
||||||
vertSlider.value = DisplayService.brightnessLevel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeviceSwitched() {
|
|
||||||
if (!vertSlider.dragging && vertSlider.value !== DisplayService.brightnessLevel) {
|
|
||||||
vertSlider.value = DisplayService.brightnessLevel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,10 +270,10 @@ DankOSD {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottomMargin: gap
|
anchors.bottomMargin: gap
|
||||||
text: {
|
text: {
|
||||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
const deviceInfo = DisplayService.getCurrentDeviceInfo();
|
||||||
const isExponential = deviceInfo ? SessionData.getBrightnessExponential(deviceInfo.id) : false
|
const isExponential = deviceInfo ? SessionData.getBrightnessExponential(deviceInfo.id) : false;
|
||||||
const unit = (deviceInfo && deviceInfo.class === "ddc" && !isExponential) ? "" : "%"
|
const unit = (deviceInfo && deviceInfo.class === "ddc" && !isExponential) ? "" : "%";
|
||||||
return vertSlider.value + unit
|
return vertSlider.value + unit;
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
|
|||||||
@@ -784,13 +784,31 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
// Control Center settings are global, not per-widget instance
|
switch (settingName) {
|
||||||
if (settingName === "showNetworkIcon") {
|
case "showNetworkIcon":
|
||||||
SettingsData.set("controlCenterShowNetworkIcon", value);
|
SettingsData.set("controlCenterShowNetworkIcon", value)
|
||||||
} else if (settingName === "showBluetoothIcon") {
|
break
|
||||||
SettingsData.set("controlCenterShowBluetoothIcon", value);
|
case "showBluetoothIcon":
|
||||||
} else if (settingName === "showAudioIcon") {
|
SettingsData.set("controlCenterShowBluetoothIcon", value)
|
||||||
SettingsData.set("controlCenterShowAudioIcon", value);
|
break
|
||||||
|
case "showAudioIcon":
|
||||||
|
SettingsData.set("controlCenterShowAudioIcon", value)
|
||||||
|
break
|
||||||
|
case "showVpnIcon":
|
||||||
|
SettingsData.set("controlCenterShowVpnIcon", value)
|
||||||
|
break
|
||||||
|
case "showBrightnessIcon":
|
||||||
|
SettingsData.set("controlCenterShowBrightnessIcon", value)
|
||||||
|
break
|
||||||
|
case "showMicIcon":
|
||||||
|
SettingsData.set("controlCenterShowMicIcon", value)
|
||||||
|
break
|
||||||
|
case "showBatteryIcon":
|
||||||
|
SettingsData.set("controlCenterShowBatteryIcon", value)
|
||||||
|
break
|
||||||
|
case "showPrinterIcon":
|
||||||
|
SettingsData.set("controlCenterShowPrinterIcon", value)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -497,39 +497,69 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
|
id: ccMenuButton
|
||||||
visible: modelData.id === "controlCenterButton"
|
visible: modelData.id === "controlCenterButton"
|
||||||
buttonSize: 32
|
buttonSize: 32
|
||||||
iconName: "more_vert"
|
iconName: "more_vert"
|
||||||
iconSize: 18
|
iconSize: 18
|
||||||
iconColor: Theme.outline
|
iconColor: Theme.outline
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Control Center three-dot button clicked for widget:", modelData.id);
|
|
||||||
controlCenterContextMenu.widgetData = modelData;
|
controlCenterContextMenu.widgetData = modelData;
|
||||||
controlCenterContextMenu.sectionId = root.sectionId;
|
controlCenterContextMenu.sectionId = root.sectionId;
|
||||||
controlCenterContextMenu.widgetIndex = index;
|
controlCenterContextMenu.widgetIndex = index;
|
||||||
// Position relative to the action buttons row, not the specific button
|
|
||||||
var parentPos = parent.mapToItem(root, 0, 0);
|
var buttonPos = ccMenuButton.mapToItem(root, 0, 0);
|
||||||
controlCenterContextMenu.x = parentPos.x - 210; // Position to the left with margin
|
var popupWidth = controlCenterContextMenu.width;
|
||||||
controlCenterContextMenu.y = parentPos.y - 10; // Slightly above
|
var popupHeight = controlCenterContextMenu.height;
|
||||||
|
|
||||||
|
var xPos = buttonPos.x - popupWidth - Theme.spacingS;
|
||||||
|
if (xPos < 0) {
|
||||||
|
xPos = buttonPos.x + ccMenuButton.width + Theme.spacingS;
|
||||||
|
}
|
||||||
|
|
||||||
|
var yPos = buttonPos.y - popupHeight / 2 + ccMenuButton.height / 2;
|
||||||
|
if (yPos < 0) {
|
||||||
|
yPos = Theme.spacingS;
|
||||||
|
} else if (yPos + popupHeight > root.height) {
|
||||||
|
yPos = root.height - popupHeight - Theme.spacingS;
|
||||||
|
}
|
||||||
|
|
||||||
|
controlCenterContextMenu.x = xPos;
|
||||||
|
controlCenterContextMenu.y = yPos;
|
||||||
controlCenterContextMenu.open();
|
controlCenterContextMenu.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
|
id: privacyMenuButton
|
||||||
visible: modelData.id === "privacyIndicator"
|
visible: modelData.id === "privacyIndicator"
|
||||||
buttonSize: 32
|
buttonSize: 32
|
||||||
iconName: "more_vert"
|
iconName: "more_vert"
|
||||||
iconSize: 18
|
iconSize: 18
|
||||||
iconColor: Theme.outline
|
iconColor: Theme.outline
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Privacy three-dot button clicked for widget:", modelData.id);
|
|
||||||
privacyContextMenu.widgetData = modelData;
|
privacyContextMenu.widgetData = modelData;
|
||||||
privacyContextMenu.sectionId = root.sectionId;
|
privacyContextMenu.sectionId = root.sectionId;
|
||||||
privacyContextMenu.widgetIndex = index;
|
privacyContextMenu.widgetIndex = index;
|
||||||
// Position relative to the action buttons row, not the specific button
|
|
||||||
var parentPos = parent.mapToItem(root, 0, 0);
|
var buttonPos = privacyMenuButton.mapToItem(root, 0, 0);
|
||||||
privacyContextMenu.x = parentPos.x - 210; // Position to the left with margin
|
var popupWidth = privacyContextMenu.width;
|
||||||
privacyContextMenu.y = parentPos.y - 10; // Slightly above
|
var popupHeight = privacyContextMenu.height;
|
||||||
|
|
||||||
|
var xPos = buttonPos.x - popupWidth - Theme.spacingS;
|
||||||
|
if (xPos < 0) {
|
||||||
|
xPos = buttonPos.x + privacyMenuButton.width + Theme.spacingS;
|
||||||
|
}
|
||||||
|
|
||||||
|
var yPos = buttonPos.y - popupHeight / 2 + privacyMenuButton.height / 2;
|
||||||
|
if (yPos < 0) {
|
||||||
|
yPos = Theme.spacingS;
|
||||||
|
} else if (yPos + popupHeight > root.height) {
|
||||||
|
yPos = root.height - popupHeight - Theme.spacingS;
|
||||||
|
}
|
||||||
|
|
||||||
|
privacyContextMenu.x = xPos;
|
||||||
|
privacyContextMenu.y = yPos;
|
||||||
privacyContextMenu.open();
|
privacyContextMenu.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -699,21 +729,13 @@ Column {
|
|||||||
property string sectionId: ""
|
property string sectionId: ""
|
||||||
property int widgetIndex: -1
|
property int widgetIndex: -1
|
||||||
|
|
||||||
width: 200
|
width: 220
|
||||||
height: 120
|
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||||
padding: 0
|
padding: 0
|
||||||
modal: true
|
modal: true
|
||||||
focus: true
|
focus: true
|
||||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
console.log("Control Center context menu opened");
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
console.log("Control Center context menu closed");
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -722,168 +744,117 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: menuColumn
|
id: menuColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
Rectangle {
|
Repeater {
|
||||||
width: parent.width
|
model: [
|
||||||
height: 32
|
{
|
||||||
radius: Theme.cornerRadius
|
icon: "lan",
|
||||||
color: networkToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
label: I18n.tr("Network"),
|
||||||
|
setting: "showNetworkIcon",
|
||||||
|
checked: SettingsData.controlCenterShowNetworkIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "vpn_lock",
|
||||||
|
label: I18n.tr("VPN"),
|
||||||
|
setting: "showVpnIcon",
|
||||||
|
checked: SettingsData.controlCenterShowVpnIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "bluetooth",
|
||||||
|
label: I18n.tr("Bluetooth"),
|
||||||
|
setting: "showBluetoothIcon",
|
||||||
|
checked: SettingsData.controlCenterShowBluetoothIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "volume_up",
|
||||||
|
label: I18n.tr("Audio"),
|
||||||
|
setting: "showAudioIcon",
|
||||||
|
checked: SettingsData.controlCenterShowAudioIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mic",
|
||||||
|
label: I18n.tr("Microphone"),
|
||||||
|
setting: "showMicIcon",
|
||||||
|
checked: SettingsData.controlCenterShowMicIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "brightness_high",
|
||||||
|
label: I18n.tr("Brightness"),
|
||||||
|
setting: "showBrightnessIcon",
|
||||||
|
checked: SettingsData.controlCenterShowBrightnessIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "battery_full",
|
||||||
|
label: I18n.tr("Battery"),
|
||||||
|
setting: "showBatteryIcon",
|
||||||
|
checked: SettingsData.controlCenterShowBatteryIcon
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "print",
|
||||||
|
label: I18n.tr("Printer"),
|
||||||
|
setting: "showPrinterIcon",
|
||||||
|
checked: SettingsData.controlCenterShowPrinterIcon
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Row {
|
delegate: Rectangle {
|
||||||
anchors.left: parent.left
|
required property var modelData
|
||||||
anchors.leftMargin: Theme.spacingS
|
required property int index
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
width: menuColumn.width
|
||||||
name: "lan"
|
height: 32
|
||||||
size: 16
|
radius: Theme.cornerRadius
|
||||||
color: Theme.surfaceText
|
color: toggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: modelData.icon
|
||||||
|
size: 16
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.label
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Normal
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
DankToggle {
|
||||||
text: I18n.tr("Network Icon")
|
id: toggle
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
anchors.right: parent.right
|
||||||
color: Theme.surfaceText
|
anchors.rightMargin: Theme.spacingS
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DankToggle {
|
|
||||||
id: networkToggle
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 40
|
|
||||||
height: 20
|
|
||||||
checked: SettingsData.controlCenterShowNetworkIcon
|
|
||||||
onToggled: {
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showNetworkIcon", toggled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: networkToggleArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onPressed: {
|
|
||||||
networkToggle.checked = !networkToggle.checked;
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showNetworkIcon", networkToggle.checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: bluetoothToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "bluetooth"
|
|
||||||
size: 16
|
|
||||||
color: Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 40
|
||||||
|
height: 20
|
||||||
|
checked: modelData.checked
|
||||||
|
onToggled: {
|
||||||
|
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, modelData.setting, toggled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
MouseArea {
|
||||||
text: I18n.tr("Bluetooth Icon")
|
id: toggleArea
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
anchors.fill: parent
|
||||||
color: Theme.surfaceText
|
hoverEnabled: true
|
||||||
font.weight: Font.Normal
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
onPressed: {
|
||||||
}
|
toggle.checked = !toggle.checked;
|
||||||
}
|
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, modelData.setting, toggle.checked);
|
||||||
|
}
|
||||||
DankToggle {
|
|
||||||
id: bluetoothToggle
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 40
|
|
||||||
height: 20
|
|
||||||
checked: SettingsData.controlCenterShowBluetoothIcon
|
|
||||||
onToggled: {
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showBluetoothIcon", toggled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: bluetoothToggleArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onPressed: {
|
|
||||||
bluetoothToggle.checked = !bluetoothToggle.checked;
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showBluetoothIcon", bluetoothToggle.checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: audioToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "volume_up"
|
|
||||||
size: 16
|
|
||||||
color: Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Audio Icon")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DankToggle {
|
|
||||||
id: audioToggle
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 40
|
|
||||||
height: 20
|
|
||||||
checked: SettingsData.controlCenterShowAudioIcon
|
|
||||||
onToggled: {
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showAudioIcon", toggled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: audioToggleArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onPressed: {
|
|
||||||
audioToggle.checked = !audioToggle.checked;
|
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, "showAudioIcon", audioToggle.checked);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -932,7 +903,7 @@ Column {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: networkToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -954,7 +925,7 @@ Column {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: networkToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: micToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -1006,7 +977,7 @@ Column {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: networkToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: cameraToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -1058,7 +1029,7 @@ Column {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: networkToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: screenshareToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,8 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
|
||||||
import qs.Common
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
@@ -70,6 +67,14 @@ Singleton {
|
|||||||
|
|
||||||
property bool subscriptionConnected: activeService?.subscriptionConnected ?? false
|
property bool subscriptionConnected: activeService?.subscriptionConnected ?? false
|
||||||
|
|
||||||
|
property var vpnProfiles: activeService?.vpnProfiles ?? []
|
||||||
|
property var vpnActive: activeService?.vpnActive ?? []
|
||||||
|
property bool vpnAvailable: activeService?.vpnAvailable ?? false
|
||||||
|
property bool vpnIsBusy: activeService?.vpnIsBusy ?? false
|
||||||
|
property bool vpnConnected: activeService?.vpnConnected ?? false
|
||||||
|
property string vpnActiveUuid: activeService?.activeUuid ?? ""
|
||||||
|
property string vpnActiveName: activeService?.activeName ?? ""
|
||||||
|
|
||||||
property string credentialsToken: activeService?.credentialsToken ?? ""
|
property string credentialsToken: activeService?.credentialsToken ?? ""
|
||||||
property string credentialsSSID: activeService?.credentialsSSID ?? ""
|
property string credentialsSSID: activeService?.credentialsSSID ?? ""
|
||||||
property string credentialsSetting: activeService?.credentialsSetting ?? ""
|
property string credentialsSetting: activeService?.credentialsSetting ?? ""
|
||||||
@@ -88,12 +93,12 @@ Singleton {
|
|||||||
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.info("NetworkService: Initializing...")
|
console.info("NetworkService: Initializing...");
|
||||||
if (!socketPath || socketPath.length === 0) {
|
if (!socketPath || socketPath.length === 0) {
|
||||||
console.info("NetworkService: DMS_SOCKET not set, using LegacyNetworkService")
|
console.info("NetworkService: DMS_SOCKET not set, using LegacyNetworkService");
|
||||||
useLegacyService()
|
useLegacyService();
|
||||||
} else {
|
} else {
|
||||||
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...")
|
console.log("NetworkService: DMS_SOCKET found, waiting for capabilities...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,191 +107,191 @@ Singleton {
|
|||||||
|
|
||||||
function onNetworkAvailableChanged() {
|
function onNetworkAvailableChanged() {
|
||||||
if (!activeService && DMSNetworkService.networkAvailable) {
|
if (!activeService && DMSNetworkService.networkAvailable) {
|
||||||
console.info("NetworkService: Network capability detected, using DMSNetworkService")
|
console.info("NetworkService: Network capability detected, using DMSNetworkService");
|
||||||
activeService = DMSNetworkService
|
activeService = DMSNetworkService;
|
||||||
usingLegacy = false
|
usingLegacy = false;
|
||||||
console.info("NetworkService: Switched to DMSNetworkService, networkAvailable:", networkAvailable)
|
console.info("NetworkService: Switched to DMSNetworkService, networkAvailable:", networkAvailable);
|
||||||
connectSignals()
|
connectSignals();
|
||||||
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
|
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
|
||||||
console.info("NetworkService: Network capability not available in DMS, using LegacyNetworkService")
|
console.info("NetworkService: Network capability not available in DMS, using LegacyNetworkService");
|
||||||
useLegacyService()
|
useLegacyService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function useLegacyService() {
|
function useLegacyService() {
|
||||||
activeService = LegacyNetworkService
|
activeService = LegacyNetworkService;
|
||||||
usingLegacy = true
|
usingLegacy = true;
|
||||||
console.info("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable)
|
console.info("NetworkService: Switched to LegacyNetworkService, networkAvailable:", networkAvailable);
|
||||||
if (LegacyNetworkService.activate) {
|
if (LegacyNetworkService.activate) {
|
||||||
LegacyNetworkService.activate()
|
LegacyNetworkService.activate();
|
||||||
}
|
}
|
||||||
connectSignals()
|
connectSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectSignals() {
|
function connectSignals() {
|
||||||
if (activeService) {
|
if (activeService) {
|
||||||
if (activeService.networksUpdated) {
|
if (activeService.networksUpdated) {
|
||||||
activeService.networksUpdated.connect(root.networksUpdated)
|
activeService.networksUpdated.connect(root.networksUpdated);
|
||||||
}
|
}
|
||||||
if (activeService.connectionChanged) {
|
if (activeService.connectionChanged) {
|
||||||
activeService.connectionChanged.connect(root.connectionChanged)
|
activeService.connectionChanged.connect(root.connectionChanged);
|
||||||
}
|
}
|
||||||
if (activeService.credentialsNeeded) {
|
if (activeService.credentialsNeeded) {
|
||||||
activeService.credentialsNeeded.connect(root.credentialsNeeded)
|
activeService.credentialsNeeded.connect(root.credentialsNeeded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRef() {
|
function addRef() {
|
||||||
if (activeService && activeService.addRef) {
|
if (activeService && activeService.addRef) {
|
||||||
activeService.addRef()
|
activeService.addRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeRef() {
|
function removeRef() {
|
||||||
if (activeService && activeService.removeRef) {
|
if (activeService && activeService.removeRef) {
|
||||||
activeService.removeRef()
|
activeService.removeRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getState() {
|
function getState() {
|
||||||
if (activeService && activeService.getState) {
|
if (activeService && activeService.getState) {
|
||||||
activeService.getState()
|
activeService.getState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scanWifi() {
|
function scanWifi() {
|
||||||
if (activeService && activeService.scanWifi) {
|
if (activeService && activeService.scanWifi) {
|
||||||
activeService.scanWifi()
|
activeService.scanWifi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scanWifiNetworks() {
|
function scanWifiNetworks() {
|
||||||
if (activeService && activeService.scanWifiNetworks) {
|
if (activeService && activeService.scanWifiNetworks) {
|
||||||
activeService.scanWifiNetworks()
|
activeService.scanWifiNetworks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
function connectToWifi(ssid, password = "", username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
if (activeService && activeService.connectToWifi) {
|
if (activeService && activeService.connectToWifi) {
|
||||||
activeService.connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch)
|
activeService.connectToWifi(ssid, password, username, anonymousIdentity, domainSuffixMatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnectWifi() {
|
function disconnectWifi() {
|
||||||
if (activeService && activeService.disconnectWifi) {
|
if (activeService && activeService.disconnectWifi) {
|
||||||
activeService.disconnectWifi()
|
activeService.disconnectWifi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function forgetWifiNetwork(ssid) {
|
function forgetWifiNetwork(ssid) {
|
||||||
if (activeService && activeService.forgetWifiNetwork) {
|
if (activeService && activeService.forgetWifiNetwork) {
|
||||||
activeService.forgetWifiNetwork(ssid)
|
activeService.forgetWifiNetwork(ssid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleWifiRadio() {
|
function toggleWifiRadio() {
|
||||||
if (activeService && activeService.toggleWifiRadio) {
|
if (activeService && activeService.toggleWifiRadio) {
|
||||||
activeService.toggleWifiRadio()
|
activeService.toggleWifiRadio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableWifiDevice() {
|
function enableWifiDevice() {
|
||||||
if (activeService && activeService.enableWifiDevice) {
|
if (activeService && activeService.enableWifiDevice) {
|
||||||
activeService.enableWifiDevice()
|
activeService.enableWifiDevice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNetworkPreference(preference) {
|
function setNetworkPreference(preference) {
|
||||||
if (activeService && activeService.setNetworkPreference) {
|
if (activeService && activeService.setNetworkPreference) {
|
||||||
activeService.setNetworkPreference(preference)
|
activeService.setNetworkPreference(preference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConnectionPriority(type) {
|
function setConnectionPriority(type) {
|
||||||
if (activeService && activeService.setConnectionPriority) {
|
if (activeService && activeService.setConnectionPriority) {
|
||||||
activeService.setConnectionPriority(type)
|
activeService.setConnectionPriority(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
function connectToWifiAndSetPreference(ssid, password, username = "", anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
if (activeService && activeService.connectToWifiAndSetPreference) {
|
if (activeService && activeService.connectToWifiAndSetPreference) {
|
||||||
activeService.connectToWifiAndSetPreference(ssid, password, username, anonymousIdentity, domainSuffixMatch)
|
activeService.connectToWifiAndSetPreference(ssid, password, username, anonymousIdentity, domainSuffixMatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNetworkConnection(type) {
|
function toggleNetworkConnection(type) {
|
||||||
if (activeService && activeService.toggleNetworkConnection) {
|
if (activeService && activeService.toggleNetworkConnection) {
|
||||||
activeService.toggleNetworkConnection(type)
|
activeService.toggleNetworkConnection(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startAutoScan() {
|
function startAutoScan() {
|
||||||
if (activeService && activeService.startAutoScan) {
|
if (activeService && activeService.startAutoScan) {
|
||||||
activeService.startAutoScan()
|
activeService.startAutoScan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAutoScan() {
|
function stopAutoScan() {
|
||||||
if (activeService && activeService.stopAutoScan) {
|
if (activeService && activeService.stopAutoScan) {
|
||||||
activeService.stopAutoScan()
|
activeService.stopAutoScan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchNetworkInfo(ssid) {
|
function fetchNetworkInfo(ssid) {
|
||||||
if (activeService && activeService.fetchNetworkInfo) {
|
if (activeService && activeService.fetchNetworkInfo) {
|
||||||
activeService.fetchNetworkInfo(ssid)
|
activeService.fetchNetworkInfo(ssid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchWiredNetworkInfo(uuid) {
|
function fetchWiredNetworkInfo(uuid) {
|
||||||
if (activeService && activeService.fetchWiredNetworkInfo) {
|
if (activeService && activeService.fetchWiredNetworkInfo) {
|
||||||
activeService.fetchWiredNetworkInfo(uuid)
|
activeService.fetchWiredNetworkInfo(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNetworkInfo(ssid) {
|
function getNetworkInfo(ssid) {
|
||||||
if (activeService && activeService.getNetworkInfo) {
|
if (activeService && activeService.getNetworkInfo) {
|
||||||
return activeService.getNetworkInfo(ssid)
|
return activeService.getNetworkInfo(ssid);
|
||||||
}
|
}
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWiredNetworkInfo(uuid) {
|
function getWiredNetworkInfo(uuid) {
|
||||||
if (activeService && activeService.getWiredNetworkInfo) {
|
if (activeService && activeService.getWiredNetworkInfo) {
|
||||||
return activeService.getWiredNetworkInfo(uuid)
|
return activeService.getWiredNetworkInfo(uuid);
|
||||||
}
|
}
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshNetworkState() {
|
function refreshNetworkState() {
|
||||||
if (activeService && activeService.refreshNetworkState) {
|
if (activeService && activeService.refreshNetworkState) {
|
||||||
activeService.refreshNetworkState()
|
activeService.refreshNetworkState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToSpecificWiredConfig(uuid) {
|
function connectToSpecificWiredConfig(uuid) {
|
||||||
if (activeService && activeService.connectToSpecificWiredConfig) {
|
if (activeService && activeService.connectToSpecificWiredConfig) {
|
||||||
activeService.connectToSpecificWiredConfig(uuid)
|
activeService.connectToSpecificWiredConfig(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitCredentials(token, secrets, save) {
|
function submitCredentials(token, secrets, save) {
|
||||||
if (activeService && activeService.submitCredentials) {
|
if (activeService && activeService.submitCredentials) {
|
||||||
activeService.submitCredentials(token, secrets, save)
|
activeService.submitCredentials(token, secrets, save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelCredentials(token) {
|
function cancelCredentials(token) {
|
||||||
if (activeService && activeService.cancelCredentials) {
|
if (activeService && activeService.cancelCredentials) {
|
||||||
activeService.cancelCredentials(token)
|
activeService.cancelCredentials(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWifiAutoconnect(ssid, autoconnect) {
|
function setWifiAutoconnect(ssid, autoconnect) {
|
||||||
if (activeService && activeService.setWifiAutoconnect) {
|
if (activeService && activeService.setWifiAutoconnect) {
|
||||||
activeService.setWifiAutoconnect(ssid, autoconnect)
|
activeService.setWifiAutoconnect(ssid, autoconnect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user