enComputerevilvte
adm Find login register

Suggested simple feature

guest
1subject: Suggested simple featurePromote 0 Bookmark 02008-08-13quote  

It would be nice if evilvte could be configured to support the -title command line option, similar to rxvt. I've hacked a patch for my own use, so if you want to use it as a basis for a real implementation, I'll include it here.

 Aside from that, congratulations on making a very nice terminal emulator.

 

 --- sakura-0.4.4~pre3.c 2008-08-13 07:32:53.000000000 -0700
+++ sakura.c    2008-08-13 07:48:39.000000000 -0700
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <vte/vte.h>
 
+char program_name[64];
+
 #define AUTO            VTE_ERASE_AUTO
 #define BACKSPACE       VTE_ERASE_ASCII_BACKSPACE
 #define DELETE          VTE_ERASE_ASCII_DELETE
@@ -2824,10 +2826,10 @@
 #if TAB_SHOW_INFO_AT_TITLE
   int index = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
   if (index == 1)
-    gtk_window_set_title(GTK_WINDOW(main_window), PROGRAM_NAME);
+    gtk_window_set_title(GTK_WINDOW(main_window), program_name);
   else {
     char tabtitle[64];
-    sprintf(tabtitle, "%s - tab %d of %d", PROGRAM_NAME, gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) + 1, index);
+    sprintf(tabtitle, "%s - tab %d of %d", program_name, gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) + 1, index);
     gtk_window_set_title(GTK_WINDOW(main_window), tabtitle);
   }
 #endif
@@ -2835,6 +2837,14 @@
 
 int main(int argc, char **argv)
 {
+  strncpy(program_name, PROGRAM_NAME, 64);
+  program_name[63] = '\x00';
+
+  if (argc > 2 && !strcmp(argv[1], "-title")) {
+    strncpy(program_name, argv[2], 64);
+    program_name[63] = '\x00';
+  }
+
 #if COMMAND_EXEC_PROGRAM
   sprintf(default_command, "%s", DEFAULT_COMMAND);
   if (argc > 2) {
@@ -2917,7 +2927,7 @@
 #endif
 
 #if SHOW_WINDOW_TITLE
-  gtk_window_set_title(GTK_WINDOW(main_window), PROGRAM_NAME);
+  gtk_window_set_title(GTK_WINDOW(main_window), program_name);
 #endif
 
 #if SHOW_WINDOW_ICON
l

enComputerevilvte
adm Find login register
views:2708