mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Apply the same logic to other two pills (Brightness and Volume)
This commit is contained in:
+20
-5
@@ -8,6 +8,7 @@ Item {
|
||||
id: volumeDisplay
|
||||
property var shell
|
||||
property int volume: 0
|
||||
property bool firstChange: true
|
||||
|
||||
width: pillIndicator.width
|
||||
height: pillIndicator.height
|
||||
@@ -23,13 +24,14 @@ Item {
|
||||
iconCircleColor: Theme.accentPrimary
|
||||
iconTextColor: Theme.backgroundPrimary
|
||||
textColor: Theme.textPrimary
|
||||
autoHide: true
|
||||
|
||||
StyledTooltip {
|
||||
id: volumeTooltip
|
||||
text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection."
|
||||
tooltipVisible: !ioSelector.visible && volumeDisplay.containsMouse
|
||||
targetItem: pillIndicator
|
||||
delay: 200
|
||||
delay: 1500
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -57,7 +59,13 @@ Item {
|
||||
pillIndicator.icon = shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted
|
||||
? "volume_off"
|
||||
: (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up"));
|
||||
pillIndicator.show();
|
||||
|
||||
if (firstChange) {
|
||||
firstChange = false
|
||||
}
|
||||
else {
|
||||
pillIndicator.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +74,6 @@ Item {
|
||||
Component.onCompleted: {
|
||||
if (shell && shell.volume !== undefined) {
|
||||
volume = Math.max(0, Math.min(100, shell.volume));
|
||||
pillIndicator.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +82,16 @@ Item {
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
propagateComposedEvents: true
|
||||
onEntered: volumeDisplay.containsMouse = true
|
||||
onExited: volumeDisplay.containsMouse = false
|
||||
onEntered: {
|
||||
volumeDisplay.containsMouse = true
|
||||
pillIndicator.autoHide = false;
|
||||
pillIndicator.show()
|
||||
}
|
||||
onExited: {
|
||||
volumeDisplay.containsMouse = false
|
||||
pillIndicator.autoHide = true;
|
||||
pillIndicator.hide()
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onWheel: (wheel) => {
|
||||
if (!shell) return;
|
||||
|
||||
Reference in New Issue
Block a user