Volume/Bar: better touchpad support for volume inc/dec
This commit is contained in:
parent
57a67bf4df
commit
c8860a3a9d
1 changed files with 8 additions and 3 deletions
|
|
@ -14,10 +14,12 @@ Item {
|
||||||
|
|
||||||
// Used to avoid opening the pill on Quickshell startup
|
// Used to avoid opening the pill on Quickshell startup
|
||||||
property bool firstVolumeReceived: false
|
property bool firstVolumeReceived: false
|
||||||
|
property int wheelAccumulator: 0
|
||||||
|
|
||||||
implicitWidth: pill.width
|
implicitWidth: pill.width
|
||||||
implicitHeight: pill.height
|
implicitHeight: pill.height
|
||||||
|
|
||||||
|
|
||||||
function getIcon() {
|
function getIcon() {
|
||||||
if (AudioService.muted) {
|
if (AudioService.muted) {
|
||||||
return "volume_off"
|
return "volume_off"
|
||||||
|
|
@ -59,10 +61,13 @@ Item {
|
||||||
tooltipText: "Volume: " + Math.round(
|
tooltipText: "Volume: " + Math.round(
|
||||||
AudioService.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
AudioService.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||||
|
|
||||||
onWheel: function (angle) {
|
onWheel: function (delta) {
|
||||||
if (angle > 0) {
|
wheelAccumulator += delta
|
||||||
|
if (wheelAccumulator >= 120) {
|
||||||
|
wheelAccumulator = 0
|
||||||
AudioService.increaseVolume()
|
AudioService.increaseVolume()
|
||||||
} else if (angle < 0) {
|
} else if (wheelAccumulator <= -120) {
|
||||||
|
wheelAccumulator = 0
|
||||||
AudioService.decreaseVolume()
|
AudioService.decreaseVolume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue