summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-12-13 18:09:34 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-12-13 18:09:34 +0100
commit8730586cfdc85f9704c3d52914539897f7312e70 (patch)
tree71b7f904f297ff65ace86d46726fae64b32ac165
parentRevert "Disable keyboard selection for text by default" (diff)
downloadnheko-8730586cfdc85f9704c3d52914539897f7312e70.tar.xz
Focus text field on key press (swallows first though...)
-rw-r--r--resources/qml/TimelineView.qml2
-rw-r--r--resources/qml/TopBar.qml3
2 files changed, 5 insertions, 0 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index dff23700..e168c883 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -28,6 +28,8 @@ Item {
 
     onRoomChanged: if (room != null) room.triggerSpecialEffects()
 
+    Keys.onPressed: if (!topBar.searchHasFocus) TimelineManager.focusMessageInput();
+
     Shortcut {
         sequence: StandardKey.Close
         onActivated: Rooms.resetCurrentRoom()
diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 5d65f3bc..760f20e6 100644
--- a/resources/qml/TopBar.qml
+++ b/resources/qml/TopBar.qml
@@ -25,6 +25,8 @@ Pane {
     property bool isDirect: room ? room.isDirect : false
     property string directChatOtherUserId: room ? room.directChatOtherUserId : ""
 
+    property bool searchHasFocus: searchField.focus && searchField.enabled
+
     property string searchString: ""
 
     onRoomIdChanged: {
@@ -447,6 +449,7 @@ Pane {
             MatrixTextField {
                 id: searchField
                 visible: searchButton.searchActive
+                enabled: visible
 
                 Layout.row: 5
                 Layout.column: 2