Skip to content

Commit a5d688e

Browse files
committed
Add tab indicator for working terminal tab
1 parent 893c2cc commit a5d688e

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/Application.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ public class Terminal.Application : Gtk.Application {
185185

186186
if (terminal != terminal.main_window.current_terminal) {
187187
terminal.tab_state = tab_state;
188+
} else if (terminal.tab_state == WORKING) {
189+
terminal.tab_state = NONE;
188190
}
189191

190192
if (!(get_active_window ().is_active)) {

src/MainWindow.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ namespace Terminal {
303303
return;
304304
}
305305

306-
term.tab_state = NONE;
306+
if (term.tab_state != WORKING) {
307+
term.tab_state = NONE;
308+
}
307309
});
308310

309311
notebook.tab_bar.bind_property ("tabs-revealed", new_tab_revealer, "reveal-child", SYNC_CREATE | INVERT_BOOLEAN);

src/Widgets/TerminalView.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ public class Terminal.TerminalView : Granite.Bin {
170170
terminal_widget.tab = tab;
171171

172172
terminal_widget.notify["tab-state"].connect (() => {
173+
tab.loading = terminal_widget.tab_state == WORKING;
174+
173175
switch (terminal_widget.tab_state) {
174176
case NONE:
177+
case WORKING:
175178
tab.icon = null;
176179
break;
177180
case COMPLETED:

src/Widgets/TerminalWidget.vala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Terminal {
77
public class TerminalWidget : Vte.Terminal {
88
public enum TabState {
99
NONE,
10+
WORKING,
1011
COMPLETED,
1112
ERROR
1213
}
@@ -233,6 +234,7 @@ namespace Terminal {
233234
notify["width-request"].connect (() => resized = true);
234235
contents_changed.connect (on_contents_changed);
235236
child_exited.connect (on_child_exited);
237+
window_title_changed.connect (on_window_title_changed);
236238
ulong once = 0;
237239
once = realize.connect (() => {
238240
clipboard = Gdk.Display.get_default ().get_clipboard ();
@@ -784,6 +786,14 @@ namespace Terminal {
784786
fg_pid = -1;
785787
}
786788

789+
private void on_window_title_changed () {
790+
if (has_foreground_process ()) {
791+
tab_state = WORKING;
792+
}
793+
794+
// Application.dbus_register handles resetting the state
795+
}
796+
787797
public void kill_fg () {
788798
int fg_pid;
789799
if (this.try_get_foreground_pid (out fg_pid)) {

0 commit comments

Comments
 (0)