config/patches/base/blackbox/remove-process-watcher.patch

138 lines
4.5 KiB
Diff

diff --git a/src/services/meson.build b/src/services/meson.build
index 0f9114b..390e869 100644
--- a/src/services/meson.build
+++ b/src/services/meson.build
@@ -1,5 +1,4 @@
blackbox_sources += files([
- 'ProcessWatcher.vala',
'Scheme.vala',
'Settings.vala',
'Shortcuts.vala',
diff --git a/src/widgets/Terminal.vala b/src/widgets/Terminal.vala
index 7d53851..49db51b 100644
--- a/src/widgets/Terminal.vala
+++ b/src/widgets/Terminal.vala
@@ -49,13 +49,10 @@ public class Terminal.Terminal : Vte.Terminal {
public signal void spawn_failed (string? error_message);
- public signal void context_changed (ProcessContext context);
-
// Properties
public Scheme scheme { get; set; }
public Pid pid { get; protected set; default = -1; }
- public Process? process { get; protected set; default = null; }
public uint user_scrollback_lines {
get {
@@ -481,56 +478,6 @@ public class Terminal.Terminal : Vte.Terminal {
if (_pid < 0) {
return;
}
-
- this.process = new Process () {
- terminal_fd = this.pty.get_fd (),
- pid = this.pid,
- foreground_pid = -1,
- };
-
- this.process.foreground_task_finished.connect ((_process) => {
- var desktop_notifications_enabled =
- Settings.get_default ().notify_process_completion;
-
- if (
- desktop_notifications_enabled &&
- !this.has_focus &&
- _process.last_foreground_task_command != null
- ) {
- var n = new GLib.Notification (_("Command completed"));
- n.set_body (_process.last_foreground_task_command);
-
- // TODO: improve this notification system so that when a user clicks
- // the notification, Black Box focuses the right terminal window and
- // automatically focusses the tab that just completed.
- //
- // https://valadoc.org/gio-2.0/GLib.Notification.set_default_action.html
- // https://valadoc.org/gio-2.0/GLib.Action.parse_detailed_name.html
-
- this.window.application.send_notification (null, n);
-
- // GNOME seems to be showing the same notification twice. I am sure we
- // are not calling this twice. This may be an upstream bug.
- GLib.Application.get_default ().send_notification (null, n);
- }
- });
-
- this.process.notify ["context"].connect ((__process, spec) => {
- var context = (_process as Process)?.context ?? ProcessContext.DEFAULT;
-
- this.context_changed.emit (context);
- // string context_str =
- // context == ProcessContext.SSH
- // ? "ssh"
- // : context == ProcessContext.ROOT
- // ? "root"
- // : "default";
- // message ("New context for process: %s", context_str);
- });
-
- ProcessWatcher.get_instance ().watch (this.process);
-
- this.context_changed.emit (this.process.context);
}
private async bool spawn_on_flatpak (Vte.PtyFlags flags,
@@ -603,7 +550,6 @@ public class Terminal.Terminal : Vte.Terminal {
// This is not a good idea. Another thread might be modifying this field
// as well.
// this.process.ended = true;
- this.process = null;
this.exit ();
}
diff --git a/src/widgets/Window.vala b/src/widgets/Window.vala
index 4ede36c..2e0003b 100644
--- a/src/widgets/Window.vala
+++ b/src/widgets/Window.vala
@@ -215,10 +215,6 @@ public class Terminal.Window : Adw.ApplicationWindow {
SettingsBindFlags.GET
);
- this.settings.notify ["context-aware-header-bar"].connect (() => {
- this.on_active_terminal_context_changed ();
- });
-
this.header_bar_revealer.notify ["reveal-child"]
.connect (this.on_reveal_header_bar_changed);
@@ -806,29 +802,6 @@ public class Terminal.Window : Adw.ApplicationWindow {
.connect (this.on_active_terminal_title_changed);
this.active_terminal_tab_signal_handlers.append_val (handler);
-
- this.on_active_terminal_context_changed ();
- handler = this.active_terminal
- .context_changed
- .connect (this.on_active_terminal_tab_changed);
- }
-
- private void on_active_terminal_context_changed () {
- var context = this.active_terminal?.process?.context;
- var is_context_aware_enabled =
- Settings.get_default ().context_aware_header_bar;
-
- widget_set_css_class (
- this,
- "context-root",
- context == ProcessContext.ROOT && is_context_aware_enabled
- );
-
- widget_set_css_class (
- this,
- "context-ssh",
- context == ProcessContext.SSH && is_context_aware_enabled
- );
}
private void on_active_terminal_title_changed () {