Files
glassMxrph-plugins/mx-keymap/SheetPanel.qml
T
mxandClaude Opus 5.5 806f59d6f8 Keymap: give combos their own tab
Combos move from a chip row under every layer to a Combos tab after the
layers. Each result sits on the seam between its two keys, with a dashed
line for keys far apart; pointing at a key keeps only its combos bright and
spells them out. C opens the tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:16:18 +01:00

781 lines
33 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Shapes
import Quickshell
import qs.Commons
import qs.Ui
// The cheat sheet: the keyboard drawn from the repo's keymap. Overview puts
// the base layer in the middle of each key and four more layers in its
// corners, each in its own colour; a layer tab shows that layer alone, with
// keys that fall through to the base layer dimmed. Combos sit underneath;
// pointing at one lights up its keys.
Panel {
id: root
property Item anchorItem: null
property var service: null
readonly property var sheet: service ? service.sheet : null
readonly property var layers: sheet && sheet.layers ? sheet.layers : []
readonly property var layoutKeys: sheet && sheet.layout ? sheet.layout.keys : []
readonly property var base: layers.length ? layers[0].keys : []
// -1 is the overview; otherwise a layer index, and the Combos tab comes
// after the last layer. Pointing at a tab previews it.
property int view: -1
property int preview: -2
readonly property int shown: preview > -2 ? preview : view
// Combos tab: every combo drawn on the seam between its keys; pointing at a
// key keeps only its combos bright.
readonly property var allCombos: sheet && sheet.combos ? sheet.combos : []
readonly property var layerCombos: sheet && sheet.layerCombos ? sheet.layerCombos : []
readonly property bool combosOn: setting("showCombos", true) !== false && (allCombos.length > 0 || layerCombos.length > 0)
readonly property int comboTab: layers.length
readonly property int lastTab: combosOn ? comboTab : layers.length - 1
readonly property bool comboMode: combosOn && shown === comboTab
property int comboFocus: -1
readonly property var focusCombos: comboFocus < 0 ? [] : allCombos.filter(c => c.keys.indexOf(comboFocus) >= 0)
readonly property var highlight: comboMode ? focusCombos.reduce((all, c) => all.concat(c.keys), []) : []
// Corner of each overview layer (layers 1..4), as in the repo's own drawing.
readonly property var places: ["bl", "tr", "tl", "br"]
// Board geometry in key units.
readonly property real unitsW: layoutKeys.reduce((m, k) => Math.max(m, k.x + 1), 0)
readonly property real unitsH: layoutKeys.reduce((m, k) => Math.max(m, k.y + 1), 0) + 0.2
readonly property real keySize: Style.space(Math.max(36, Math.min(120, Number(setting("keySize", 66)) || 66)))
readonly property real unit: Math.min(keySize, unitsW > 0 ? (card.availableCardWidth - card.padding * 2) / unitsW : keySize)
readonly property real gap: Math.max(3, Math.round(unit * 0.07))
readonly property int cardWidth: Math.max(Style.space(560), Math.ceil(unitsW * unit)) + card.padding * 2
function layerIndex(name) {
if (!name) return -1
for (let i = 0; i < layers.length; i++) if (layers[i].name === name) return i
return -1
}
// Layer colours follow the theme accent, spread around the colour wheel.
readonly property var hueSteps: [0, 0.5, 0.27, 0.77, 0.13, 0.63, 0.38, 0.88]
function layerColor(i) {
if (i <= 0) return Color.foreground
const h0 = Color.accent.hslHue < 0 ? 0.6 : Color.accent.hslHue
const h = (h0 + hueSteps[(i - 1) % hueSteps.length]) % 1
return Qt.hsla(h, 0.68, 0.72, 1)
}
function legend(k) { return k && k.type !== "trans" && k.type !== "held" ? String(k.t || "") : "" }
// What one key shows in the current view.
function cellFor(i) {
const b = base[i] || {}
if (comboMode)
return { t: legend(b), s: "", h: "", kind: "combo", corners: [], tint: -1, holdTint: -1 }
const thumb = !!(layoutKeys[i] && layoutKeys[i].thumb)
const out = { t: legend(b), s: b.s || "", h: b.h || "", kind: b.type || "", corners: [], tint: -1, holdTint: -1 }
if (shown >= 0 && shown < layers.length && shown > 0) {
const k = layers[shown].keys[i] || {}
if (k.type === "trans") { out.kind = "trans"; out.s = ""; out.h = "" }
else if (k.type === "held") { out.kind = "held"; out.t = legend(b); out.s = ""; out.h = "" }
else { out.t = legend(k); out.s = k.s || ""; out.h = k.h || ""; out.kind = k.type || "" }
} else if (shown < 0 && !thumb) {
for (let j = 1; j <= Math.min(4, layers.length - 1); j++) {
const t = legend(layers[j].keys[i])
if (t && t !== out.t) out.corners.push({ place: places[j - 1], text: t, color: layerColor(j) })
}
if (out.corners.length) out.s = ""
}
out.tint = layerIndex(out.t)
out.holdTint = layerIndex(out.h)
if (out.kind === "held") out.tint = shown
return out
}
readonly property var cells: {
const list = []
for (let i = 0; i < layoutKeys.length; i++) list.push(cellFor(i))
return list
}
readonly property string shownName: shown >= 0 && shown < layers.length ? layers[shown].name : (layers.length ? layers[0].name : "")
function select(v) {
view = Math.max(-1, Math.min(lastTab, v))
preview = -2
comboFocus = -1
}
function showNamed(name) {
const wanted = String(name).toLowerCase()
const i = wanted === "overview" ? -1 : wanted === "combos" && combosOn ? comboTab : layers.findIndex(l => l.name.toLowerCase() === wanted)
if (i >= -1) select(i)
}
Connections {
target: root.service
function onShowView(layer) { if (root.opened) root.showNamed(layer) }
}
function ago(seconds) {
if (!seconds) return ""
const s = Math.max(0, Math.round(Date.now() / 1000 - seconds))
if (s < 60) return "just now"
if (s < 3600) return Math.floor(s / 60) + " min ago"
if (s < 86400) return Math.floor(s / 3600) + " h ago"
const d = Math.floor(s / 86400)
return d === 1 ? "yesterday" : d + " days ago"
}
// Arrow glyphs are drawn small in most UI fonts; give them more room.
function isArrow(text) { return /^[←↑→↓⇡⇣⇠⇢]+$/.test(String(text)) }
function sizeFor(text) {
if (isArrow(text)) return Math.round(unit * 0.42)
const n = String(text).length
if (n <= 1) return Math.round(unit * 0.34)
if (n <= 3) return Math.round(unit * 0.25)
if (n <= 5) return Math.round(unit * 0.21)
return Math.round(unit * 0.18)
}
onOpenedChanged: {
if (!service) return
service.openPanels += opened ? 1 : -1
if (opened) {
view = setting("startView", "overview") === "base" ? 0 : -1
if (service.wantedView) showNamed(service.wantedView)
service.wantedView = ""
preview = -2
comboFocus = -1
}
}
Component.onDestruction: if (opened && service) service.openPanels--
// Relative times stay fresh while it is open.
Timer {
id: clock
property int tick: 0
interval: 30000
repeat: true
running: root.opened
onTriggered: tick++
}
KeyboardPanel {
id: card
anchorItem: root.anchorItem
owner: root
bar: root.bar
open: root.opened
focusTarget: keys
contentWidth: card.fittedContentWidth(root.cardWidth)
contentHeight: card.fittedContentHeight(column.implicitHeight)
Item {
id: keys
anchors.fill: parent
focus: true
Keys.onPressed: function(event) {
const last = root.lastTab
if (event.key === Qt.Key_Escape) root.close()
else if (event.key === Qt.Key_Right || event.key === Qt.Key_Tab || event.key === Qt.Key_L)
root.select(root.view + 1 > last ? -1 : root.view + 1)
else if (event.key === Qt.Key_Left || event.key === Qt.Key_Backtab || event.key === Qt.Key_H)
root.select(root.view - 1 < -1 ? last : root.view - 1)
else if (event.key === Qt.Key_0 || event.key === Qt.Key_QuoteLeft) root.select(-1)
else if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9 && event.key - Qt.Key_1 <= last) root.select(event.key - Qt.Key_1)
else if (event.key === Qt.Key_C && root.combosOn) root.select(root.comboTab)
else if (event.key === Qt.Key_R && root.service) root.service.refresh(true)
else return
event.accepted = true
}
}
Column {
id: column
width: parent.width
spacing: Style.spacing.xxl
// Header: name, where it came from, actions.
Item {
width: parent.width
height: Math.max(titleCol.implicitHeight, actions.implicitHeight)
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Style.spacing.xl
Text {
anchors.verticalCenter: parent.verticalCenter
text: "󰌌"
color: Color.accent
font.family: Style.font.family
font.pixelSize: Style.font.displayLarge
}
Column {
id: titleCol
anchors.verticalCenter: parent.verticalCenter
spacing: Style.spacing.xxs
Row {
spacing: Style.spacing.lg
Text {
id: titleText
text: "Keymap"
color: Color.foreground
font.family: Style.font.family
font.pixelSize: Style.font.heading
font.bold: true
}
Text {
anchors.baseline: titleText.baseline
text: root.sheet ? root.sheet.repo : (root.service ? root.service.repository : "")
color: Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.body
}
}
Text {
text: {
clock.tick
const s = root.sheet
if (root.service && root.service.error) return root.service.error
if (!s) return root.service && root.service.busy ? "Reading the repository…" : ""
if (s.pending) return "Keymap changed, waiting for the repo to redraw it…"
const parts = []
if (s.committed) parts.push("changed " + root.ago(s.committed))
if (s.sha) parts.push(s.sha.slice(0, 7))
if (s.subject) parts.push(s.subject.replace(/^\[Draw\]\s*/, ""))
return parts.join(" · ")
}
width: Math.min(implicitWidth, column.width - actions.width - Style.space(80))
elide: Text.ElideRight
color: root.service && root.service.error ? Color.urgent : root.sheet && root.sheet.pending ? Color.accent : Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.caption
}
}
}
Row {
id: actions
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: Style.spacing.sm
Button {
iconText: "󰑐"
iconSpinning: !!root.service && root.service.busy
tooltipText: "Check the repo now (R)"
onClicked: if (root.service) root.service.refresh(true)
}
Button {
visible: !!root.sheet && !!root.sheet.web
iconText: "󰊤"
tooltipText: "Open the repository"
onClicked: {
const s = root.sheet
const url = s.web + (s.source ? "/blob/" + (s.branch || s.sha) + "/" + s.source : "")
Quickshell.execDetached(["xdg-open", url])
root.close()
}
}
Button {
iconText: "󰅖"
tooltipText: "Close"
onClicked: root.close()
}
}
}
// Layer tabs. The little key in each shows where that layer sits in the overview.
Flow {
id: tabs
width: parent.width
spacing: Style.spacing.md
visible: root.layers.length > 0
Repeater {
model: root.layers.length + 1 + (root.combosOn ? 1 : 0)
delegate: Rectangle {
id: tab
required property int index
readonly property int idx: index - 1
readonly property bool selected: root.view === idx
readonly property bool isCombo: idx === root.comboTab
readonly property color tone: idx < 0 || isCombo ? Color.accent : root.layerColor(idx)
readonly property string place: idx >= 1 && idx <= 4 ? root.places[idx - 1] : idx === 0 ? "c" : ""
width: tabRow.implicitWidth + Style.spacing.xxl * 2
height: Style.space(30)
radius: height / 2
color: selected ? Qt.alpha(tone, 0.2) : tabMouse.containsMouse ? Qt.alpha(Color.foreground, 0.07) : Qt.alpha(Color.foreground, 0.03)
border.width: 1
border.color: selected ? Qt.alpha(tone, 0.55) : Qt.alpha(Color.foreground, 0.08)
Behavior on color { ColorAnimation { duration: 120 } }
Row {
id: tabRow
anchors.centerIn: parent
spacing: Style.spacing.md
// Mini key: a dot in this layer's corner (centre for the base layer).
Rectangle {
anchors.verticalCenter: parent.verticalCenter
visible: tab.idx >= 0 && !tab.isCombo
width: Style.space(13)
height: width
radius: Style.space(3)
color: "transparent"
border.width: 1
border.color: Qt.alpha(tab.tone, 0.6)
Rectangle {
width: Style.space(5)
height: width
radius: width / 2
color: tab.tone
x: tab.place === "tl" || tab.place === "bl" ? Style.space(2) : tab.place === "tr" || tab.place === "br" ? parent.width - width - Style.space(2) : (parent.width - width) / 2
y: tab.place === "tl" || tab.place === "tr" ? Style.space(2) : tab.place === "bl" || tab.place === "br" ? parent.height - height - Style.space(2) : (parent.height - height) / 2
}
}
// Combos: a little result badge, as drawn on the board.
Rectangle {
anchors.verticalCenter: parent.verticalCenter
visible: tab.isCombo
width: Style.space(14)
height: width
radius: Style.space(4)
color: Color.accent
Text {
anchors.centerIn: parent
text: "+"
color: Color.accentText
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
font.bold: true
}
}
Text {
anchors.verticalCenter: parent.verticalCenter
visible: tab.idx < 0
text: "󰕰"
color: tab.selected ? tab.tone : Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.title
}
Text {
anchors.verticalCenter: parent.verticalCenter
text: tab.idx < 0 ? "Overview" : tab.isCombo ? "Combos" : root.layers[tab.idx] ? root.layers[tab.idx].name : ""
color: tab.selected ? Color.foreground : Qt.alpha(Color.foreground, 0.75)
font.family: Style.font.family
font.pixelSize: Style.font.body
font.bold: tab.selected
}
Text {
anchors.verticalCenter: parent.verticalCenter
text: String(tab.index)
visible: tab.index <= 9
color: Qt.alpha(Color.foreground, 0.32)
font.family: Style.font.family
font.pixelSize: Style.font.caption
}
}
MouseArea {
id: tabMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: {
if (containsMouse) root.preview = tab.idx
else if (root.preview === tab.idx) root.preview = -2
}
onClicked: root.select(tab.idx)
}
}
}
}
// The keyboard.
Item {
id: board
width: parent.width
height: root.layoutKeys.length ? Math.ceil(root.unitsH * root.unit) : Style.space(220)
Text {
anchors.centerIn: parent
visible: !root.layoutKeys.length
horizontalAlignment: Text.AlignHCenter
text: root.service && root.service.error ? "󰌐\n" + root.service.error : "󰌌\nReading your keymap…"
color: Color.muted
lineHeight: 1.3
font.family: Style.font.family
font.pixelSize: Style.font.title
}
Item {
id: plate
width: root.unitsW * root.unit
height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
Repeater {
model: root.layoutKeys.length
delegate: Item {
id: key
required property int index
readonly property var pos: root.layoutKeys[index]
readonly property var cell: root.cells[index] || ({ t: "", s: "", h: "", kind: "", corners: [], tint: -1, holdTint: -1 })
readonly property bool dim: cell.kind === "trans" || cell.kind === "blank" || cell.kind === "combo"
readonly property bool inCombo: root.comboMode && root.allCombos.some(c => c.keys.indexOf(index) >= 0)
readonly property bool lit: root.highlight.indexOf(index) >= 0
readonly property color tone: cell.tint > 0 ? root.layerColor(cell.tint) : Color.foreground
readonly property bool toned: cell.tint > 0 && !dim
x: pos.x * root.unit + root.gap / 2
y: pos.y * root.unit + root.gap / 2
width: root.unit - root.gap
height: root.unit - root.gap
rotation: pos.r || 0
Rectangle {
id: tile
anchors.fill: parent
radius: Math.round(root.unit * 0.17)
gradient: Gradient {
GradientStop {
position: 0
color: key.lit ? Qt.alpha(Color.accent, 0.24)
: key.cell.kind === "held" ? Qt.alpha(key.tone, 0.42)
: key.toned ? Qt.alpha(key.tone, 0.24)
: key.dim ? Qt.alpha(Color.foreground, 0.025) : Qt.alpha(Color.foreground, 0.09)
Behavior on color { ColorAnimation { duration: 140 } }
}
GradientStop {
position: 1
color: key.lit ? Qt.alpha(Color.accent, 0.12)
: key.cell.kind === "held" ? Qt.alpha(key.tone, 0.28)
: key.toned ? Qt.alpha(key.tone, 0.13)
: key.dim ? Qt.alpha(Color.foreground, 0.015) : Qt.alpha(Color.foreground, 0.045)
Behavior on color { ColorAnimation { duration: 140 } }
}
}
border.width: 1
border.color: key.lit ? Qt.alpha(Color.accent, 0.7)
: key.toned || key.cell.kind === "held" ? Qt.alpha(key.tone, 0.5)
: Qt.alpha(Color.foreground, key.dim ? 0.05 : 0.1)
Behavior on border.color { ColorAnimation { duration: 140 } }
}
// Shifted / modifier hint on top.
Text {
anchors.top: parent.top
anchors.topMargin: Math.round(root.unit * 0.07)
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 8
horizontalAlignment: Text.AlignHCenter
visible: text !== "" && !key.dim
text: key.cell.s
elide: Text.ElideRight
color: Qt.alpha(Color.foreground, 0.5)
font.family: Style.font.family
font.pixelSize: Math.round(root.unit * 0.16)
}
// Main legend.
Text {
anchors.centerIn: parent
anchors.verticalCenterOffset: key.cell.h && !key.dim ? -Math.round(root.unit * 0.06) : 0
width: parent.width - Math.round(root.unit * 0.12)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: key.cell.kind === "held" ? "held" : key.cell.t
wrapMode: Text.WordWrap
maximumLineCount: 2
elide: Text.ElideRight
lineHeight: 0.9
color: key.lit ? Color.foreground
: key.cell.kind === "held" ? key.tone
: key.cell.kind === "combo" ? Qt.alpha(Color.foreground, root.comboFocus >= 0 ? 0.25 : 0.45)
: key.dim ? Qt.alpha(Color.foreground, 0.22)
: key.toned ? key.tone : Color.foreground
font.family: Style.font.family
font.pixelSize: key.cell.kind === "held" ? Math.round(root.unit * 0.19) : root.sizeFor(key.cell.t)
font.weight: key.dim ? Font.Normal : Font.DemiBold
font.italic: key.cell.kind === "held"
}
// Hold action underneath.
Text {
anchors.bottom: parent.bottom
anchors.bottomMargin: Math.round(root.unit * 0.07)
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 6
horizontalAlignment: Text.AlignHCenter
visible: text !== "" && !key.dim
text: key.cell.h
elide: Text.ElideRight
color: key.cell.holdTint > 0 ? root.layerColor(key.cell.holdTint) : Qt.alpha(Color.foreground, 0.55)
font.family: Style.font.family
font.pixelSize: Math.round(root.unit * 0.155)
font.bold: key.cell.holdTint > 0
}
// Combos tab: pointing at a key keeps only its combos bright.
HoverHandler {
enabled: key.inCombo
cursorShape: Qt.PointingHandCursor
onHoveredChanged: {
if (hovered) root.comboFocus = key.index
else if (root.comboFocus === key.index) root.comboFocus = -1
}
}
// Overview: the other layers in the corners.
Repeater {
model: key.cell.corners
delegate: Text {
required property var modelData
readonly property bool atLeft: modelData.place === "tl" || modelData.place === "bl"
readonly property bool atTop: modelData.place === "tl" || modelData.place === "tr"
x: atLeft ? Math.round(root.unit * 0.08) : key.width - width - Math.round(root.unit * 0.08)
y: atTop ? Math.round(root.unit * 0.05) : key.height - height - Math.round(root.unit * 0.05)
width: Math.min(implicitWidth, key.width * 0.62)
horizontalAlignment: atLeft ? Text.AlignLeft : Text.AlignRight
text: modelData.text
elide: Text.ElideRight
color: modelData.color
font.family: Style.font.family
font.pixelSize: Math.round(root.unit * (root.isArrow(modelData.text) ? 0.25 : String(modelData.text).length > 3 ? 0.14 : 0.175))
font.weight: Font.Medium
}
}
}
}
// Combos tab: each result on the seam between its two keys; keys
// far apart get a dashed line.
Repeater {
model: root.comboMode ? root.allCombos : []
delegate: Item {
id: combo
required property var modelData
readonly property var pa: root.layoutKeys[modelData.keys[0]] || ({ x: 0, y: 0 })
readonly property var pb: root.layoutKeys[modelData.keys[modelData.keys.length - 1]] || ({ x: 0, y: 0 })
readonly property real ax: (pa.x + 0.5) * root.unit
readonly property real ay: (pa.y + 0.5) * root.unit
readonly property real bx: (pb.x + 0.5) * root.unit
readonly property real by: (pb.y + 0.5) * root.unit
readonly property bool far: Math.hypot(pa.x - pb.x, pa.y - pb.y) > 1.6
readonly property real lift: far ? -root.unit * 0.55 : 0
readonly property bool on: root.comboFocus < 0 || modelData.keys.indexOf(root.comboFocus) >= 0
anchors.fill: parent
z: on && root.comboFocus >= 0 ? 3 : 2
opacity: on ? 1 : 0.12
Behavior on opacity { NumberAnimation { duration: 120 } }
Shape {
anchors.fill: parent
visible: combo.far
preferredRendererType: Shape.CurveRenderer
ShapePath {
strokeColor: Qt.alpha(Color.accent, 0.6)
strokeWidth: 1.5
fillColor: "transparent"
strokeStyle: ShapePath.DashLine
dashPattern: [3, 3]
startX: combo.ax
startY: combo.ay
PathQuad {
controlX: (combo.ax + combo.bx) / 2
controlY: (combo.ay + combo.by) / 2 + combo.lift
x: combo.bx
y: combo.by
}
}
}
Repeater {
model: combo.far ? [[combo.ax, combo.ay], [combo.bx, combo.by]] : []
delegate: Rectangle {
required property var modelData
width: Math.max(5, Math.round(root.unit * 0.09))
height: width
radius: width / 2
x: modelData[0] - width / 2
y: modelData[1] - height / 2
color: Color.accent
}
}
Rectangle {
readonly property bool wide: String(combo.modelData.legend).length > 2
height: Math.round(root.unit * 0.36)
width: Math.max(height, badgeText.implicitWidth + Math.round(root.unit * 0.18))
x: (combo.ax + combo.bx) / 2 - width / 2
y: (combo.ay + combo.by) / 2 + combo.lift / 2 - height / 2
radius: Math.round(height * 0.3)
color: combo.far ? Color.background : Color.accent
border.width: combo.far ? 1 : 2
border.color: combo.far ? Qt.alpha(Color.accent, 0.6) : Qt.rgba(0, 0, 0, 0.35)
scale: combo.on && root.comboFocus >= 0 ? 1.15 : 1
Behavior on scale { NumberAnimation { duration: 120 } }
Text {
id: badgeText
anchors.centerIn: parent
text: combo.modelData.legend || "?"
color: combo.far ? Color.accent : Color.accentText
font.family: Style.font.family
font.pixelSize: Math.round(root.unit * (parent.wide ? 0.16 : 0.22))
font.bold: true
}
}
}
}
}
}
// Combos tab: what the key you point at makes, or the layer combos.
Item {
width: parent.width
height: Style.space(28)
visible: root.comboMode
Flow {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: parent.width
spacing: Style.spacing.md
Repeater {
model: root.comboFocus < 0 ? root.layerCombos : []
delegate: Rectangle {
id: lchip
required property var modelData
width: lrow.implicitWidth + Style.spacing.xxl * 2
height: Style.space(28)
radius: Style.space(8)
color: Qt.alpha(Color.foreground, 0.04)
border.width: 1
border.color: Qt.alpha(Color.foreground, 0.08)
Row {
id: lrow
anchors.centerIn: parent
spacing: Style.spacing.sm
Text {
text: "hold"
color: Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
}
Repeater {
model: lchip.modelData.hold
delegate: Text {
required property var modelData
required property int index
text: (index ? "+ " : "") + modelData
color: root.layerColor(root.layerIndex(modelData))
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
font.bold: true
}
}
Text {
text: "→"
color: Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
}
Text {
text: lchip.modelData.layer
color: root.layerColor(root.layerIndex(lchip.modelData.layer))
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
font.bold: true
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.select(root.layerIndex(lchip.modelData.layer))
}
}
}
Repeater {
model: root.focusCombos
delegate: Rectangle {
id: chip
required property var modelData
width: crow.implicitWidth + Style.spacing.xl * 2
height: Style.space(28)
radius: Style.space(8)
color: Qt.alpha(Color.accent, 0.1)
border.width: 1
border.color: Qt.alpha(Color.accent, 0.4)
Row {
id: crow
anchors.centerIn: parent
spacing: Style.spacing.xs
Repeater {
model: chip.modelData.keys
delegate: Row {
id: part
required property var modelData
required property int index
spacing: Style.spacing.xs
Text {
anchors.verticalCenter: parent.verticalCenter
visible: part.index > 0
text: "+"
color: Qt.alpha(Color.foreground, 0.35)
font.family: Style.font.family
font.pixelSize: Style.font.caption
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
readonly property string label: root.legend(root.base[part.modelData]) || ("#" + part.modelData)
width: Math.max(Style.space(18), capText.implicitWidth + Style.space(8))
height: Style.space(18)
radius: Style.space(4)
color: Qt.alpha(Color.foreground, 0.08)
border.width: 1
border.color: Qt.alpha(Color.foreground, 0.12)
Text {
id: capText
anchors.centerIn: parent
text: parent.label
color: Qt.alpha(Color.foreground, 0.85)
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.weight: Font.DemiBold
}
}
}
}
Text {
anchors.verticalCenter: parent.verticalCenter
leftPadding: Style.spacing.xs
text: "→"
color: Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
}
Text {
anchors.verticalCenter: parent.verticalCenter
text: chip.modelData.legend || "?"
color: Color.accent
font.family: Style.font.family
font.pixelSize: Style.font.body
font.bold: true
}
}
}
}
}
Text {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
visible: root.comboFocus < 0
text: "Point at a key to see only its combos"
color: Color.muted
font.family: Style.font.family
font.pixelSize: Style.font.bodySmall
}
}
Text {
width: parent.width
visible: root.setting("showHints", true) !== false
horizontalAlignment: Text.AlignRight
text: "Arrow keys or 0–" + Math.min(9, root.lastTab + 1) + " switch tabs · " + (root.combosOn ? "C combos · " : "") + "R refresh · checks the repo every " + (root.service ? root.service.checkMinutes : 2) + " min"
color: Qt.alpha(Color.foreground, 0.32)
font.family: Style.font.family
font.pixelSize: Style.font.caption
}
}
}
}