cheatsheet add font size setting and macos like shortcut

This commit is contained in:
Madjid Taha
2025-10-25 04:22:01 +02:00
parent 8c125cccb1
commit 533156e0d0
4 changed files with 75 additions and 19 deletions
@@ -106,6 +106,17 @@ Item {
var result = []; var result = [];
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) {
for (var j = 0; j < keybind.mods.length; j++) {
keybind.mods[j] = keySubstitutions[keybind.mods[j]] || keybind.mods[j];
}
keybind.mods = [keybind.mods.join(' ') ]
keybind.mods[0] += !keyBlacklist.includes(keybind.key) && keybind.mods[0].length ? ' ' : ''
keybind.mods[0] += !keyBlacklist.includes(keybind.key) ? (keySubstitutions[keybind.key] || keybind.key) : ''
}
result.push({ result.push({
"type": "keys", "type": "keys",
"mods": keybind.mods, "mods": keybind.mods,
@@ -137,17 +148,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.pixelSize.key
} }
} }
StyledText { StyledText {
id: keybindPlus id: keybindPlus
visible: !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0 visible: !Config.options.appearance.keybinds.useMacLikeShortcut && !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0
text: "+" text: "+"
} }
KeyboardKey { KeyboardKey {
id: keybindKey id: keybindKey
visible: !keyBlacklist.includes(modelData.key) visible: !Config.options.appearance.keybinds.useMacLikeShortcut && !keyBlacklist.includes(modelData.key)
key: keySubstitutions[modelData.key] || modelData.key key: keySubstitutions[modelData.key] || modelData.key
pixelSize: Config.options.appearance.keybinds.pixelSize.key
color: Appearance.colors.colOnLayer0 color: Appearance.colors.colOnLayer0
} }
} }
@@ -163,7 +176,8 @@ Item {
StyledText { StyledText {
id: commentText id: commentText
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: Appearance.font.pixelSize.smaller // font.pixelSize: Appearance.font.pixelSize.smaller
font.pixelSize: Config.options.appearance.keybinds.pixelSize.comment
text: modelData.comment text: modelData.comment
} }
} }
@@ -130,8 +130,13 @@ Singleton {
// 10:  | 11:  | 12:  | 13:  | 14: 󱄛 // 10:  | 11:  | 12:  | 13:  | 14: 󱄛
property int superKey: 0 property int superKey: 0
property bool useMacSymbol: false property bool useMacSymbol: false
property bool useMacLikeShortcut: false
property bool useMouseSymbol: false property bool useMouseSymbol: false
property bool useFnSymbol: false property bool useFnSymbol: false
property JsonObject pixelSize: JsonObject {
property int key: Appearance.font.pixelSize.smaller
property int comment: Appareance.font.pixelSize.smaller
}
} }
} }
@@ -11,6 +11,7 @@ Rectangle {
property real extraBottomBorderWidth: 2 property real extraBottomBorderWidth: 2
property color borderColor: Appearance.colors.colOnLayer0 property color borderColor: Appearance.colors.colOnLayer0
property real borderRadius: 5 property real borderRadius: 5
property int pixelSize: Appearance.font.pixelSize.smallie
property color keyColor: Appearance.m3colors.m3surfaceContainerLow property color keyColor: Appearance.m3colors.m3surfaceContainerLow
implicitWidth: keyFace.implicitWidth + borderWidth * 2 implicitWidth: keyFace.implicitWidth + borderWidth * 2
implicitHeight: keyFace.implicitHeight + borderWidth * 2 + extraBottomBorderWidth implicitHeight: keyFace.implicitHeight + borderWidth * 2 + extraBottomBorderWidth
@@ -35,7 +36,7 @@ Rectangle {
id: keyText id: keyText
anchors.centerIn: parent anchors.centerIn: parent
font.family: Appearance.font.family.monospace font.family: Appearance.font.family.monospace
font.pixelSize: Appearance.font.pixelSize.smaller font.pixelSize: pixelSize
text: key text: key
} }
} }
@@ -1,6 +1,10 @@
import QtQuick import QtQuick
import Quickshell
import Quickshell.Io
import QtQuick.Layouts
import qs.services import qs.services
import qs.modules.common import qs.modules.common
import qs.modules.common.functions
import qs.modules.common.widgets import qs.modules.common.widgets
ContentPage { ContentPage {
@@ -90,6 +94,8 @@ ContentPage {
} }
} }
ContentSection { ContentSection {
icon: "keyboard" icon: "keyboard"
title: Translation.tr("Keybinds Cheatsheet") title: Translation.tr("Keybinds Cheatsheet")
@@ -108,72 +114,58 @@ ContentPage {
options: [ options: [
{ {
displayName: "󰖳", displayName: "󰖳",
icon: "",
value: 0 value: 0
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 3 value: 3
}, },
{ {
displayName: "󰨡", displayName: "󰨡",
icon: "",
value: 4 value: 4
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 5 value: 5
}, },
{ {
displayName: "󰣇", displayName: "󰣇",
icon: "",
value: 7 value: 7
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 12 value: 12
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 13 value: 13
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 11 value: 11
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 10 value: 10
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 8 value: 8
}, },
{ {
displayName: "󱄛", displayName: "󱄛",
icon: "",
value: 14 value: 14
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 9 value: 9
}, },
{ {
displayName: "", displayName: "",
icon: "",
value: 6 value: 6
}, },
{ {
displayName: "󰘳", displayName: "󰘳",
icon: "",
value: 2 value: 2
}, },
] ]
@@ -187,7 +179,11 @@ ContentPage {
onCheckedChanged: { onCheckedChanged: {
Config.options.appearance.keybinds.useMacSymbol = checked; Config.options.appearance.keybinds.useMacSymbol = checked;
} }
StyledToolTip {
text: Translation.tr("macOS-style symbols, e.g. 󰘴 for Ctrl, 󰘵 for Alt, 󰘶 for Shift, etc")
}
} }
ConfigSwitch { ConfigSwitch {
buttonIcon: "󱊶" buttonIcon: "󱊶"
text: Translation.tr("Use symbols for function keys") text: Translation.tr("Use symbols for function keys")
@@ -195,6 +191,9 @@ ContentPage {
onCheckedChanged: { onCheckedChanged: {
Config.options.appearance.keybinds.useFnSymbol = checked; Config.options.appearance.keybinds.useFnSymbol = checked;
} }
StyledToolTip {
text: Translation.tr("Show 󱊷 instead of Escape, 󱊫 for F1, etc to 󱊶 for F12")
}
} }
ConfigSwitch { ConfigSwitch {
buttonIcon: "󰍽" buttonIcon: "󰍽"
@@ -203,6 +202,43 @@ ContentPage {
onCheckedChanged: { onCheckedChanged: {
Config.options.appearance.keybinds.useMouseSymbol = checked; Config.options.appearance.keybinds.useMouseSymbol = checked;
} }
StyledToolTip {
text: Translation.tr("Replace 󱕐 for \"Scroll ↓\", 󱕑 \"Scroll ↑\", L󰍽 \"LMB\", R󰍽 \"RMB\", 󱕒 \"Scroll ↑/↓\" and Page  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("Show mods and key in the same keycap, look better with symbols")
}
}
ConfigSpinBox {
// text: Translation.tr("Keycap")
text: Translation.tr("Key font size")
value: Config.options.appearance.keybinds.pixelSize.key
from: Appearance.font.pixelSize.smallest
to: Appearance.font.pixelSize.large
stepSize: 1
onValueChanged: {
Config.options.appearance.keybinds.pixelSize.key = value;
}
}
ConfigSpinBox {
text: Translation.tr("Comment font size")
value: Config.options.appearance.commentbinds.pixelSize.comment
from: Appearance.font.pixelSize.smallest
to: Appearance.font.pixelSize.large
stepSize: 1
onValueChanged: {
Config.options.appearance.commentbinds.pixelSize.comment = value;
}
} }
} }
} }