Philipp Hörist pushed to branch master at gajim / gajim


Commits:
dacdea08 by Philipp Hörist at 2025-12-23T22:52:20+01:00
feat: Shortcuts: Add new shortcut for focusing the message input

- - - - -
0e31d175 by Philipp Hörist at 2025-12-23T22:52:47+01:00
fix: FileTransfer: Focus input after sending file

- - - - -


4 changed files:

- gajim/gtk/chat_function_page.py
- gajim/gtk/const.py
- gajim/gtk/main.py
- gajim/gtk/message_actions_box.py


Changes:

=====================================
gajim/gtk/chat_function_page.py
=====================================
@@ -291,6 +291,7 @@ def _on_confirm_clicked(self, _button: Gtk.Button) -> None:
                 return
 
             self._send_files(self._widget.get_catalog())
+            app.window.activate_action("win.input-focus")
 
         elif self._mode == FunctionMode.CHANGE_NICKNAME:
             assert isinstance(self._widget, InputWidget)


=====================================
gajim/gtk/const.py
=====================================
@@ -201,6 +201,7 @@ def __str__(self):
     ("input-italic", None, True),
     ("input-strike", None, True),
     ("input-clear", None, True),
+    ("input-focus", None, True),
     ("insert-emoji", "s", True),
     ("show-emoji-chooser", None, True),
     ("activate-message-selection", "u", True),
@@ -531,6 +532,9 @@ class ShortcutData:
     "win.input-clear": ShortcutData(
         label=_("Clear Input"), category="messages", 
accelerators=["<Primary>U"]
     ),
+    "win.input-focus": ShortcutData(
+        label=_("Focus Input"), category="messages", accelerators=[]
+    ),
     "win.scroll-view-up": ShortcutData(
         label=_("Scroll Up"), category="messages", 
accelerators=["<Shift>Page_Up"]
     ),


=====================================
gajim/gtk/main.py
=====================================
@@ -274,7 +274,7 @@ def _on_key_pressed(
         state: Gdk.ModifierType,
     ) -> bool:
         if keyval == Gdk.KEY_space:
-            self.get_chat_stack().get_message_input().grab_focus()
+            self.activate_action("win.input-focus")
             return Gdk.EVENT_STOP
 
         return Gdk.EVENT_PROPAGATE


=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -170,6 +170,7 @@ def _on_register_actions(self, _event: 
events.RegisterActions) -> None:
             "input-italic",
             "input-strike",
             "input-clear",
+            "input-focus",
             "show-emoji-chooser",
             "paste-as-quote",
             "paste-as-code-block",
@@ -259,7 +260,10 @@ def _on_action(
         action_name = action.get_name()
         log.info("Activate action: %s", action_name)
 
-        if action_name == "input-clear":
+        if action_name == "input-focus":
+            self.msg_textview.grab_focus_delayed()
+
+        elif action_name == "input-clear":
             self._on_clear()
 
         elif action_name.startswith("input-"):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/6bf6f490373f792a673a1d2f87fe958e88e052ad...0e31d175af9eb640fc58000de779f16cbc211611

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/6bf6f490373f792a673a1d2f87fe958e88e052ad...0e31d175af9eb640fc58000de779f16cbc211611
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to