Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix foreground process shortcuts #680

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
32 changes: 32 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,38 @@ namespace Terminal {
if (recreate_tabs) {
open_tabs ();
}

// Pass key presses to foreground process if there is one
key_press_event.connect ((event) => {
if (current_terminal.has_foreground_process ()) {
search_toolbar.search_entry.sensitive = false;
search_button.sensitive = false;
return current_terminal.key_press_event (event);
} else {
return false;
}
});

// As there is no signal on the start and end of a foreground process have to
// set search sensitivty after each key release
key_release_event.connect_after (() => {
set_search_sensitivity ();
return false;
});

// Set search search sensitivy when tab changed with mouse
notify["current-terminal"].connect (set_search_sensitivity);
}


private void set_search_sensitivity () {
if (current_terminal.has_foreground_process ()) {
search_toolbar.search_entry.sensitive = false;
search_button.sensitive = false;
} else {
search_toolbar.search_entry.sensitive = true;
search_button.sensitive = true;
}
}

public void add_tab_with_working_directory (string? directory, string? command = null, bool create_new_tab = false) {
Expand Down