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 } }