feat: complete quickshell redesign

This commit is contained in:
johannes committed 2026-09-13 11:58:37 +02:00
1 parent f5d827f3b9
commit 3631662afc
25 files changed
+1410 -401

No files matched your search

@@ -1,17 +1,18 @@
import QtQuick
import QtQuick.Effects
import "."
// Search/filter input with an animated focus border + glow, shared by
// Search/filter input with a hard focus border + shadow, shared by
// CommandPalette and ClipboardManager. Navigation is exposed as signals
// (rather than exposing the inner TextInput's Keys handlers directly) so
// each caller can wire up its own list navigation.
Rectangle {
Item {
id: field
property alias text: input.text
property alias echoMode: input.echoMode
property alias passwordCharacter: input.passwordCharacter
property string placeholder: ""
property string prefix: ""
signal escapePressed()
signal upPressed()
@@ -21,6 +22,12 @@ Rectangle {
function focusInput() { input.forceActiveFocus(); }
readonly property bool focused: input.activeFocus
readonly property color edgeColor: focused ? Theme.colors.primary : Theme.colors.crust
readonly property int offset: focused ? Theme.elevation.high : Theme.elevation.low
height: 50
// The layer-shell surface only gets real keyboard focus from the
// compositor asynchronously after it's first mapped, so a single
// forceActiveFocus() call right on visible-toggle can silently lose
@@ -34,51 +41,70 @@ Rectangle {
onTriggered: input.forceActiveFocus()
}
height: 50
color: Theme.colors.surface
radius: Theme.geometry.radiusSmall
border.width: 1
border.color: input.activeFocus ? Theme.colors.primary : Theme.colors.border
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
layer.enabled: input.activeFocus
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: Theme.colors.primary
shadowOpacity: Theme.elevation.low.opacity
shadowBlur: Theme.elevation.low.blur
shadowHorizontalOffset: 0
shadowVerticalOffset: 0
Rectangle {
x: field.offset
y: field.offset
width: field.width
height: field.height
color: field.edgeColor
}
TextInput {
id: input
anchors.fill: parent
anchors.margins: Theme.geometry.padding
verticalAlignment: TextInput.AlignVCenter
font.family: Theme.font.family
font.pixelSize: 18
color: Theme.colors.text
clip: true
Rectangle {
width: field.width
height: field.height
color: Theme.colors.surface
border.width: Theme.geometry.borderWidth
border.color: field.edgeColor
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
Text {
text: field.placeholder
color: Theme.colors.textMuted
id: prefixText
text: field.prefix
visible: field.prefix.length > 0
color: Theme.colors.secondary
font.family: Theme.font.family
font.bold: true
font.pixelSize: 18
anchors.left: parent.left
anchors.leftMargin: Theme.geometry.padding
anchors.verticalCenter: parent.verticalCenter
visible: input.text.length === 0
}
Keys.onEscapePressed: (event) => { field.escapePressed(); event.accepted = true; }
Keys.onUpPressed: (event) => { field.upPressed(); event.accepted = true; }
Keys.onDownPressed: (event) => { field.downPressed(); event.accepted = true; }
Keys.onReturnPressed: (event) => { field.returnPressed(); event.accepted = true; }
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && input.text.length === 0)) {
field.deleteRequested();
event.accepted = true;
TextInput {
id: input
anchors.fill: parent
anchors.margins: Theme.geometry.padding
anchors.leftMargin: field.prefix.length > 0 ? prefixText.width + Theme.geometry.padding + Theme.geometry.spacing / 2 : Theme.geometry.padding
verticalAlignment: TextInput.AlignVCenter
font.family: Theme.font.family
font.pixelSize: 18
color: Theme.colors.text
clip: true
cursorDelegate: Rectangle {
width: 9
color: Theme.colors.primary
}
Text {
text: field.placeholder
color: Theme.colors.textMuted
font.family: Theme.font.family
font.pixelSize: 18
anchors.verticalCenter: parent.verticalCenter
visible: input.text.length === 0
}
Keys.onEscapePressed: (event) => { field.escapePressed(); event.accepted = true; }
Keys.onUpPressed: (event) => { field.upPressed(); event.accepted = true; }
Keys.onDownPressed: (event) => { field.downPressed(); event.accepted = true; }
Keys.onReturnPressed: (event) => { field.returnPressed(); event.accepted = true; }
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && input.text.length === 0)) {
field.deleteRequested();
event.accepted = true;
}
}
}
}