xiterm

simple vte terminal emulator
git clone https://git.ce9e.org/xiterm.git

commit
b55dd14035e9323a1f94b37c1962a31d0f5ab52c
parent
781a8e84a2415d99ae01da9adab96299cacdd641
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-09-18 18:12
hide tabs on single tab

Diffstat

M xiterm.c 11 +++++++++++

1 files changed, 11 insertions, 0 deletions


diff --git a/xiterm.c b/xiterm.c

@@ -11,11 +11,21 @@ gboolean match_key(GdkEventKey *event, int state, int keyval) {
   11    11 	return event->state == state && event->keyval == keyval;
   12    12 }
   13    13 
   -1    14 void update_show_tabs() {
   -1    15 	if (gtk_notebook_get_n_pages(notebook) > 1) {
   -1    16 		gtk_notebook_set_show_tabs(notebook, TRUE);
   -1    17 	} else {
   -1    18 		gtk_notebook_set_show_tabs(notebook, FALSE);
   -1    19 	}
   -1    20 }
   -1    21 
   14    22 void on_term_exit(VteTerminal *term, int status, gpointer user_data) {
   15    23 	gtk_notebook_remove_page(notebook, gtk_notebook_page_num(notebook, GTK_WIDGET(term)));
   16    24 
   17    25 	if (gtk_notebook_get_n_pages(notebook) == 0) {
   18    26 		g_application_quit(G_APPLICATION(app));
   -1    27 	} else {
   -1    28 		update_show_tabs();
   19    29 	}
   20    30 }
   21    31 
@@ -48,6 +58,7 @@ void add_tab(void) {
   48    58 	gtk_notebook_set_tab_reorderable(notebook, page, TRUE);
   49    59 	gtk_container_child_set(GTK_CONTAINER(notebook), page, "tab-expand", TRUE, NULL);
   50    60 
   -1    61 	update_show_tabs();
   51    62 	gtk_widget_show(page);
   52    63 	gtk_notebook_set_current_page(notebook, page_num);
   53    64 	gtk_widget_grab_focus(page);