1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-13 00:42:49 -05:00

Focus text inputs by default

This commit is contained in:
bbedward
2025-07-22 21:16:00 -04:00
parent f1833a81a0
commit 2f50821db4
2 changed files with 25 additions and 9 deletions

View File

@@ -149,6 +149,9 @@ PanelWindow {
searchField.enabled = true; searchField.enabled = true;
searchDebounceTimer.stop(); // Stop any pending search searchDebounceTimer.stop(); // Stop any pending search
updateFilteredModel(); updateFilteredModel();
Qt.callLater(function() {
searchField.forceActiveFocus();
});
} }
function hide() { function hide() {

View File

@@ -14,6 +14,7 @@ DankModal {
property var clipboardEntries: [] property var clipboardEntries: []
property string searchText: "" property string searchText: ""
property bool shouldFocusSearch: false
function updateFilteredModel() { function updateFilteredModel() {
filteredClipboardModel.clear(); filteredClipboardModel.clear();
@@ -118,6 +119,7 @@ DankModal {
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
refreshClipboard(); refreshClipboard();
shouldFocusSearch = true;
} }
} }
@@ -194,12 +196,24 @@ DankModal {
clipboardHistory.searchText = text; clipboardHistory.searchText = text;
updateFilteredModel(); updateFilteredModel();
} }
Connections {
target: clipboardHistory
function onShouldFocusSearchChanged() {
if (shouldFocusSearch) {
Qt.callLater(function() {
searchField.forceActiveFocus();
shouldFocusSearch = false;
});
}
}
}
} }
// Clipboard entries list // Clipboard entries list
Rectangle { Rectangle {
width: parent.width width: parent.width
height: parent.height - 100 height: parent.height - 110
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1)
clip: true clip: true
@@ -280,14 +294,13 @@ DankModal {
onClicked: copyEntry(model.entry) onClicked: copyEntry(model.entry)
} }
} }
} Text {
text: "No clipboard entries found"
Text { anchors.centerIn: parent
text: "No clipboard entries found" font.pixelSize: Theme.fontSizeMedium
anchors.centerIn: parent color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeMedium visible: filteredClipboardModel.count === 0
color: Theme.surfaceVariantText }
visible: filteredClipboardModel.count === 0
} }
} }
} }