fix(cheatsheet): change config keys

This commit is contained in:
Madjid Taha
2025-11-04 20:55:34 +01:00
parent a28945f3ec
commit ede86dc7a7
3 changed files with 119 additions and 118 deletions
@@ -69,12 +69,12 @@ Item {
"Return": "Enter", "Return": "Enter",
// "Shift": "", // "Shift": "",
}, },
!!Config.options.appearance.keybinds.superKey ? { !!Config.options.cheatsheet.superKey ? {
"Super": Config.options.appearance.keybinds.superKey, "Super": Config.options.cheatsheet.superKey,
}: {}, }: {},
Config.options.appearance.keybinds.useMacSymbol ? macSymbolMap : {}, Config.options.cheatsheet.useMacSymbol ? macSymbolMap : {},
Config.options.appearance.keybinds.useFnSymbol ? functionSymbolMap : {}, Config.options.cheatsheet.useFnSymbol ? functionSymbolMap : {},
Config.options.appearance.keybinds.useMouseSymbol ? mouseSymbolMap : {}, Config.options.cheatsheet.useMouseSymbol ? mouseSymbolMap : {},
) )
Row { // Keybind columns Row { // Keybind columns
@@ -126,7 +126,7 @@ Item {
for (var i = 0; i < keybindSection.modelData.keybinds.length; i++) { for (var i = 0; i < keybindSection.modelData.keybinds.length; i++) {
const keybind = keybindSection.modelData.keybinds[i]; const keybind = keybindSection.modelData.keybinds[i];
if (Config.options.appearance.keybinds.useMacLikeShortcut) { if (!Config.options.cheatsheet.splitButtons) {
for (var j = 0; j < keybind.mods.length; j++) { for (var j = 0; j < keybind.mods.length; j++) {
keybind.mods[j] = keySubstitutions[keybind.mods[j]] || keybind.mods[j]; keybind.mods[j] = keySubstitutions[keybind.mods[j]] || keybind.mods[j];
@@ -167,19 +167,19 @@ Item {
delegate: KeyboardKey { delegate: KeyboardKey {
required property var modelData required property var modelData
key: keySubstitutions[modelData] || modelData key: keySubstitutions[modelData] || modelData
pixelSize: Config.options.appearance.keybinds.fontSize.key pixelSize: Config.options.cheatsheet.fontSize.key
} }
} }
StyledText { StyledText {
id: keybindPlus id: keybindPlus
visible: !Config.options.appearance.keybinds.useMacLikeShortcut && !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0 visible: Config.options.cheatsheet.splitButtons && !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0
text: "+" text: "+"
} }
KeyboardKey { KeyboardKey {
id: keybindKey id: keybindKey
visible: !Config.options.appearance.keybinds.useMacLikeShortcut && !keyBlacklist.includes(modelData.key) visible: Config.options.cheatsheet.splitButtons && !keyBlacklist.includes(modelData.key)
key: keySubstitutions[modelData.key] || modelData.key key: keySubstitutions[modelData.key] || modelData.key
pixelSize: Config.options.appearance.keybinds.fontSize.key pixelSize: Config.options.cheatsheet.fontSize.key
color: Appearance.colors.colOnLayer0 color: Appearance.colors.colOnLayer0
} }
} }
@@ -195,7 +195,7 @@ Item {
StyledText { StyledText {
id: commentText id: commentText
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: Config.options.appearance.keybinds.fontSize.comment || Appearance.font.pixelSize.smaller font.pixelSize: Config.options.cheatsheet.fontSize.comment || Appearance.font.pixelSize.smaller
text: modelData.comment text: modelData.comment
} }
} }
@@ -123,21 +123,6 @@ Singleton {
property JsonObject palette: JsonObject { property JsonObject palette: JsonObject {
property string type: "auto" // Allowed: auto, scheme-content, scheme-expressive, scheme-fidelity, scheme-fruit-salad, scheme-monochrome, scheme-neutral, scheme-rainbow, scheme-tonal-spot property string type: "auto" // Allowed: auto, scheme-content, scheme-expressive, scheme-fidelity, scheme-fruit-salad, scheme-monochrome, scheme-neutral, scheme-rainbow, scheme-tonal-spot
} }
property JsonObject keybinds: JsonObject {
// Use a nerdfont to see the icons
// 0: 󰖳 | 1: 󰌽 | 2: 󰘳 | 3:  | 4: 󰨡
// 5:  | 6:  | 7: 󰣇 | 8:  | 9: 
// 10:  | 11:  | 12:  | 13:  | 14: 󱄛
property string superKey: "󰖳"
property bool useMacSymbol: false
property bool useMacLikeShortcut: false
property bool useMouseSymbol: false
property bool useFnSymbol: false
property JsonObject fontSize: JsonObject {
property int key: Appearance.font.pixelSize.smaller
property int comment: Appearance.font.pixelSize.smaller
}
}
} }
property JsonObject audio: JsonObject { property JsonObject audio: JsonObject {
@@ -274,6 +259,22 @@ Singleton {
property int suspend: 3 property int suspend: 3
} }
property JsonObject cheatsheet: JsonObject {
// Use a nerdfont to see the icons
// 0: 󰖳 | 1: 󰌽 | 2: 󰘳 | 3:  | 4: 󰨡
// 5:  | 6:  | 7: 󰣇 | 8:  | 9: 
// 10:  | 11:  | 12:  | 13:  | 14: 󱄛
property string superKey: "󰖳"
property bool useMacSymbol: false
property bool splitButtons: true
property bool useMouseSymbol: false
property bool useFnSymbol: false
property JsonObject fontSize: JsonObject {
property int key: Appearance.font.pixelSize.smaller
property int comment: Appearance.font.pixelSize.smaller
}
}
property JsonObject conflictKiller: JsonObject { property JsonObject conflictKiller: JsonObject {
property bool autoKillNotificationDaemons: false property bool autoKillNotificationDaemons: false
property bool autoKillTrays: false property bool autoKillTrays: false
@@ -402,6 +402,98 @@ ContentPage {
} }
} }
ContentSection {
icon: "keyboard"
title: Translation.tr("Cheat sheet")
ContentSubsection {
title: Translation.tr("Super key symbol")
tooltip: Translation.tr("Choose a symbol from this list or edit config.json and add your own nerd symbol in cheatsheet.superKey.")
ConfigSelectionArray {
currentValue: Config.options.cheatsheet.superKey
onSelected: newValue => {
Config.options.cheatsheet.superKey = newValue;
}
// Use a nerdfont to see the icons
options: ([
"󰖳", "", "󰨡", "", "󰌽", "󰣇", "", "", "",
"", "", "󱄛", "", "", "⌘", "󰀲", "󰟍", ""
]).map(icon => { return {
displayName: icon,
value: icon
}
})
}
}
ConfigSwitch {
buttonIcon: "󰘵"
text: Translation.tr("Use macOS-like symbols for mods keys")
checked: Config.options.cheatsheet.useMacSymbol
onCheckedChanged: {
Config.options.cheatsheet.useMacSymbol = checked;
}
StyledToolTip {
text: Translation.tr("e.g. 󰘴 for Ctrl, 󰘵 for Alt, 󰘶 for Shift, etc")
}
}
ConfigSwitch {
buttonIcon: "󱊶"
text: Translation.tr("Use symbols for function keys")
checked: Config.options.cheatsheet.useFnSymbol
onCheckedChanged: {
Config.options.cheatsheet.useFnSymbol = checked;
}
StyledToolTip {
text: Translation.tr("e.g. 󱊫 for F1, 󱊶 for F12")
}
}
ConfigSwitch {
buttonIcon: "󰍽"
text: Translation.tr("Use symbols for mouse")
checked: Config.options.cheatsheet.useMouseSymbol
onCheckedChanged: {
Config.options.cheatsheet.useMouseSymbol = checked;
}
StyledToolTip {
text: Translation.tr("Replace 󱕐 for \"Scroll ↓\", 󱕑 \"Scroll ↑\", L󰍽 \"LMB\", R󰍽 \"RMB\", 󱕒 \"Scroll ↑/↓\" and ⇞/⇟ for \"Page_↑/↓\"")
}
}
ConfigSwitch {
buttonIcon: "highlight_keyboard_focus"
text: Translation.tr("Split Buttons")
checked: Config.options.cheatsheet.splitButtons
onCheckedChanged: {
Config.options.cheatsheet.splitButtons = checked;
}
StyledToolTip {
text: Translation.tr("Display modifiers and keys in multiple keycap (e.g., \"Ctrl + A\" instead of \"Ctrl A\" or \"󰘴 + A\" instead of \"󰘴 A\")")
}
}
ConfigSpinBox {
text: Translation.tr("Keybind font size")
value: Config.options.cheatsheet.fontSize.key
from: 8
to: 30
stepSize: 1
onValueChanged: {
Config.options.cheatsheet.fontSize.key = value;
}
}
ConfigSpinBox {
text: Translation.tr("Description font size")
value: Config.options.cheatsheet.fontSize.comment
from: 8
to: 30
stepSize: 1
onValueChanged: {
Config.options.cheatsheet.fontSize.comment = value;
}
}
}
ContentSection { ContentSection {
icon: "point_scan" icon: "point_scan"
title: Translation.tr("Crosshair overlay") title: Translation.tr("Crosshair overlay")
@@ -1021,96 +1113,4 @@ ContentPage {
} }
} }
ContentSection {
icon: "keyboard"
title: Translation.tr("Cheatsheet")
ContentSubsection {
title: Translation.tr("Super Key Symbol")
tooltip: Translation.tr("Choose a symbol from this list or edit config.json and add your own nerd symbol in appearance.keybinds.superKey.")
ConfigSelectionArray {
currentValue: Config.options.appearance.keybinds.superKey
onSelected: newValue => {
Config.options.appearance.keybinds.superKey = newValue;
}
// Use a nerdfont to see the icons
options: ([
"󰖳", "", "󰨡", "", "󰌽", "󰣇", "", "", "",
"", "", "󱄛", "", "", "⌘", "󰀲", "󰟍", ""
]).map(icon => { return {
displayName: icon,
value: icon
}
})
}
}
ConfigSwitch {
buttonIcon: "󰘵"
text: Translation.tr("Use macOS-like symbols for mods keys")
checked: Config.options.appearance.keybinds.useMacSymbol
onCheckedChanged: {
Config.options.appearance.keybinds.useMacSymbol = checked;
}
StyledToolTip {
text: Translation.tr("macOS-style symbols, e.g. 󰘴 for Ctrl, 󰘵 for Alt, 󰘶 for Shift, etc")
}
}
ConfigSwitch {
buttonIcon: "󱊶"
text: Translation.tr("Use symbols for function keys")
checked: Config.options.appearance.keybinds.useFnSymbol
onCheckedChanged: {
Config.options.appearance.keybinds.useFnSymbol = checked;
}
StyledToolTip {
text: Translation.tr("Show functions keys as symbols, e.g. 󱊫 for F1, 󱊶 for F12")
}
}
ConfigSwitch {
buttonIcon: "󰍽"
text: Translation.tr("Use symbols for mouse")
checked: Config.options.appearance.keybinds.useMouseSymbol
onCheckedChanged: {
Config.options.appearance.keybinds.useMouseSymbol = checked;
}
StyledToolTip {
text: Translation.tr("Replace 󱕐 for \"Scroll ↓\", 󱕑 \"Scroll ↑\", L󰍽 \"LMB\", R󰍽 \"RMB\", 󱕒 \"Scroll ↑/↓\" and ⇞/⇟ for \"Page_↑/↓\"")
}
}
ConfigSwitch {
buttonIcon: ""
text: Translation.tr("Use macOS shortcut layout")
checked: Config.options.appearance.keybinds.useMacLikeShortcut
onCheckedChanged: {
Config.options.appearance.keybinds.useMacLikeShortcut = checked;
}
StyledToolTip {
text: Translation.tr("Display modifiers and keys in a single keycap (e.g., \"Ctrl A\" instead of \"Ctrl + A\" or \"󰘴 A\" instead of \"󰘴 + A\")")
}
}
ConfigSpinBox {
text: Translation.tr("Keybind font size")
value: Config.options.appearance.keybinds.fontSize.key
from: Appearance.font.pixelSize.smallest
to: Appearance.font.pixelSize.large
stepSize: 1
onValueChanged: {
Config.options.appearance.keybinds.fontSize.key = value;
}
}
ConfigSpinBox {
text: Translation.tr("Description font size")
value: Config.options.appearance.keybinds.fontSize.comment
from: Appearance.font.pixelSize.smallest
to: Appearance.font.pixelSize.large
stepSize: 1
onValueChanged: {
Config.options.appearance.keybinds.fontSize.comment = value;
}
}
}
} }