diff --git a/dots/.config/quickshell/ii/modules/cheatsheet/CheatsheetKeybinds.qml b/dots/.config/quickshell/ii/modules/cheatsheet/CheatsheetKeybinds.qml index 5c8124e0a..3a78e86ce 100644 --- a/dots/.config/quickshell/ii/modules/cheatsheet/CheatsheetKeybinds.qml +++ b/dots/.config/quickshell/ii/modules/cheatsheet/CheatsheetKeybinds.qml @@ -14,9 +14,50 @@ Item { property real padding: 4 implicitWidth: row.implicitWidth + padding * 2 implicitHeight: row.implicitHeight + padding * 2 + // Excellent symbol explaination and source : + // http://xahlee.info/comp/unicode_computing_symbols.html + // https://www.nerdfonts.com/cheat-sheet + property var macSymbolMap: ({ + "Ctrl": "󰘴", + "Alt": "󰘵", + "Shift": "󰘶", + "Space": "󱁐", + "Tab": "↹", + "Equal": "󰇼", + "Minus": "", + "Print": "", + "BackSpace": "󰭜", + "Delete": "⌦", + "Return": "󰌑", + "Period": ".", + "Escape": "⎋" + }) + property var functionSymbolMap: ({ + "F1": "󱊫", + "F2": "󱊬", + "F3": "󱊭", + "F4": "󱊮", + "F5": "󱊯", + "F6": "󱊰", + "F7": "󱊱", + "F8": "󱊲", + "F9": "󱊳", + "F10": "󱊴", + "F11": "󱊵", + "F12": "󱊶", + }) + + property var mouseSymbolMap: ({ + "mouse_up": "󱕐", + "mouse_down": "󱕑", + "mouse:272": "L󰍽", + "mouse:273": "R󰍽", + "Scroll ↑/↓": "󱕒", + "Page_↑/↓": "⇞/⇟", + }) property var keyBlacklist: ["Super_L"] - property var keySubstitutions: ({ + property var keySubstitutions: Object.assign({ "Super": "󰖳", "mouse_up": "Scroll ↓", // ikr, weird "mouse_down": "Scroll ↑", // trust me bro @@ -27,7 +68,14 @@ Item { "Hash": "#", "Return": "Enter", // "Shift": "", - }) + }, + !!Config.options.cheatsheet.superKey ? { + "Super": Config.options.cheatsheet.superKey, + }: {}, + Config.options.cheatsheet.useMacSymbol ? macSymbolMap : {}, + Config.options.cheatsheet.useFnSymbol ? functionSymbolMap : {}, + Config.options.cheatsheet.useMouseSymbol ? mouseSymbolMap : {}, + ) Row { // Keybind columns id: row @@ -77,6 +125,17 @@ Item { var result = []; for (var i = 0; i < keybindSection.modelData.keybinds.length; i++) { const keybind = keybindSection.modelData.keybinds[i]; + + if (!Config.options.cheatsheet.splitButtons) { + + 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({ "type": "keys", "mods": keybind.mods, @@ -108,17 +167,19 @@ Item { delegate: KeyboardKey { required property var modelData key: keySubstitutions[modelData] || modelData + pixelSize: Config.options.cheatsheet.fontSize.key } } StyledText { id: keybindPlus - visible: !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0 + visible: Config.options.cheatsheet.splitButtons && !keyBlacklist.includes(modelData.key) && modelData.mods.length > 0 text: "+" } KeyboardKey { id: keybindKey - visible: !keyBlacklist.includes(modelData.key) + visible: Config.options.cheatsheet.splitButtons && !keyBlacklist.includes(modelData.key) key: keySubstitutions[modelData.key] || modelData.key + pixelSize: Config.options.cheatsheet.fontSize.key color: Appearance.colors.colOnLayer0 } } @@ -134,7 +195,7 @@ Item { StyledText { id: commentText anchors.centerIn: parent - font.pixelSize: Appearance.font.pixelSize.smaller + font.pixelSize: Config.options.cheatsheet.fontSize.comment || Appearance.font.pixelSize.smaller text: modelData.comment } } @@ -152,4 +213,4 @@ Item { } } -} \ No newline at end of file +} diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index 8e5d588ec..55c9c94a8 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -267,6 +267,22 @@ Singleton { 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 bool autoKillNotificationDaemons: false property bool autoKillTrays: false diff --git a/dots/.config/quickshell/ii/modules/common/widgets/KeyboardKey.qml b/dots/.config/quickshell/ii/modules/common/widgets/KeyboardKey.qml index 14c75c62d..cdb287aca 100644 --- a/dots/.config/quickshell/ii/modules/common/widgets/KeyboardKey.qml +++ b/dots/.config/quickshell/ii/modules/common/widgets/KeyboardKey.qml @@ -11,6 +11,7 @@ Rectangle { property real extraBottomBorderWidth: 2 property color borderColor: Appearance.colors.colOnLayer0 property real borderRadius: 5 + property real pixelSize: Appearance.font.pixelSize.smaller property color keyColor: Appearance.m3colors.m3surfaceContainerLow implicitWidth: keyFace.implicitWidth + borderWidth * 2 implicitHeight: keyFace.implicitHeight + borderWidth * 2 + extraBottomBorderWidth @@ -35,7 +36,7 @@ Rectangle { id: keyText anchors.centerIn: parent font.family: Appearance.font.family.monospace - font.pixelSize: Appearance.font.pixelSize.smaller + font.pixelSize: root.pixelSize text: key } } diff --git a/dots/.config/quickshell/ii/modules/settings/AdvancedConfig.qml b/dots/.config/quickshell/ii/modules/settings/AdvancedConfig.qml index 811cf7ca6..7d51dbe12 100644 --- a/dots/.config/quickshell/ii/modules/settings/AdvancedConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/AdvancedConfig.qml @@ -90,4 +90,6 @@ ContentPage { } } + + } diff --git a/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index c26cce455..c57406a7f 100644 --- a/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -7,6 +7,98 @@ import qs.modules.common.widgets ContentPage { forceWidth: true + ContentSection { + icon: "keyboard" + title: Translation.tr("Cheat sheet") + + ContentSubsection { + title: Translation.tr("Super key symbol") + tooltip: Translation.tr("You can also manually edit 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 { icon: "call_to_action" title: Translation.tr("Dock") @@ -647,4 +739,5 @@ ContentPage { } } } + }