Shrink to a floating button instead of hiding

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>
This commit is contained in:
2026-10-31 01:05:37 +01:00
co-authored by Claude Opus 5.5
parent ac5f43ca5f
commit 032fbd8ba4
15 changed files with 401 additions and 14 deletions
+46
View File
@@ -0,0 +1,46 @@
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();
}
}
}