mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
brightness: fix ddc erasing devices, fix OSD behaviors
This commit is contained in:
@@ -402,9 +402,8 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (modelData) {
|
||||
AudioService.suppressOSD = true;
|
||||
SessionData.suppressOSDTemporarily();
|
||||
modelData.audio.muted = !modelData.audio.muted;
|
||||
AudioService.suppressOSD = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,18 +445,9 @@ Rectangle {
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
trackColor: appVolumeRow.sliderTrackColor.a > 0 ? appVolumeRow.sliderTrackColor : Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
|
||||
onIsDraggingChanged: {
|
||||
if (isDragging) {
|
||||
AudioService.suppressOSD = true;
|
||||
} else {
|
||||
Qt.callLater(() => {
|
||||
AudioService.suppressOSD = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onSliderValueChanged: function (newValue) {
|
||||
if (modelData) {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
modelData.audio.volume = newValue / 100.0;
|
||||
if (newValue > 0 && modelData.audio.muted) {
|
||||
modelData.audio.muted = false;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -30,9 +27,8 @@ Row {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (defaultSink) {
|
||||
AudioService.suppressOSD = true
|
||||
defaultSink.audio.muted = !defaultSink.audio.muted
|
||||
AudioService.suppressOSD = false
|
||||
SessionData.suppressOSDTemporarily();
|
||||
defaultSink.audio.muted = !defaultSink.audio.muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,15 +36,19 @@ Row {
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: {
|
||||
if (!defaultSink) return "volume_off"
|
||||
if (!defaultSink)
|
||||
return "volume_off";
|
||||
|
||||
let volume = defaultSink.audio.volume
|
||||
let muted = defaultSink.audio.muted
|
||||
let volume = defaultSink.audio.volume;
|
||||
let muted = defaultSink.audio.muted;
|
||||
|
||||
if (muted || volume === 0.0) return "volume_off"
|
||||
if (volume <= 0.33) return "volume_down"
|
||||
if (volume <= 0.66) return "volume_up"
|
||||
return "volume_up"
|
||||
if (muted || volume === 0.0)
|
||||
return "volume_off";
|
||||
if (volume <= 0.33)
|
||||
return "volume_down";
|
||||
if (volume <= 0.66)
|
||||
return "volume_up";
|
||||
return "volume_up";
|
||||
}
|
||||
size: Theme.iconSize
|
||||
color: defaultSink && !defaultSink.audio.muted && defaultSink.audio.volume > 0 ? Theme.primary : Theme.surfaceText
|
||||
@@ -70,22 +70,15 @@ Row {
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
trackColor: root.sliderTrackColor.a > 0 ? root.sliderTrackColor : Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
|
||||
onIsDraggingChanged: {
|
||||
if (isDragging) {
|
||||
AudioService.suppressOSD = true
|
||||
} else {
|
||||
Qt.callLater(() => { AudioService.suppressOSD = false })
|
||||
}
|
||||
}
|
||||
|
||||
onSliderValueChanged: function(newValue) {
|
||||
onSliderValueChanged: function (newValue) {
|
||||
if (defaultSink) {
|
||||
defaultSink.audio.volume = newValue / 100.0
|
||||
SessionData.suppressOSDTemporarily();
|
||||
defaultSink.audio.volume = newValue / 100.0;
|
||||
if (newValue > 0 && defaultSink.audio.muted) {
|
||||
defaultSink.audio.muted = false
|
||||
defaultSink.audio.muted = false;
|
||||
}
|
||||
AudioService.playVolumeChangeSoundIfEnabled()
|
||||
AudioService.playVolumeChangeSoundIfEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -30,9 +27,8 @@ Row {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (defaultSource) {
|
||||
AudioService.suppressOSD = true
|
||||
defaultSource.audio.muted = !defaultSource.audio.muted
|
||||
AudioService.suppressOSD = false
|
||||
SessionData.suppressOSDTemporarily();
|
||||
defaultSource.audio.muted = !defaultSource.audio.muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,13 +36,15 @@ Row {
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: {
|
||||
if (!defaultSource) return "mic_off"
|
||||
if (!defaultSource)
|
||||
return "mic_off";
|
||||
|
||||
let volume = defaultSource.audio.volume
|
||||
let muted = defaultSource.audio.muted
|
||||
let volume = defaultSource.audio.volume;
|
||||
let muted = defaultSource.audio.muted;
|
||||
|
||||
if (muted || volume === 0.0) return "mic_off"
|
||||
return "mic"
|
||||
if (muted || volume === 0.0)
|
||||
return "mic_off";
|
||||
return "mic";
|
||||
}
|
||||
size: Theme.iconSize
|
||||
color: defaultSource && !defaultSource.audio.muted && defaultSource.audio.volume > 0 ? Theme.primary : Theme.surfaceText
|
||||
@@ -67,16 +65,14 @@ Row {
|
||||
valueOverride: actualVolumePercent
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
trackColor: root.sliderTrackColor.a > 0 ? root.sliderTrackColor : Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
onIsDraggingChanged: {
|
||||
AudioService.suppressOSD = isDragging
|
||||
}
|
||||
onSliderValueChanged: function(newValue) {
|
||||
onSliderValueChanged: function (newValue) {
|
||||
if (defaultSource) {
|
||||
defaultSource.audio.volume = newValue / 100.0
|
||||
SessionData.suppressOSDTemporarily();
|
||||
defaultSource.audio.volume = newValue / 100.0;
|
||||
if (newValue > 0 && defaultSource.audio.muted) {
|
||||
defaultSource.audio.muted = false
|
||||
defaultSource.audio.muted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ Item {
|
||||
const current = Math.round(currentVolume * 100);
|
||||
const newVolume = Math.min(100, Math.max(0, current + step));
|
||||
|
||||
SessionData.suppressOSDTemporarily();
|
||||
if (usePlayerVolume) {
|
||||
activePlayer.volume = newVolume / 100;
|
||||
} else if (AudioService.sink?.audio) {
|
||||
@@ -790,6 +791,7 @@ Item {
|
||||
volumeButtonExited();
|
||||
}
|
||||
onClicked: {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
if (currentVolume > 0) {
|
||||
volumeButton.previousVolume = currentVolume;
|
||||
if (usePlayerVolume) {
|
||||
@@ -807,6 +809,7 @@ Item {
|
||||
}
|
||||
}
|
||||
onWheel: wheelEvent => {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
const delta = wheelEvent.angleDelta.y;
|
||||
const current = (currentVolume * 100) || 0;
|
||||
const newVolume = delta > 0 ? Math.min(100, current + 5) : Math.max(0, current - 5);
|
||||
|
||||
@@ -17,14 +17,14 @@ DankOSD {
|
||||
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
|
||||
|
||||
function onVolumeChanged() {
|
||||
if (!AudioService.suppressOSD && SettingsData.osdVolumeEnabled) {
|
||||
root.show()
|
||||
if (SettingsData.osdVolumeEnabled) {
|
||||
root.show();
|
||||
}
|
||||
}
|
||||
|
||||
function onMutedChanged() {
|
||||
if (!AudioService.suppressOSD && SettingsData.osdVolumeEnabled) {
|
||||
root.show()
|
||||
if (SettingsData.osdVolumeEnabled) {
|
||||
root.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ DankOSD {
|
||||
|
||||
function onSinkChanged() {
|
||||
if (root.shouldBeVisible && SettingsData.osdVolumeEnabled) {
|
||||
root.show()
|
||||
root.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,10 +76,10 @@ DankOSD {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
AudioService.toggleMute()
|
||||
AudioService.toggleMute();
|
||||
}
|
||||
onContainsMouseChanged: {
|
||||
setChildHovered(containsMouse || volumeSlider.containsMouse)
|
||||
setChildHovered(containsMouse || volumeSlider.containsMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,21 +105,20 @@ DankOSD {
|
||||
|
||||
Component.onCompleted: {
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100))
|
||||
value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100));
|
||||
}
|
||||
}
|
||||
|
||||
onSliderValueChanged: newValue => {
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
AudioService.suppressOSD = true
|
||||
AudioService.sink.audio.volume = newValue / 100
|
||||
AudioService.suppressOSD = false
|
||||
resetHideTimer()
|
||||
}
|
||||
}
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
AudioService.sink.audio.volume = newValue / 100;
|
||||
resetHideTimer();
|
||||
}
|
||||
}
|
||||
|
||||
onContainsMouseChanged: {
|
||||
setChildHovered(containsMouse || muteButton.containsMouse)
|
||||
setChildHovered(containsMouse || muteButton.containsMouse);
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -127,7 +126,7 @@ DankOSD {
|
||||
|
||||
function onVolumeChanged() {
|
||||
if (volumeSlider && !volumeSlider.pressed) {
|
||||
volumeSlider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100))
|
||||
volumeSlider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,10 +163,10 @@ DankOSD {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
AudioService.toggleMute()
|
||||
AudioService.toggleMute();
|
||||
}
|
||||
onContainsMouseChanged: {
|
||||
setChildHovered(containsMouse || vertSliderArea.containsMouse)
|
||||
setChildHovered(containsMouse || vertSliderArea.containsMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,9 +206,9 @@ DankOSD {
|
||||
height: 8
|
||||
radius: Theme.cornerRadius
|
||||
y: {
|
||||
const ratio = vertSlider.value / 100
|
||||
const travel = parent.height - height
|
||||
return Math.max(0, Math.min(travel, travel * (1 - ratio)))
|
||||
const ratio = vertSlider.value / 100;
|
||||
const travel = parent.height - height;
|
||||
return Math.max(0, Math.min(travel, travel * (1 - ratio)));
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: Theme.primary
|
||||
@@ -226,36 +225,35 @@ DankOSD {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onContainsMouseChanged: {
|
||||
setChildHovered(containsMouse || muteButtonVert.containsMouse)
|
||||
setChildHovered(containsMouse || muteButtonVert.containsMouse);
|
||||
}
|
||||
|
||||
onPressed: mouse => {
|
||||
vertSlider.dragging = true
|
||||
updateVolume(mouse)
|
||||
vertSlider.dragging = true;
|
||||
updateVolume(mouse);
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
vertSlider.dragging = false
|
||||
vertSlider.dragging = false;
|
||||
}
|
||||
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed) {
|
||||
updateVolume(mouse)
|
||||
updateVolume(mouse);
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: mouse => {
|
||||
updateVolume(mouse)
|
||||
updateVolume(mouse);
|
||||
}
|
||||
|
||||
function updateVolume(mouse) {
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
const ratio = 1.0 - (mouse.y / height)
|
||||
const volume = Math.max(0, Math.min(100, Math.round(ratio * 100)))
|
||||
AudioService.suppressOSD = true
|
||||
AudioService.sink.audio.volume = volume / 100
|
||||
AudioService.suppressOSD = false
|
||||
resetHideTimer()
|
||||
const ratio = 1.0 - (mouse.y / height);
|
||||
const volume = Math.max(0, Math.min(100, Math.round(ratio * 100)));
|
||||
SessionData.suppressOSDTemporarily();
|
||||
AudioService.sink.audio.volume = volume / 100;
|
||||
resetHideTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +263,7 @@ DankOSD {
|
||||
|
||||
function onVolumeChanged() {
|
||||
if (!vertSlider.dragging) {
|
||||
vertSlider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100))
|
||||
vertSlider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,9 +284,9 @@ DankOSD {
|
||||
onOsdShown: {
|
||||
if (AudioService.sink && AudioService.sink.audio && contentLoader.item && contentLoader.item.item) {
|
||||
if (!useVertical) {
|
||||
const slider = contentLoader.item.item.children[0].children[1]
|
||||
const slider = contentLoader.item.item.children[0].children[1];
|
||||
if (slider && slider.value !== undefined) {
|
||||
slider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100))
|
||||
slider.value = Math.min(100, Math.round(AudioService.sink.audio.volume * 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user