With "Shrink to Button" on, the dismiss key shrinks the window to just itself: a see-through button that can be dragged anywhere. Tapping it grows the keyboard back around it, kept on screen. KWin moves and resizes the window through a one-off script, as Wayland clients can't place themselves. Also moves the window back on screen whenever it appears (KWin remembers where the button was), and releases the mouse after a window manager move or resize, which used to eat the next press on the grab bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.1 KiB
QML
47 lines
1.1 KiB
QML
import QtQuick
|
|
|
|
// The dismiss key left floating while the keyboard is shrunk; see-through so
|
|
// it hides less. Tap to bring the keyboard back; dragging is up to the owner
|
|
// (the window manager's move).
|
|
Item {
|
|
id: button
|
|
|
|
signal tapped()
|
|
signal dragStarted()
|
|
|
|
opacity: 0.6
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: qsTr("Show Keyboard")
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: Theme.keyRadius
|
|
color: tap.pressed ? Theme.characterKey : Theme.functionKey
|
|
}
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: "⌨"
|
|
font.pixelSize: button.height * 0.4
|
|
color: Theme.text
|
|
}
|
|
|
|
TapHandler {
|
|
id: tap
|
|
// The move ends with a release that would otherwise count as a tap.
|
|
property bool moved: false
|
|
onPressedChanged: if (pressed) moved = false
|
|
onTapped: if (!moved) button.tapped()
|
|
}
|
|
|
|
DragHandler {
|
|
target: null
|
|
onActiveChanged: {
|
|
if (!active)
|
|
return;
|
|
tap.moved = true;
|
|
button.dragStarted();
|
|
}
|
|
}
|
|
}
|