Add a keybinds cheatsheet panel (Mod+Shift+H, or the help button in taskbar mode)

- Centered overlay listing every keybind, grouped by category, generated from
  a small list in Bar.qml kept in sync with the README Hotkeys section by
  hand (Hyprland's Lua config binds everything through one opaque __lua
  dispatcher, so hyprctl binds can't recover a human-readable action to
  auto-generate it from)
- Help button only shows in taskbar mode (next to the clock); hovering it
  only hints what it does, the list itself needs a click
- New Mod+Shift+H bind in hyprland.lua opens/closes it from either mode,
  via the same IPC-handler pattern as the window switcher

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
nico
2026-09-28 00:46:23 +02:00
parent 4b8892cf90
commit f79449e69d
3 changed files with 241 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ Waybar has been fully retired. The whole top bar is one Quickshell shell (`quick
- **Network** — shows the active connection (Wi-Fi SSID or wired); hover shows the local IP (click toggles to the public IP), the network device (e.g. `enp7s0`) and the live up/download rate in decimal bit units (Kbit/Mbit/Gbit/s, like a speedtest), refreshed every second independently of the slower connection/SSID lookup
- **Clock** — hover for the full date + ISO week number, click opens a small month calendar
- **Notification panel** — the bell button (with an unread badge) opens a panel down the right screen edge, top to bottom, listing recent notifications from mako's history. Click a notification (or “Mark all read”) to mark it read and drop it from the list. mako can't delete single history entries, so read state is kept by `scripts/notifs.py` in `~/.local/state/quickshell/notifs-read`
- **Keybinds help** — in taskbar mode, a `?` button next to the clock (hover: hints what it does; click: opens a centered cheatsheet of every keybind, grouped by category). Also reachable from either mode via `Mod+Shift+H`. The list is hand-kept in sync with the Hotkeys section below — Hyprland's Lua config binds everything through one opaque `__lua` dispatcher, so `hyprctl binds` can't recover a human-readable action to auto-generate it from
- **Power menu** — restart / shutdown / logout dropdown
All the stats are pulled by small shell scripts in `quickshell/default/scripts/` rather than baked into the QML.
@@ -81,6 +82,7 @@ It's a blue theme (`#1793d1` accent on a dark `#1a1b26` background) built around
| Key | Action |
|---|---|
| `Mod + Shift + A` | Toggle the window switcher dropdown |
| `Mod + Shift + H` | Toggle the keybinds panel (also reachable via the taskbar-mode help button) |
### Windows

View File

@@ -328,6 +328,8 @@ hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "T", hl.dsp.exec_cmd("kitty -e b
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "A", hl.dsp.exec_cmd("quickshell -c default ipc call windowswitcher toggle"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "H", hl.dsp.exec_cmd("quickshell -c default ipc call help toggle"))
-- ----------------------------------------------------------
-- Keybinds: Window control

View File

@@ -17,6 +17,69 @@ Variants {
readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown"
property bool windowSwitcherOpen: false
property bool helpOpen: false
// Kept in sync with the Hotkeys section of README.md by hand: Hyprland's Lua config binds
// everything through one opaque "__lua" dispatcher, so hyprctl binds -j can't recover a
// human-readable action for any of them - there's nothing meaningful left to auto-fetch.
readonly property var keybindGroups: [
{
cat: isGerman ? "Apps" : "Apps", items: [
{ keys: "Mod + Return", en: "Terminal (Kitty)", de: "Terminal (Kitty)" },
{ keys: "Mod + W", en: "Browser (Zen)", de: "Browser (Zen)" },
{ keys: "Mod + N", en: "File manager (Dolphin)", de: "Dateimanager (Dolphin)" },
{ keys: "Mod + Space", en: "App launcher (Rofi)", de: "App-Starter (Rofi)" },
{ keys: "Mod + Shift + P", en: "Spotify", de: "Spotify" },
{ keys: "Mod + Shift + C", en: "Discord", de: "Discord" },
{ keys: "Mod + Shift + S", en: "Steam", de: "Steam" },
{ keys: "Mod + Shift + T", en: "btop (in terminal)", de: "btop (im Terminal)" },
{ keys: "Mod + Alt + C", en: "Qalculate", de: "Qalculate" },
{ keys: "Mod + C", en: "Clipboard history (cliphist + Rofi)", de: "Zwischenablage-Verlauf (cliphist + Rofi)" },
]
},
{
cat: isGerman ? "Bar" : "Bar", items: [
{ keys: "Mod + Shift + A", en: "Toggle the window switcher", de: "Fenster-Umschalter öffnen/schließen" },
{ keys: "Mod + Shift + H", en: "Toggle this keybinds panel", de: "Dieses Tastenkombinations-Panel öffnen/schließen" },
]
},
{
cat: isGerman ? "Fenster" : "Windows", items: [
{ keys: "Mod + Q", en: "Close active window", de: "Aktives Fenster schließen" },
{ keys: "Mod + Shift + E", en: "Exit Hyprland", de: "Hyprland beenden" },
{ keys: "Mod + F", en: "Toggle fullscreen", de: "Vollbild umschalten" },
{ keys: "Mod + V", en: "Toggle floating", de: "Schwebemodus umschalten" },
{ keys: "Mod + P", en: "Toggle pseudotiling", de: "Pseudo-Tiling umschalten" },
{ keys: "Mod + ←/→/K/J", en: "Move focus", de: "Fokus bewegen" },
{ keys: "Mod + Shift + ←/→/↑/↓", en: "Move window", de: "Fenster verschieben" },
{ keys: "Mod + Ctrl + H/L/K/J", en: "Resize active window", de: "Aktives Fenster skalieren" },
{ keys: "Mod + LMB drag", en: "Move window", de: "Fenster verschieben" },
{ keys: "Mod + RMB drag", en: "Resize window", de: "Fenster skalieren" },
]
},
{
cat: isGerman ? "Workspaces" : "Workspaces", items: [
{ keys: "Mod + 1…9", en: "Switch to workspace 1–9", de: "Zu Workspace 1–9 wechseln" },
{ keys: "Mod + Shift + 1…9", en: "Move window to workspace 1–9", de: "Fenster zu Workspace 1–9 verschieben" },
{ keys: "Mod + Scroll", en: "Next/previous workspace", de: "Nächster/vorheriger Workspace" },
]
},
{
cat: isGerman ? "Screenshots" : "Screenshots", items: [
{ keys: "Print", en: "Region screenshot → clipboard", de: "Bereichs-Screenshot → Zwischenablage" },
{ keys: "Shift + Print", en: "Region screenshot → file", de: "Bereichs-Screenshot → Datei" },
]
},
{
cat: isGerman ? "Medien / Audio" : "Media / audio", items: [
{ keys: "XF86AudioRaiseVolume/Lower", en: "Volume up/down", de: "Lautstärke rauf/runter" },
{ keys: "XF86AudioMute", en: "Mute", de: "Stummschalten" },
{ keys: "XF86AudioMicMute", en: "Mute mic", de: "Mikro stummschalten" },
{ keys: "XF86MonBrightnessUp/Down", en: "Brightness up/down", de: "Helligkeit rauf/runter" },
{ keys: "XF86AudioPlay/Next/Prev", en: "Media playback control", de: "Medienwiedergabe steuern" },
]
},
]
function fmtRate(kbps) {
return kbps >= 1024 ? (kbps / 1024).toFixed(1) + " MB/s" : Math.round(kbps) + " KB/s"
@@ -107,6 +170,17 @@ Variants {
}
}
Loader {
active: modelData === Quickshell.screens[0]
sourceComponent: IpcHandler {
target: "help"
function toggle(): void {
root.helpOpen = !root.helpOpen
}
}
}
property string hovered: ""
property bool menuOpen: false
property bool calendarOpen: false
@@ -1099,6 +1173,32 @@ Variants {
sourceComponent: bellComp
}
Rectangle {
id: helpBtn
visible: bar.taskbarMode
Layout.preferredWidth: visible ? 32 : 0
Layout.preferredHeight: 26
radius: 10
color: (helpArea.containsMouse || root.helpOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
Text {
anchors.centerIn: parent
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: (helpArea.containsMouse || root.helpOpen) ? "#0f111a" : "#7aa2f7"
}
MouseArea {
id: helpArea
anchors.fill: parent
hoverEnabled: true
onEntered: bar.hovered = "help"
onExited: bar.hovered = ""
onClicked: root.helpOpen = !root.helpOpen
}
}
Rectangle {
id: clockPill
Layout.preferredWidth: 100
@@ -1446,6 +1546,143 @@ Variants {
}
}
LazyLoader {
active: bar.hovered === "help" && !root.helpOpen
PanelWindow {
screen: bar.modelData
anchors { top: true; right: true }
margins { top: 34; right: bar.width - (rightRow.x + helpBtn.x + helpBtn.width) }
implicitWidth: helpHintText.implicitWidth + 24
implicitHeight: helpHintText.implicitHeight + 20
color: "transparent"
WlrLayershell.namespace: "help-hint"
WlrLayershell.layer: WlrLayer.Top
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
Text {
id: helpHintText
anchors.centerIn: parent
text: root.isGerman ? "Zeigt alle Tastenkombinationen" : "Shows all keybinds"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
}
}
}
}
LazyLoader {
active: root.helpOpen && Hyprland.focusedMonitor !== null && bar.modelData.name === Hyprland.focusedMonitor.name
PanelWindow {
id: helpWindow
screen: bar.modelData
// No anchors: wlr-layer-shell centers a surface on the output when none of its
// edges are anchored, which is what we want for a cheatsheet-style overlay.
implicitWidth: 540
implicitHeight: Math.min(helpCol.implicitHeight + 100, bar.modelData.height - 80)
color: "transparent"
WlrLayershell.namespace: "help-panel"
WlrLayershell.layer: WlrLayer.Top
HyprlandFocusGrab {
windows: [ helpWindow ]
active: true
onCleared: root.helpOpen = false
}
Rectangle {
anchors.fill: parent
radius: 12
color: "#f01a1b26"
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
ColumnLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
Text {
Layout.fillWidth: true
text: root.isGerman ? "Tastenkombinationen" : "Keybinds"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 18
font.bold: true
color: "#c0caf5"
}
Flickable {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
contentWidth: width
contentHeight: helpCol.implicitHeight
boundsBehavior: Flickable.StopAtBounds
ColumnLayout {
id: helpCol
width: parent.width
spacing: 10
Repeater {
model: root.keybindGroups
ColumnLayout {
required property var modelData
Layout.fillWidth: true
spacing: 3
Text {
text: modelData.cat
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 15
font.bold: true
color: "#1793d1"
}
Repeater {
model: modelData.items
RowLayout {
required property var modelData
Layout.fillWidth: true
spacing: 10
Text {
text: modelData.keys
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: "#7aa2f7"
Layout.preferredWidth: 225
wrapMode: Text.WrapAnywhere
}
Text {
Layout.fillWidth: true
text: root.isGerman ? modelData.de : modelData.en
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: "#c0caf5"
wrapMode: Text.WordWrap
}
}
}
}
}
}
}
}
}
}
}
LazyLoader {
active: bar.notifOpen