diff --git a/.config/quickshell/modules/overview/SearchItem.qml b/.config/quickshell/modules/overview/SearchItem.qml index 1e67290a..e024fae9 100644 --- a/.config/quickshell/modules/overview/SearchItem.qml +++ b/.config/quickshell/modules/overview/SearchItem.qml @@ -50,7 +50,7 @@ Button { anchors.fill: parent anchors.leftMargin: root.horizontalMargin anchors.rightMargin: root.horizontalMargin - radius: Appearance.rounding.small + radius: Appearance.rounding.normal color: (root.down || root.keyboardDown) ? Appearance.colors.colLayer1Active : ((root.hovered || root.focus) ? Appearance.colors.colLayer1Hover : Appearance.transparentize(Appearance.m3colors.m3surfaceContainerHigh, 1)) } diff --git a/.config/quickshell/modules/overview/SearchWidget.qml b/.config/quickshell/modules/overview/SearchWidget.qml index a3cf41d9..d7d7c25a 100644 --- a/.config/quickshell/modules/overview/SearchWidget.qml +++ b/.config/quickshell/modules/overview/SearchWidget.qml @@ -17,6 +17,21 @@ Item { // Wrapper implicitWidth: searchWidgetContent.implicitWidth + Appearance.sizes.elevationMargin * 2 implicitHeight: searchWidgetContent.implicitHeight + Appearance.sizes.elevationMargin * 2 + Keys.onPressed: { + // Only handle printable characters (ignore modifiers, arrows, etc.) + if (event.text && event.text.length === 1 && event.key !== Qt.Key_Enter && event.key !== Qt.Key_Return) { + if (!searchInput.activeFocus) { + searchInput.forceActiveFocus(); + // Insert the character at the cursor position + searchInput.text = searchInput.text.slice(0, searchInput.cursorPosition) + + event.text + + searchInput.text.slice(searchInput.cursorPosition); + searchInput.cursorPosition += 1; + event.accepted = true; + } + } + } + Rectangle { // Background id: searchWidgetContent anchors.centerIn: parent @@ -53,16 +68,16 @@ Item { // Wrapper TextField { // Search box id: searchInput - padding: 15 + focus: root.panelWindow.visible || GlobalStates.overviewOpen Layout.rightMargin: 15 + padding: 15 color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant selectedTextColor: Appearance.m3colors.m3onSurface placeholderText: qsTr("Search") placeholderTextColor: Appearance.m3colors.m3outline - focus: root.panelWindow.visible || GlobalStates.overviewOpen - implicitWidth: Appearance.sizes.searchWidth + onTextChanged: root.searchingText = text Connections { target: root @@ -72,6 +87,16 @@ Item { // Wrapper } } + onAccepted: { + if (appResults.count > 0) { + // Get the first visible delegate and trigger its click + let firstItem = appResults.itemAtIndex(0); + if (firstItem && firstItem.clicked) { + firstItem.clicked(); + } + } + } + background: Item {} cursorDelegate: Rectangle { @@ -93,7 +118,7 @@ Item { // Wrapper id: appResults visible: root.showResults Layout.fillWidth: true - implicitHeight: 600 + implicitHeight: Math.min(600, appResults.contentHeight + topMargin + bottomMargin) clip: true topMargin: 10 bottomMargin: 10 @@ -101,7 +126,7 @@ Item { // Wrapper KeyNavigation.up: searchBar model: ScriptModel { - id: model; + id: model values: DesktopEntries.applications.values .filter((entry) => { if (root.searchingText == "") return false