1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-08 06:25:37 -05:00

night mode repairs

This commit is contained in:
bbedward
2025-08-29 14:23:37 -04:00
parent 3746b1cfad
commit 108fdd9b7f
9 changed files with 651 additions and 947 deletions

View File

@@ -117,7 +117,7 @@ DankPopout {
width: parent.width - Theme.spacingL * 2
x: Theme.spacingL
y: Theme.spacingL
spacing: Theme.spacingL
spacing: Theme.spacingS
Rectangle {
width: parent.width
@@ -630,16 +630,30 @@ DankPopout {
}
Row {
Item {
width: parent.width
spacing: Theme.spacingM
height: audioSliderRow.implicitHeight
Row {
id: audioSliderRow
x: -Theme.spacingS
width: parent.width + Theme.spacingS * 2
spacing: Theme.spacingM
AudioSliderRow {
width: (parent.width - Theme.spacingM) / 2
}
AudioSliderRow {
width: (parent.width - Theme.spacingM) / 2
}
BrightnessSliderRow {
width: (parent.width - Theme.spacingM) / 2
Item {
width: (parent.width - Theme.spacingM) / 2
height: parent.height
BrightnessSliderRow {
width: parent.width
height: parent.height
x: -Theme.spacingS
}
}
}
}
@@ -776,11 +790,11 @@ DankPopout {
ToggleButton {
width: (parent.width - Theme.spacingM) / 2
iconName: DisplayService.nightModeActive ? "nightlight" : "dark_mode"
iconName: DisplayService.nightModeEnabled ? "nightlight" : "dark_mode"
text: "Night Mode"
secondaryText: DisplayService.nightModeActive ? "On" : "Off"
isActive: true
enabled: DisplayService.brightnessAvailable
secondaryText: DisplayService.nightModeEnabled ? "On" : "Off"
isActive: DisplayService.nightModeEnabled
enabled: DisplayService.automationAvailable
onClicked: DisplayService.toggleNightMode()
}

View File

@@ -11,8 +11,8 @@ Row {
property var defaultSink: AudioService.sink
height: 60
spacing: Theme.spacingM
height: 40
spacing: Theme.spacingS
Rectangle {
width: Theme.iconSize + Theme.spacingS * 2
@@ -58,10 +58,7 @@ Row {
DankSlider {
anchors.verticalCenter: parent.verticalCenter
width: {
if (parent.width <= 0) return 80
return Math.max(80, Math.min(400, parent.width - (Theme.iconSize + Theme.spacingS * 2) - Theme.spacingM))
}
width: parent.width - (Theme.iconSize + Theme.spacingS * 2) - Theme.spacingM
enabled: defaultSink !== null
minimum: 0
maximum: 100

View File

@@ -8,15 +8,15 @@ import qs.Widgets
Row {
id: root
height: 60
spacing: Theme.spacingM
height: 40
spacing: Theme.spacingS
Rectangle {
width: Theme.iconSize + Theme.spacingS * 2
height: Theme.iconSize + Theme.spacingS * 2
anchors.verticalCenter: parent.verticalCenter
radius: (Theme.iconSize + Theme.spacingS * 2) / 2
color: iconArea.containsMouse && DisplayService.devices.length > 1
color: iconArea.containsMouse
? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
: "transparent"
@@ -27,8 +27,8 @@ Row {
MouseArea {
id: iconArea
anchors.fill: parent
hoverEnabled: DisplayService.devices.length > 1
cursorShape: DisplayService.devices.length > 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: function(event) {
if (DisplayService.devices.length > 1) {
@@ -57,55 +57,27 @@ Row {
}
}
Column {
DankSlider {
anchors.verticalCenter: parent.verticalCenter
width: parent.width - (Theme.iconSize + Theme.spacingS * 2) - Theme.spacingM
spacing: 0
DankSlider {
width: parent.width
enabled: DisplayService.brightnessAvailable
minimum: 1
maximum: 100
value: {
let level = DisplayService.brightnessLevel
if (level > 100) {
let deviceInfo = DisplayService.getCurrentDeviceInfo()
if (deviceInfo && deviceInfo.max > 0) {
return Math.round((level / deviceInfo.max) * 100)
}
return 50
}
return level
}
onSliderValueChanged: function(newValue) {
if (DisplayService.brightnessAvailable) {
DisplayService.setBrightness(newValue)
enabled: DisplayService.brightnessAvailable
minimum: 1
maximum: 100
value: {
let level = DisplayService.brightnessLevel
if (level > 100) {
let deviceInfo = DisplayService.getCurrentDeviceInfo()
if (deviceInfo && deviceInfo.max > 0) {
return Math.round((level / deviceInfo.max) * 100)
}
return 50
}
return level
}
StyledText {
visible: {
if (DisplayService.devices.length <= 1) return false
if (!DisplayService.currentDevice) return false
let currentIndex = -1
for (let i = 0; i < DisplayService.devices.length; i++) {
if (DisplayService.devices[i].name === DisplayService.currentDevice) {
currentIndex = i
break
}
}
return currentIndex !== 0
onSliderValueChanged: function(newValue) {
if (DisplayService.brightnessAvailable) {
DisplayService.setBrightness(newValue)
}
width: parent.width
text: DisplayService.currentDevice || ""
font.pixelSize: Theme.fontSizeSmall - 2
color: Theme.surfaceVariantText
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
topPadding: 2
}
}