Commit aa2e5c5f authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[AppMenu Applet] Underline mnemonics only while Alt is pressed

This makes for a less cluttered appearance and is what Breeze does by default.

BUG: 389118
FIXED-IN: 5.13.0

Differential Revision: https://phabricator.kde.org/D9948
parent 6f60e862
......@@ -79,6 +79,13 @@ Item {
});
}
// So we can show mnemonic underlines only while Alt is pressed
PlasmaCore.DataSource {
id: keystateSource
engine: "keystate"
connectedSources: ["Alt"]
}
Repeater {
id: buttonRepeater
model: appMenuModel
......@@ -89,7 +96,19 @@ Item {
Layout.preferredWidth: minimumWidth
Layout.fillWidth: root.vertical
Layout.fillHeight: !root.vertical
text: activeMenu
text: {
var text = activeMenu;
var alt = keystateSource.data.Alt;
if (!alt || !alt.Pressed) {
// StyleHelpers.removeMnemonics
text = text.replace(/([^&]*)&(.)([^&]*)/g, function (match, p1, p2, p3) {
return p1.concat(p2, p3);
});
}
return text;
}
// fake highlighted
checkable: plasmoid.nativeInterface.currentIndex === index
checked: checkable
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment