File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -492,6 +492,10 @@ public class Scratch.MainWindow : Hdy.Window {
492492 visible = false
493493 };
494494
495+ terminal. terminal. notify[" is-focus" ]. connect (() = > {
496+ on_terminal_focus_change ();
497+ });
498+
495499 var view_grid = new Gtk .Grid () {
496500 orientation = Gtk . Orientation . VERTICAL
497501 };
@@ -619,6 +623,27 @@ public class Scratch.MainWindow : Hdy.Window {
619623 set_widgets_sensitive (false );
620624 }
621625
626+ private bool on_terminal_focus_change () {
627+ var focused = terminal. terminal. is_focus;
628+ // <Control>r +- shift
629+ Utils . action_from_group (ACTION_SHOW_REPLACE , actions). set_enabled (! focused);
630+ Utils . action_from_group (ACTION_RESTORE_PROJECT_DOCS , actions). set_enabled (! focused);
631+ // <Control>z +- shift
632+ Utils . action_from_group (ACTION_UNDO , actions). set_enabled (! focused);
633+ Utils . action_from_group (ACTION_REDO , actions). set_enabled (! focused);
634+
635+ // <Control>u
636+ Utils . action_from_group (ACTION_TO_UPPER_CASE , actions). set_enabled (! focused);
637+
638+ // <Control>k +- shift
639+ Utils . action_from_group (ACTION_DUPLICATE_TAB , actions). set_enabled (! focused);
640+ Utils . action_from_group (ACTION_CLEAR_LINES , actions). set_enabled (! focused);
641+
642+ // <Control>l
643+ Utils . action_from_group (ACTION_TO_LOWER_CASE , actions). set_enabled (! focused);
644+ return false ;
645+ }
646+
622647 private void open_binary (File file) {
623648 if (! file. query_exists ()) {
624649 return ;
You can’t perform that action at this time.
0 commit comments