diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 8f8f496c5e..d75d588213 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -492,6 +492,10 @@ public class Scratch.MainWindow : Hdy.Window { visible = false }; + terminal.terminal.notify["is-focus"].connect (() => { + on_terminal_focus_change (); + }); + var view_grid = new Gtk.Grid () { orientation = Gtk.Orientation.VERTICAL }; @@ -619,6 +623,27 @@ public class Scratch.MainWindow : Hdy.Window { set_widgets_sensitive (false); } + private bool on_terminal_focus_change () { + var focused = terminal.terminal.is_focus; + //r +- shift + Utils.action_from_group (ACTION_SHOW_REPLACE, actions).set_enabled (!focused); + Utils.action_from_group (ACTION_RESTORE_PROJECT_DOCS, actions).set_enabled (!focused); + //z +- shift + Utils.action_from_group (ACTION_UNDO, actions).set_enabled (!focused); + Utils.action_from_group (ACTION_REDO, actions).set_enabled (!focused); + + //u + Utils.action_from_group (ACTION_TO_UPPER_CASE, actions).set_enabled (!focused); + + //k +- shift + Utils.action_from_group (ACTION_DUPLICATE_TAB, actions).set_enabled (!focused); + Utils.action_from_group (ACTION_CLEAR_LINES, actions).set_enabled (!focused); + + //l + Utils.action_from_group (ACTION_TO_LOWER_CASE, actions).set_enabled (!focused); + return false; + } + private void open_binary (File file) { if (!file.query_exists ()) { return;