diff --git a/modules/Backlight.qml b/modules/Backlight.qml index 8eddbf2..4fed877 100644 --- a/modules/Backlight.qml +++ b/modules/Backlight.qml @@ -9,6 +9,18 @@ Row { property int percent: 0 + Process { + id: adjProc + property string cmd: "" + command: ["sh", "-c", cmd] + onRunningChanged: if (!running && cmd !== "") current.reload() + } + + function adjust(delta) { + adjProc.cmd = delta > 0 ? "light -A 5" : "light -U 5"; + adjProc.running = true; + } + FileView { id: current path: "/sys/class/backlight/intel_backlight/brightness" @@ -36,4 +48,8 @@ Row { font.family: M.Theme.fontFamily anchors.verticalCenter: parent.verticalCenter } + + WheelHandler { + onWheel: event => root.adjust(event.angleDelta.y) + } } diff --git a/modules/PowerProfile.qml b/modules/PowerProfile.qml index b26d6ff..c20b01a 100644 --- a/modules/PowerProfile.qml +++ b/modules/PowerProfile.qml @@ -28,4 +28,20 @@ M.BarIcon { repeat: true onTriggered: proc.running = true } + + Process { + id: setter + property string next: "" + command: ["powerprofilesctl", "set", next] + onRunningChanged: if (!running && next !== "") proc.running = true + } + + TapHandler { + onTapped: { + const cycle = ["performance", "balanced", "power-saver"]; + const idx = cycle.indexOf(root.profile); + setter.next = cycle[(idx + 1) % cycle.length]; + setter.running = true; + } + } } diff --git a/modules/Volume.qml b/modules/Volume.qml index 92a5609..29fac1d 100644 --- a/modules/Volume.qml +++ b/modules/Volume.qml @@ -26,4 +26,11 @@ Row { TapHandler { onTapped: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted } + + WheelHandler { + onWheel: event => { + if (!root.sink?.audio) return; + root.sink.audio.volume = Math.max(0, root.sink.audio.volume + (event.angleDelta.y > 0 ? 0.05 : -0.05)); + } + } }