[Xfce4-commits] <terminal:master> Add support for the session id in the terminal title.
Nick Schermer
noreply at xfce.org
Sat Oct 10 15:48:01 CEST 2009
Updating branch refs/heads/master
to c8a44ef4fed233e62953c11137988027717cc475 (commit)
from 022b3d50d2cf772d875015f7c3b097789d2e4416 (commit)
commit c8a44ef4fed233e62953c11137988027717cc475
Author: Nick Schermer <nick at xfce.org>
Date: Sat Oct 10 13:34:05 2009 +0200
Add support for the session id in the terminal title.
doc/C/Terminal.xml.in | 3 +++
terminal/terminal-screen.c | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/doc/C/Terminal.xml.in b/doc/C/Terminal.xml.in
index a6f7649..dbd31f4 100644
--- a/doc/C/Terminal.xml.in
+++ b/doc/C/Terminal.xml.in
@@ -579,6 +579,9 @@
<listitem>
<para>%w : window title set by shell.</para>
</listitem>
+ <listitem>
+ <para>%# : the session id.</para>
+ </listitem>
</orderedlist>
</sect2>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 30c7961..4e67ad6 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -134,13 +134,15 @@ struct _TerminalScreen
GtkWidget *scrollbar;
GtkWidget *tab_label;
+ guint session_id;
+
GPid pid;
gchar *working_directory;
gchar **custom_command;
gchar *custom_title;
- gboolean hold;
+ guint hold : 1;
guint background_timer_id;
guint launch_idle_id;
@@ -152,6 +154,7 @@ struct _TerminalScreen
static guint screen_signals[LAST_SIGNAL];
+static guint screen_last_session_id = 0;
@@ -225,6 +228,7 @@ static void
terminal_screen_init (TerminalScreen *screen)
{
screen->working_directory = g_get_current_dir ();
+ screen->session_id = ++screen_last_session_id;
screen->terminal = g_object_new (TERMINAL_TYPE_WIDGET, NULL);
g_object_connect (G_OBJECT (screen->terminal),
@@ -549,6 +553,10 @@ terminal_screen_parse_title (TerminalScreen *screen,
/* handle the "%" character */
switch (*remainder)
{
+ case '#':
+ g_string_append_printf (string, "%u", screen->session_id);
+ break;
+
case 'd':
case 'D':
if (directory == NULL)
More information about the Xfce4-commits
mailing list