aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/qs-hyprview-trixie/modules/SearchBox.qml
blob: 42971bd107e72ba84723bf5c82ba8ec3cc21ba6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import QtQuick
import Quickshell

Rectangle {
    id: searchBar
    width: Math.min(parent.width * 0.6, 480)
    height: 40
    radius: 20
    color: "#66000000"
    border.width: 1
    border.color: m3.m3Primary
    anchors.horizontalCenter: parent.horizontalCenter

    property var onTextChanged: null

    function reset() {
      searchInput.text = ""
    }

    function focusInput() {
        searchInput.forceActiveFocus(Qt.ActiveWindowFocusReason)
    }

    function releaseInputFocus() {
        searchInput.focus = false
    }

    TextInput {
        id: searchInput
        anchors.fill: parent
        anchors.leftMargin: 16
        anchors.rightMargin: 16
        verticalAlignment: TextInput.AlignVCenter
        color: "white"
        font.pixelSize: 16
        activeFocusOnTab: false
        selectByMouse: true
        focus: false

        onTextChanged: {
            searchBar.onTextChanged(text)
        }

        Text {
            anchors.fill: parent
            verticalAlignment: Text.AlignVCenter
            color: "#88ffffff"
            font.pixelSize: 14
            text: "Type to filter windows..."
            visible: !searchInput.text || searchInput.text.length === 0
        }
    }
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage