mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
brightness: remove brightnessctl + ddcutil dependencies
- Switches to DMS API v13+ dependency
This commit is contained in:
@@ -13,7 +13,7 @@ Row {
|
||||
property string screenName: ""
|
||||
property var parentScreen: null
|
||||
|
||||
signal iconClicked()
|
||||
signal iconClicked
|
||||
|
||||
height: 40
|
||||
spacing: 0
|
||||
@@ -36,13 +36,27 @@ Row {
|
||||
|
||||
if (deviceName && deviceName.length > 0) {
|
||||
const found = DisplayService.devices.find(dev => dev.name === deviceName)
|
||||
return found ? found.name : ""
|
||||
if (found) {
|
||||
return found.name
|
||||
}
|
||||
}
|
||||
|
||||
const currentDeviceName = DisplayService.currentDevice
|
||||
if (currentDeviceName) {
|
||||
const found = DisplayService.devices.find(dev => dev.name === currentDeviceName)
|
||||
return found ? found.name : ""
|
||||
if (found) {
|
||||
return found.name
|
||||
}
|
||||
}
|
||||
|
||||
const backlight = DisplayService.devices.find(d => d.class === "backlight")
|
||||
if (backlight) {
|
||||
return backlight.name
|
||||
}
|
||||
|
||||
const ddc = DisplayService.devices.find(d => d.class === "ddc")
|
||||
if (ddc) {
|
||||
return ddc.name
|
||||
}
|
||||
|
||||
return DisplayService.devices.length > 0 ? DisplayService.devices[0].name : ""
|
||||
@@ -69,9 +83,7 @@ Row {
|
||||
height: Theme.iconSize + Theme.spacingS * 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
radius: (Theme.iconSize + Theme.spacingS * 2) / 2
|
||||
color: iconArea.containsMouse
|
||||
? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
||||
: Theme.withAlpha(Theme.primary, 0)
|
||||
color: iconArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Theme.withAlpha(Theme.primary, 0)
|
||||
|
||||
MouseArea {
|
||||
id: iconArea
|
||||
@@ -112,8 +124,10 @@ Row {
|
||||
|
||||
if (targetDevice.class === "backlight" || targetDevice.class === "ddc") {
|
||||
const brightness = targetBrightness
|
||||
if (brightness <= 33) return "brightness_low"
|
||||
if (brightness <= 66) return "brightness_medium"
|
||||
if (brightness <= 33)
|
||||
return "brightness_low"
|
||||
if (brightness <= 66)
|
||||
return "brightness_medium"
|
||||
return "brightness_high"
|
||||
} else if (targetDevice.name.includes("kbd")) {
|
||||
return "keyboard"
|
||||
@@ -134,7 +148,7 @@ Row {
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
value: targetBrightness
|
||||
onSliderValueChanged: function(newValue) {
|
||||
onSliderValueChanged: function (newValue) {
|
||||
if (DisplayService.brightnessAvailable && targetDeviceName) {
|
||||
DisplayService.setBrightness(newValue, targetDeviceName, true)
|
||||
}
|
||||
@@ -148,4 +162,4 @@ Row {
|
||||
active: false
|
||||
sourceComponent: DankTooltip {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user