Reads keymap-drawer YAML (or a ZMK .keymap / QMK keymap.json) from a git repo, default xnmrph/corne. Watches it with git ls-remote and redraws when the keymap changes; waits for the repo's CI redraw after a .keymap push. Overview puts four layers in the key corners; each layer also has its own tab; combos and conditional layers are listed underneath. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.4 KiB
QML
49 lines
1.4 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import qs.Commons
|
|
import qs.Ui
|
|
|
|
// Bar button for the keymap cheat sheet. Click opens the sheet under it; the
|
|
// icon lights up when the keymap changed since you last looked.
|
|
BarWidget {
|
|
id: root
|
|
moduleName: "mx-keymap"
|
|
|
|
readonly property var service: bar && bar.shell ? bar.shell.serviceFor(moduleName) : null
|
|
readonly property bool opened: panel.opened
|
|
readonly property bool popoutSwitchClosing: panel.popoutSwitchClosing
|
|
|
|
implicitWidth: button.implicitWidth
|
|
implicitHeight: button.implicitHeight
|
|
|
|
function open() { panel.open() }
|
|
function close() { panel.close() }
|
|
function toggle() { panel.opened ? panel.close() : panel.open() }
|
|
function closeForPopoutSwitch() { panel.closeForPopoutSwitch() }
|
|
|
|
onServiceChanged: if (service) service.configure(settings)
|
|
onSettingsChanged: if (service) service.configure(settings)
|
|
|
|
BarIconButton {
|
|
id: button
|
|
anchors.fill: parent
|
|
bar: root.bar
|
|
text: ""
|
|
tooltipText: root.service && root.service.unseen ? "Keymap: updated" : "Keymap"
|
|
active: !!root.service && root.service.unseen
|
|
onPressed: function(mouseButton) {
|
|
if (mouseButton === Qt.LeftButton) root.toggle()
|
|
else if (mouseButton === Qt.RightButton && root.service) root.service.refresh(true)
|
|
}
|
|
}
|
|
|
|
SheetPanel {
|
|
id: panel
|
|
bar: root.bar
|
|
moduleName: root.moduleName
|
|
settings: root.settings
|
|
anchorItem: button
|
|
service: root.service
|
|
}
|
|
}
|