volumeosd: Properly bind volume keys

Partially addresses https://invent.kde.org/plasma/plasma-mobile/-/issues/328

Apparently in in Qt 6 the "shortcut" property in QAction no longer maps properly to the given Qt key??

Qt.Key_VolumeUp/Qt.Key_VolumeDown -> no key

Then I tried putting in Qt.Key_A which mapped to Qt.Key_Ctrl + Qt.Key_Q... Using the `shortcuts` property made it work properly here.

This will be obsolete with Plasma 6.1 https://invent.kde.org/plasma/plasma-pa/-/merge_requests/221
This commit is contained in:
Devin Lin 2024-03-19 21:56:48 -04:00
parent 4cfe0fdb2e
commit b496110aa3

View file

@ -44,21 +44,21 @@ QtObject {
VolumeLib.GlobalAction { VolumeLib.GlobalAction {
objectName: "increase_volume" objectName: "increase_volume"
text: i18n("Increase Volume") text: i18n("Increase Volume")
shortcut: Qt.Key_VolumeUp shortcuts: [Qt.Key_VolumeUp]
onTriggered: MobileShell.AudioInfo.increaseVolume() onTriggered: MobileShell.AudioInfo.increaseVolume()
} }
VolumeLib.GlobalAction { VolumeLib.GlobalAction {
objectName: "decrease_volume" objectName: "decrease_volume"
text: i18n("Decrease Volume") text: i18n("Decrease Volume")
shortcut: Qt.Key_VolumeDown shortcuts: [Qt.Key_VolumeDown]
onTriggered: MobileShell.AudioInfo.decreaseVolume() onTriggered: MobileShell.AudioInfo.decreaseVolume()
} }
VolumeLib.GlobalAction { VolumeLib.GlobalAction {
objectName: "mute" objectName: "mute"
text: i18n("Mute") text: i18n("Mute")
shortcut: Qt.Key_VolumeMute shortcuts: [Qt.Key_VolumeMute]
onTriggered: MobileShell.AudioInfo.muteVolume() onTriggered: MobileShell.AudioInfo.muteVolume()
} }
} }