diff --git a/Modules/Launcher/Launcher.qml b/Modules/Launcher/Launcher.qml index 4726770..0ad25da 100644 --- a/Modules/Launcher/Launcher.qml +++ b/Modules/Launcher/Launcher.qml @@ -243,52 +243,45 @@ NPanel { anchors.margins: Style.marginL * scaling spacing: Style.marginM * scaling - Item { - id: searchInputWrap + NTextInput { + id: searchInput Layout.fillWidth: true - Layout.preferredHeight: Math.round(Style.barHeight * scaling) - NTextInput { - id: searchInput - anchors.fill: parent - inputMaxWidth: Number.MAX_SAFE_INTEGER + fontSize: Style.fontSizeL * scaling + fontWeight: Style.fontWeightSemiBold - fontSize: Style.fontSizeL * scaling - fontWeight: Style.fontWeightSemiBold + text: searchText + placeholderText: "Search entries... or use > for commands" - text: searchText - placeholderText: "Search entries... or use > for commands" + onTextChanged: searchText = text - onTextChanged: searchText = text + Component.onCompleted: { + if (searchInput.inputItem && searchInput.inputItem.visible) { + searchInput.inputItem.forceActiveFocus() - Component.onCompleted: { - if (searchInput.inputItem && searchInput.inputItem.visible) { - searchInput.inputItem.forceActiveFocus() - - // Override the TextField's default Home/End behavior - searchInput.inputItem.Keys.priority = Keys.BeforeItem - searchInput.inputItem.Keys.onPressed.connect(function (event) { - // Intercept Home and End BEFORE the TextField handles them - if (event.key === Qt.Key_Home) { - ui.selectFirst() - event.accepted = true - return - } else if (event.key === Qt.Key_End) { - ui.selectLast() - event.accepted = true - return - } - }) - searchInput.inputItem.Keys.onDownPressed.connect(function (event) { - ui.selectNext() - }) - searchInput.inputItem.Keys.onUpPressed.connect(function (event) { - ui.selectPrevious() - }) - searchInput.inputItem.Keys.onReturnPressed.connect(function (event) { - ui.activate() - }) - } + // Override the TextField's default Home/End behavior + searchInput.inputItem.Keys.priority = Keys.BeforeItem + searchInput.inputItem.Keys.onPressed.connect(function (event) { + // Intercept Home and End BEFORE the TextField handles them + if (event.key === Qt.Key_Home) { + ui.selectFirst() + event.accepted = true + return + } else if (event.key === Qt.Key_End) { + ui.selectLast() + event.accepted = true + return + } + }) + searchInput.inputItem.Keys.onDownPressed.connect(function (event) { + ui.selectNext() + }) + searchInput.inputItem.Keys.onUpPressed.connect(function (event) { + ui.selectPrevious() + }) + searchInput.inputItem.Keys.onReturnPressed.connect(function (event) { + ui.activate() + }) } } } diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index 2e1e4aa..4454037 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -477,25 +477,23 @@ NPanel { } } - sourceComponent: ColumnLayout { - ScrollView { - id: scrollView - Layout.fillWidth: true - Layout.fillHeight: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AsNeeded - padding: Style.marginL * scaling - clip: true + sourceComponent: ScrollView { + id: scrollView + Layout.fillWidth: true + Layout.fillHeight: true + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AsNeeded + padding: Style.marginL * scaling + clip: true - Component.onCompleted: { - root.activeScrollView = scrollView - } + Component.onCompleted: { + root.activeScrollView = scrollView + } - Loader { - active: true - sourceComponent: root.tabsModel[index].source - width: scrollView.availableWidth - } + Loader { + active: true + sourceComponent: root.tabsModel[index].source + width: scrollView.availableWidth } } } diff --git a/Modules/SettingsPanel/Tabs/GeneralTab.qml b/Modules/SettingsPanel/Tabs/GeneralTab.qml index c0d5f54..0ec0064 100644 --- a/Modules/SettingsPanel/Tabs/GeneralTab.qml +++ b/Modules/SettingsPanel/Tabs/GeneralTab.qml @@ -22,9 +22,11 @@ ColumnLayout { fallbackIcon: "person" borderColor: Color.mPrimary borderWidth: Math.max(1, Style.borderM * scaling) + Layout.alignment: Qt.AlignTop } NTextInput { + Layout.fillWidth: true label: `${Quickshell.env("USER") || "user"}'s profile picture` description: "Your profile picture that appears throughout the interface." text: Settings.data.general.avatarImage diff --git a/Modules/SettingsPanel/Tabs/WallpaperTab.qml b/Modules/SettingsPanel/Tabs/WallpaperTab.qml index e2832dd..3115f03 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperTab.qml @@ -278,7 +278,6 @@ ColumnLayout { NTextInput { label: "Custom Interval" description: "Enter time as HH:MM (e.g., 01:30)." - inputMaxWidth: 100 * scaling text: { const s = Settings.data.wallpaper.randomIntervalSec const h = Math.floor(s / 3600) diff --git a/Widgets/NTextInput.qml b/Widgets/NTextInput.qml index 1cb7141..3db9d9b 100644 --- a/Widgets/NTextInput.qml +++ b/Widgets/NTextInput.qml @@ -11,7 +11,6 @@ ColumnLayout { property string description: "" property bool readOnly: false property bool enabled: true - property int inputMaxWidth: Math.round(420 * scaling) property color labelColor: Color.mOnSurface property color descriptionColor: Color.mOnSurfaceVariant property string fontFamily: Settings.data.ui.fontDefault @@ -26,7 +25,6 @@ ColumnLayout { signal editingFinished spacing: Style.marginS * scaling - implicitHeight: frame.height NLabel { label: root.label @@ -34,6 +32,7 @@ ColumnLayout { labelColor: root.labelColor descriptionColor: root.descriptionColor visible: root.label !== "" || root.description !== "" + Layout.fillWidth: true } // Container @@ -42,50 +41,48 @@ ColumnLayout { Layout.fillWidth: true Layout.minimumWidth: 80 * scaling - Layout.maximumWidth: root.inputMaxWidth - - implicitWidth: parent.width implicitHeight: Style.baseWidgetSize * 1.1 * scaling + radius: Style.radiusM * scaling color: Color.mSurface - border.color: Color.mOutline + border.color: input.activeFocus ? Color.mSecondary : Color.mOutline border.width: Math.max(1, Style.borderS * scaling) - // Focus ring - Rectangle { - anchors.fill: parent - radius: frame.radius - color: Color.transparent - border.color: input.activeFocus ? Color.mSecondary : Color.transparent - border.width: input.activeFocus ? Math.max(1, Style.borderS * scaling) : 0 - - Behavior on border.color { - ColorAnimation { - duration: Style.animationFast - } + Behavior on border.color { + ColorAnimation { + duration: Style.animationFast } } - RowLayout { + TextField { + id: input + anchors.fill: parent anchors.leftMargin: Style.marginM * scaling anchors.rightMargin: Style.marginM * scaling - spacing: Style.marginS * scaling - TextField { - id: input - Layout.fillWidth: true - echoMode: TextInput.Normal - readOnly: root.readOnly - enabled: root.enabled - color: Color.mOnSurface - placeholderTextColor: Qt.alpha(Color.mOnSurfaceVariant, 0.6) - background: null - font.family: fontFamily - font.pointSize: fontSize - font.weight: fontWeight - onEditingFinished: root.editingFinished() - } + verticalAlignment: TextInput.AlignVCenter + + echoMode: TextInput.Normal + readOnly: root.readOnly + enabled: root.enabled + color: Color.mOnSurface + placeholderTextColor: Qt.alpha(Color.mOnSurfaceVariant, 0.6) + + selectByMouse: true + + topPadding: 0 + bottomPadding: 0 + leftPadding: 0 + rightPadding: 0 + + background: null + + font.family: root.fontFamily + font.pointSize: root.fontSize + font.weight: root.fontWeight + + onEditingFinished: root.editingFinished() } } }