Debarshi Ray 6231503
From 0728f06f528c1ba77a8671c529e44fbabd9c8980 Mon Sep 17 00:00:00 2001
Debarshi Ray 7308132
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 7308132
Date: Wed, 7 Jan 2015 16:01:00 +0100
Debarshi Ray b6699a2
Subject: [PATCH 01/10] Add sequences and signals for desktop notification
Debarshi Ray 7308132
Debarshi Ray 7308132
Add sequences
Debarshi Ray 7308132
  OSC 777 ; notify ; SUMMARY ; BODY BEL
Debarshi Ray 7308132
  OSC 777 ; notify ; SUMMARY BEL
Debarshi Ray 7308132
  OSC 777 ; notify ; SUMMARY ; BODY ST
Debarshi Ray 7308132
  OSC 777 ; notify ; SUMMARY ST
Debarshi Ray 7308132
Debarshi Ray 7308132
that let terminal applications send a notification to the desktop
Debarshi Ray 7308132
environment.
Debarshi Ray 7308132
Debarshi Ray 7308132
Based on Enlightenment's Terminology:
Debarshi Ray 7308132
https://phab.enlightenment.org/T1765
Debarshi Ray 7308132
Debarshi Ray 7308132
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 7308132
---
Debarshi Ray 3069778
 src/marshal.list      |  1 +
Debarshi Ray 12738e9
 src/vte.cc            |  9 +++++++++
Debarshi Ray 12738e9
 src/vte/vteterminal.h |  4 +++-
Debarshi Ray 12738e9
 src/vtegtk.cc         | 21 +++++++++++++++++++++
Debarshi Ray 2952472
 src/vtegtk.hh         |  1 +
Debarshi Ray 12738e9
 src/vteinternal.hh    |  8 ++++++++
Debarshi Ray 3a1a7ca
 src/vteseq.cc         | 32 +++++++++++++++++++++++++++++++-
Debarshi Ray 3a1a7ca
 7 files changed, 74 insertions(+), 2 deletions(-)
Debarshi Ray 7308132
Debarshi Ray 7308132
diff --git a/src/marshal.list b/src/marshal.list
acdaf4f
index 241128c3ccfe..4412cf3d5f5c 100644
Debarshi Ray 7308132
--- a/src/marshal.list
Debarshi Ray 7308132
+++ b/src/marshal.list
acdaf4f
@@ -1,3 +1,4 @@
9cb9eda
 VOID:STRING,BOXED
Debarshi Ray 7308132
+VOID:STRING,STRING
Debarshi Ray 7308132
 VOID:STRING,UINT
Debarshi Ray 7308132
 VOID:UINT,UINT
Debarshi Ray 3069778
diff --git a/src/vte.cc b/src/vte.cc
Debarshi Ray 6231503
index c33b27c45023..01c7dd7eebc4 100644
Debarshi Ray 3069778
--- a/src/vte.cc
Debarshi Ray 3069778
+++ b/src/vte.cc
Debarshi Ray 7bf3512
@@ -10135,6 +10135,15 @@ Terminal::emit_pending_signals()
Debarshi Ray 7308132
 
Debarshi Ray 2952472
 	emit_adjustment_changed();
Debarshi Ray 7308132
 
Debarshi Ray 355cf28
+        if (m_notification_received) {
Debarshi Ray 2952472
+                _vte_debug_print (VTE_DEBUG_SIGNALS,
Debarshi Ray 2952472
+                                  "Emitting `notification-received'.\n");
Debarshi Ray b6699a2
+                g_signal_emit(freezer.get(), signals[SIGNAL_NOTIFICATION_RECEIVED], 0,
Debarshi Ray 12738e9
+                              m_notification_summary.c_str(),
Debarshi Ray 12738e9
+                              m_notification_body.c_str());
Debarshi Ray 355cf28
+                m_notification_received = false;
Debarshi Ray 355cf28
+        }
Debarshi Ray 7308132
+
Debarshi Ray 2952472
 	if (m_window_title_changed) {
Debarshi Ray 12738e9
                 if (m_window_title != m_window_title_pending) {
Debarshi Ray 12738e9
                         m_window_title.swap(m_window_title_pending);
Debarshi Ray 3069778
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
Debarshi Ray b6699a2
index d5e96535a867..71c4c66cc4ee 100644
Debarshi Ray 3069778
--- a/src/vte/vteterminal.h
Debarshi Ray 3069778
+++ b/src/vte/vteterminal.h
Debarshi Ray 1c815c0
@@ -104,8 +104,10 @@ struct _VteTerminalClass {
Debarshi Ray 1c815c0
 
Debarshi Ray 3069778
 	void (*bell)(VteTerminal* terminal);
Debarshi Ray 3069778
 
Debarshi Ray 1c815c0
+	void (*notification_received)(VteTerminal* terminal, const gchar *summary, const gchar *body);
Debarshi Ray 1c815c0
+
Debarshi Ray 3069778
         /* Padding for future expansion. */
Debarshi Ray 3069778
-        gpointer padding[16];
Debarshi Ray 3069778
+        gpointer padding[15];
Debarshi Ray 3069778
 
Debarshi Ray 3069778
         VteTerminalClassPrivate *priv;
Debarshi Ray 3069778
 };
Debarshi Ray 2952472
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
Debarshi Ray 6231503
index f7a65f72b68e..30e0af0f8015 100644
Debarshi Ray 2952472
--- a/src/vtegtk.cc
Debarshi Ray 2952472
+++ b/src/vtegtk.cc
Debarshi Ray 6231503
@@ -934,6 +934,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 2952472
 	klass->child_exited = NULL;
Debarshi Ray 2952472
 	klass->encoding_changed = NULL;
Debarshi Ray 2952472
 	klass->char_size_changed = NULL;
Debarshi Ray 2952472
+	klass->notification_received = NULL;
Debarshi Ray 2952472
 	klass->window_title_changed = NULL;
Debarshi Ray 2952472
 	klass->icon_title_changed = NULL;
Debarshi Ray 2952472
 	klass->selection_changed = NULL;
Debarshi Ray 6231503
@@ -1015,6 +1016,26 @@ vte_terminal_class_init(VteTerminalClass *klass)
acdaf4f
                                    G_OBJECT_CLASS_TYPE(klass),
acdaf4f
                                    g_cclosure_marshal_VOID__INTv);
Debarshi Ray 2952472
 
Debarshi Ray 7dce419
+        /**
Debarshi Ray 2952472
+         * VteTerminal::notification-received:
Debarshi Ray 2952472
+         * @vteterminal: the object which received the signal
Debarshi Ray 2952472
+         * @summary: The summary
Debarshi Ray 2952472
+         * @body: (allow-none): Extra optional text
Debarshi Ray 2952472
+         *
Debarshi Ray 2952472
+         * Emitted when a process running in the terminal wants to
Debarshi Ray 2952472
+         * send a notification to the desktop environment.
Debarshi Ray 2952472
+         */
Debarshi Ray 2952472
+        signals[SIGNAL_NOTIFICATION_RECEIVED] =
Debarshi Ray 2952472
+                g_signal_new(I_("notification-received"),
Debarshi Ray 2952472
+                             G_OBJECT_CLASS_TYPE(klass),
Debarshi Ray 2952472
+                             G_SIGNAL_RUN_LAST,
Debarshi Ray 2952472
+                             G_STRUCT_OFFSET(VteTerminalClass, notification_received),
Debarshi Ray 2952472
+                             NULL,
Debarshi Ray 2952472
+                             NULL,
Debarshi Ray 2952472
+                             _vte_marshal_VOID__STRING_STRING,
Debarshi Ray 2952472
+                             G_TYPE_NONE,
Debarshi Ray 2952472
+                             2, G_TYPE_STRING, G_TYPE_STRING);
Debarshi Ray 2952472
+
Debarshi Ray 7dce419
         /**
Debarshi Ray 2952472
          * VteTerminal::window-title-changed:
Debarshi Ray 2952472
          * @vteterminal: the object which received the signal
Debarshi Ray 2952472
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
Debarshi Ray b6699a2
index cb207e57f928..b44dfd13a054 100644
Debarshi Ray 2952472
--- a/src/vtegtk.hh
Debarshi Ray 2952472
+++ b/src/vtegtk.hh
9cb9eda
@@ -56,6 +56,7 @@ enum {
Debarshi Ray 2952472
         SIGNAL_TEXT_INSERTED,
Debarshi Ray 2952472
         SIGNAL_TEXT_MODIFIED,
Debarshi Ray 2952472
         SIGNAL_TEXT_SCROLLED,
Debarshi Ray 2952472
+        SIGNAL_NOTIFICATION_RECEIVED,
Debarshi Ray 2952472
         SIGNAL_WINDOW_TITLE_CHANGED,
8f57b4a
         LAST_SIGNAL
8f57b4a
 };
Debarshi Ray 3069778
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
Debarshi Ray 6231503
index 333f858c164e..7608eecc38d9 100644
Debarshi Ray 3069778
--- a/src/vteinternal.hh
Debarshi Ray 3069778
+++ b/src/vteinternal.hh
Debarshi Ray 7bf3512
@@ -917,6 +917,11 @@ public:
Debarshi Ray a9aabb4
         gboolean m_cursor_moved_pending;
Debarshi Ray a9aabb4
         gboolean m_contents_changed_pending;
Debarshi Ray 3069778
 
Debarshi Ray 12738e9
+        /* desktop notification */
Debarshi Ray 355cf28
+        bool m_notification_received{false};
Debarshi Ray 12738e9
+        std::string m_notification_summary;
Debarshi Ray 12738e9
+        std::string m_notification_body;
Debarshi Ray 12738e9
+
Debarshi Ray 12738e9
         std::string m_window_title{};
Debarshi Ray 12738e9
         std::string m_current_directory_uri{};
Debarshi Ray 12738e9
         std::string m_current_file_uri{};
Debarshi Ray 6231503
@@ -1634,6 +1639,9 @@ public:
Debarshi Ray 12738e9
                              int osc) noexcept;
Debarshi Ray 12738e9
 
Debarshi Ray 12738e9
         /* OSC handlers */
Debarshi Ray 12738e9
+        void handle_urxvt_extension(vte::parser::Sequence const& seq,
Debarshi Ray 12738e9
+                                    vte::parser::StringTokeniser::const_iterator& token,
Debarshi Ray 12738e9
+                                    vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept;
Debarshi Ray 12738e9
         void set_color(vte::parser::Sequence const& seq,
Debarshi Ray 12738e9
                        vte::parser::StringTokeniser::const_iterator& token,
Debarshi Ray 12738e9
                        vte::parser::StringTokeniser::const_iterator const& endtoken,
Debarshi Ray 3069778
diff --git a/src/vteseq.cc b/src/vteseq.cc
Debarshi Ray 7bf3512
index ba9a2df6b9c4..c765b0bfb1f4 100644
Debarshi Ray 3069778
--- a/src/vteseq.cc
Debarshi Ray 3069778
+++ b/src/vteseq.cc
Debarshi Ray 7bf3512
@@ -1377,6 +1377,33 @@ Terminal::delete_lines(vte::grid::row_t param)
Debarshi Ray 12738e9
         m_text_deleted_flag = TRUE;
Debarshi Ray 7308132
 }
Debarshi Ray 7308132
 
Debarshi Ray 959a864
+void
Debarshi Ray 270dd15
+Terminal::handle_urxvt_extension(vte::parser::Sequence const& seq,
Debarshi Ray 270dd15
+                                 vte::parser::StringTokeniser::const_iterator& token,
Debarshi Ray 270dd15
+                                 vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept
Debarshi Ray 7308132
+{
Debarshi Ray 3a1a7ca
+        if (token == endtoken)
Debarshi Ray 12738e9
+                return;
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
+        if (*token == "notify") {
Debarshi Ray 12738e9
+                ++token;
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
+                if (token == endtoken)
Debarshi Ray 12738e9
+                        return;
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
+                m_notification_summary = *token;
Debarshi Ray 12738e9
+                m_notification_body.clear();
Debarshi Ray 355cf28
+                m_notification_received = true;
Debarshi Ray 12738e9
+                ++token;
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
+                if (token == endtoken)
Debarshi Ray 12738e9
+                        return;
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
+                m_notification_body = *token;
Debarshi Ray 12738e9
+                return;
Debarshi Ray 12738e9
+        }
Debarshi Ray 7308132
+}
Debarshi Ray 7308132
+
Debarshi Ray 12738e9
 bool
Debarshi Ray 270dd15
 Terminal::get_osc_color_index(int osc,
Debarshi Ray 12738e9
                                         int value,
Debarshi Ray 7bf3512
@@ -6475,6 +6502,10 @@ Terminal::OSC(vte::parser::Sequence const& seq)
Debarshi Ray 12738e9
                 reset_color(VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE);
Debarshi Ray 12738e9
                 break;
Debarshi Ray 12738e9
 
Debarshi Ray 12738e9
+        case VTE_OSC_URXVT_EXTENSION:
Debarshi Ray 12738e9
+                handle_urxvt_extension(seq, it, cend);
Debarshi Ray 12738e9
+                break;
Debarshi Ray 12738e9
+
Debarshi Ray 12738e9
         case VTE_OSC_XTERM_SET_ICON_TITLE:
Debarshi Ray 12738e9
         case VTE_OSC_XTERM_SET_XPROPERTY:
Debarshi Ray 12738e9
         case VTE_OSC_XTERM_SET_COLOR_MOUSE_CURSOR_FG:
Debarshi Ray 7bf3512
@@ -6515,7 +6546,6 @@ Terminal::OSC(vte::parser::Sequence const& seq)
Debarshi Ray 12738e9
         case VTE_OSC_URXVT_SET_FONT_BOLD_ITALIC:
Debarshi Ray 12738e9
         case VTE_OSC_URXVT_VIEW_UP:
Debarshi Ray 12738e9
         case VTE_OSC_URXVT_VIEW_DOWN:
Debarshi Ray 12738e9
-        case VTE_OSC_URXVT_EXTENSION:
Debarshi Ray 12738e9
         case VTE_OSC_YF_RQGWR:
Debarshi Ray 12738e9
         default:
Debarshi Ray 12738e9
                 break;
Debarshi Ray 7308132
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 7308132
Debarshi Ray 7308132
Debarshi Ray 6231503
From 4c3bce7d70e208bee0f36d64a540ade9975c3ce7 Mon Sep 17 00:00:00 2001
Debarshi Ray 7308132
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 7308132
Date: Thu, 29 Jan 2015 13:09:17 +0100
Debarshi Ray b6699a2
Subject: [PATCH 02/10] vte.sh: Emit OSC 777 from PROMPT_COMMAND
Debarshi Ray 7308132
Debarshi Ray 94ec580
For some reason, the three consecutive backslashes break the parsing.
Debarshi Ray 94ec580
As Christian Persch suggested, replacing the double quotes with
Debarshi Ray 94ec580
singles fixes it.
Debarshi Ray 94ec580
Debarshi Ray 7308132
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 7308132
---
Debarshi Ray 22ab67e
 src/vte.sh.in | 4 +++-
Debarshi Ray 7308132
 1 file changed, 3 insertions(+), 1 deletion(-)
Debarshi Ray 7308132
Debarshi Ray 22ab67e
diff --git a/src/vte.sh.in b/src/vte.sh.in
Debarshi Ray 6231503
index a12e254b6cba..f7c4fdeff30b 100644
Debarshi Ray 22ab67e
--- a/src/vte.sh.in
Debarshi Ray 22ab67e
+++ b/src/vte.sh.in
Debarshi Ray 22ab67e
@@ -27,10 +27,12 @@ __vte_osc7 () {
Debarshi Ray 7308132
 }
Debarshi Ray 7308132
 
Debarshi Ray 7308132
 __vte_prompt_command() {
Debarshi Ray 7308132
+  local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//')
Debarshi Ray 7308132
+  command="${command//;/ }"
Debarshi Ray 7308132
   local pwd='~'
Debarshi Ray 7308132
   [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
acdaf4f
   pwd="${pwd//[[:cntrl:]]}"
Debarshi Ray 22ab67e
-  printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${pwd}"
Debarshi Ray 22ab67e
+  printf '\033]777;notify;Command completed;%s\033\\\033]0;%s@%s:%s\033\\' "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}"
Debarshi Ray 22ab67e
   __vte_osc7
Debarshi Ray 7308132
 }
Debarshi Ray 7308132
 
Debarshi Ray 7308132
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 7308132
Debarshi Ray 7308132
Debarshi Ray 6231503
From 5171a84e95ad20048dcb1683c149711430002149 Mon Sep 17 00:00:00 2001
Debarshi Ray 7308132
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 7308132
Date: Thu, 22 Jan 2015 16:37:10 +0100
Debarshi Ray b6699a2
Subject: [PATCH 03/10] Test the notification-received signal
Debarshi Ray 7308132
Debarshi Ray 7308132
---
Debarshi Ray acefea5
 bindings/vala/app.vala |  7 +++++++
Debarshi Ray 959a864
 src/app/app.cc         | 10 ++++++++++
Debarshi Ray acefea5
 2 files changed, 17 insertions(+)
Debarshi Ray 7308132
Debarshi Ray d2ede39
diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala
Debarshi Ray 355cf28
index fc26c2b0dfc3..634b8ddeeb91 100644
Debarshi Ray d2ede39
--- a/bindings/vala/app.vala
Debarshi Ray d2ede39
+++ b/bindings/vala/app.vala
Debarshi Ray 1c815c0
@@ -309,6 +309,8 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 355cf28
     if (Options.object_notifications)
Debarshi Ray 7308132
       terminal.notify.connect(notify_cb);
Debarshi Ray 7308132
 
Debarshi Ray 7308132
+    terminal.notification_received.connect(notification_received_cb);
Debarshi Ray 7308132
+
Debarshi Ray 7308132
     /* Settings */
Debarshi Ray 355cf28
     if (Options.no_double_buffer)
Debarshi Ray 8639850
       terminal.set_double_buffered(false);
9cb9eda
@@ -780,6 +782,11 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 7308132
     set_title(terminal.get_window_title());
Debarshi Ray 7308132
   }
Debarshi Ray 7308132
 
Debarshi Ray 7308132
+  private void notification_received_cb(Vte.Terminal terminal, string summary, string? body)
Debarshi Ray 7308132
+  {
Debarshi Ray 7308132
+    print ("[%s]: %s\n", summary, body);
Debarshi Ray 7308132
+  }
Debarshi Ray 7308132
+
Debarshi Ray 7308132
 } /* class Window */
Debarshi Ray 7308132
 
Debarshi Ray 7308132
 class App : Gtk.Application
Debarshi Ray 959a864
diff --git a/src/app/app.cc b/src/app/app.cc
Debarshi Ray 7bf3512
index d8bfe9e13826..e95f58cd3bac 100644
Debarshi Ray 959a864
--- a/src/app/app.cc
Debarshi Ray 959a864
+++ b/src/app/app.cc
Debarshi Ray 7bf3512
@@ -1851,6 +1851,14 @@ window_window_title_changed_cb(VteTerminal* terminal,
Debarshi Ray 959a864
                              vte_terminal_get_window_title(window->terminal));
Debarshi Ray 959a864
 }
Debarshi Ray acefea5
 
Debarshi Ray 7dce419
+static void
Debarshi Ray 959a864
+notification_received_cb(VteTerminal *terminal,
Debarshi Ray 959a864
+                         const gchar *summary,
Debarshi Ray 959a864
+                         const gchar *body)
Debarshi Ray acefea5
+{
Debarshi Ray 959a864
+        g_print("[%s]: %s\n", summary, body);
Debarshi Ray acefea5
+}
Debarshi Ray acefea5
+
Debarshi Ray 7dce419
 static void
Debarshi Ray 959a864
 window_lower_window_cb(VteTerminal* terminal,
Debarshi Ray 959a864
                        VteappWindow* window)
Debarshi Ray 7bf3512
@@ -2086,6 +2094,8 @@ vteapp_window_constructed(GObject *object)
Debarshi Ray 959a864
         if (options.object_notifications)
Debarshi Ray 959a864
                 g_signal_connect(window->terminal, "notify", G_CALLBACK(window_notify_cb), window);
Debarshi Ray acefea5
 
Debarshi Ray 959a864
+        g_signal_connect(window->terminal, "notification-received", G_CALLBACK(notification_received_cb), NULL);
Debarshi Ray acefea5
+
Debarshi Ray 959a864
         /* Settings */
Debarshi Ray 511ade8
         if (options.no_double_buffer) {
Debarshi Ray 511ade8
                 G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
Debarshi Ray 7308132
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 525ec1b
Debarshi Ray 525ec1b
Debarshi Ray 6231503
From ed262358646832779ee0eb5afa0a8a7a6c1c2adf Mon Sep 17 00:00:00 2001
Debarshi Ray 955c24e
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray f1ae7f9
Date: Fri, 13 May 2016 17:53:54 +0200
Debarshi Ray b6699a2
Subject: [PATCH 04/10] Add a property to configure the scroll speed
Debarshi Ray 955c24e
Debarshi Ray f1ae7f9
By default, it is set to zero which gives the current behaviour of
Debarshi Ray f1ae7f9
moving the buffer by a function of the number of visible rows.
Debarshi Ray f1ae7f9
Debarshi Ray f1ae7f9
https://bugzilla.redhat.com/show_bug.cgi?id=1103380
Debarshi Ray 955c24e
---
Debarshi Ray f1ae7f9
 doc/reference/vte-sections.txt |  1 +
Debarshi Ray 53d075d
 src/vte.cc                     | 19 +++++++++++++-
Debarshi Ray 53d075d
 src/vte/vteterminal.h          |  4 +++
Debarshi Ray 53d075d
 src/vtegtk.cc                  | 45 ++++++++++++++++++++++++++++++++++
Debarshi Ray f1ae7f9
 src/vtegtk.hh                  |  1 +
Debarshi Ray f1ae7f9
 src/vteinternal.hh             |  2 ++
Debarshi Ray f1ae7f9
 6 files changed, 71 insertions(+), 1 deletion(-)
Debarshi Ray 955c24e
Debarshi Ray f1ae7f9
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
Debarshi Ray 7bf3512
index c222e7fdff0b..6da5eff30715 100644
Debarshi Ray f1ae7f9
--- a/doc/reference/vte-sections.txt
Debarshi Ray f1ae7f9
+++ b/doc/reference/vte-sections.txt
Debarshi Ray 22ab67e
@@ -52,6 +52,7 @@ vte_terminal_get_cursor_blink_mode
Debarshi Ray f1ae7f9
 vte_terminal_set_cursor_blink_mode
Debarshi Ray 959a864
 vte_terminal_get_text_blink_mode
Debarshi Ray 959a864
 vte_terminal_set_text_blink_mode
Debarshi Ray f1ae7f9
+vte_terminal_set_scroll_speed
Debarshi Ray f1ae7f9
 vte_terminal_set_scrollback_lines
Debarshi Ray 959a864
 vte_terminal_get_scrollback_lines
Debarshi Ray f1ae7f9
 vte_terminal_set_font
Debarshi Ray f1ae7f9
diff --git a/src/vte.cc b/src/vte.cc
Debarshi Ray 6231503
index 01c7dd7eebc4..af73288b9f20 100644
Debarshi Ray f1ae7f9
--- a/src/vte.cc
Debarshi Ray f1ae7f9
+++ b/src/vte.cc
Debarshi Ray 7bf3512
@@ -9334,6 +9334,7 @@ vte_cairo_get_clip_region (cairo_t *cr)
Debarshi Ray b6699a2
 bool
Debarshi Ray b6699a2
 Terminal::widget_mouse_scroll(MouseEvent const& event)
Debarshi Ray f1ae7f9
 {
Debarshi Ray f1ae7f9
+	gdouble scroll_speed;
Debarshi Ray f1ae7f9
 	gdouble v;
Debarshi Ray f1ae7f9
 	gint cnt, i;
Debarshi Ray f1ae7f9
 	int button;
Debarshi Ray 7bf3512
@@ -9390,7 +9391,13 @@ Terminal::widget_mouse_scroll(MouseEvent const& event)
Debarshi Ray b6699a2
 		return true;
Debarshi Ray f1ae7f9
 	}
Debarshi Ray f1ae7f9
 
Debarshi Ray 22ab67e
-        v = MAX (1., ceil (gtk_adjustment_get_page_increment (m_vadjustment.get()) / 10.));
Debarshi Ray f1ae7f9
+	if (m_scroll_speed == 0) {
Debarshi Ray 22ab67e
+		scroll_speed = ceil (gtk_adjustment_get_page_increment (m_vadjustment.get()) / 10.);
Debarshi Ray f1ae7f9
+	} else {
Debarshi Ray f1ae7f9
+		scroll_speed = m_scroll_speed;
Debarshi Ray f1ae7f9
+	}
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
+	v = MAX (1., scroll_speed);
Debarshi Ray f1ae7f9
 	_vte_debug_print(VTE_DEBUG_EVENTS,
Debarshi Ray f1ae7f9
 			"Scroll speed is %d lines per non-smooth scroll unit\n",
Debarshi Ray f1ae7f9
 			(int) v);
Debarshi Ray 7bf3512
@@ -9693,6 +9700,16 @@ Terminal::decscusr_cursor_shape() const noexcept
Debarshi Ray 7dce419
         }
Debarshi Ray f1ae7f9
 }
Debarshi Ray f1ae7f9
 
Debarshi Ray 7dce419
+bool
Debarshi Ray 270dd15
+Terminal::set_scroll_speed(unsigned int scroll_speed)
Debarshi Ray f1ae7f9
+{
Debarshi Ray f1ae7f9
+        if (scroll_speed == m_scroll_speed)
Debarshi Ray f1ae7f9
+                return false;
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
+        m_scroll_speed = scroll_speed;
Debarshi Ray f1ae7f9
+        return true;
Debarshi Ray f1ae7f9
+}
Debarshi Ray f1ae7f9
+
Debarshi Ray 7dce419
 bool
Debarshi Ray 270dd15
 Terminal::set_scrollback_lines(long lines)
Debarshi Ray f1ae7f9
 {
Debarshi Ray 955c24e
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
Debarshi Ray b6699a2
index 71c4c66cc4ee..203c77e08c57 100644
Debarshi Ray 955c24e
--- a/src/vte/vteterminal.h
Debarshi Ray 955c24e
+++ b/src/vte/vteterminal.h
Debarshi Ray b6699a2
@@ -306,6 +306,10 @@ void vte_terminal_set_cursor_shape(VteTerminal *terminal,
Debarshi Ray f1ae7f9
 _VTE_PUBLIC
Debarshi Ray b6699a2
 VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 955c24e
 
Debarshi Ray f1ae7f9
+_VTE_PUBLIC
Debarshi Ray f1ae7f9
+void vte_terminal_set_scroll_speed(VteTerminal *terminal,
Debarshi Ray f1ae7f9
+                                   guint scroll_speed) _VTE_GNUC_NONNULL(1);
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
 /* Set the number of scrollback lines, above or at an internal minimum. */
Debarshi Ray f1ae7f9
 _VTE_PUBLIC
Debarshi Ray f1ae7f9
 void vte_terminal_set_scrollback_lines(VteTerminal *terminal,
Debarshi Ray f1ae7f9
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
Debarshi Ray 6231503
index 30e0af0f8015..bf88b9481981 100644
Debarshi Ray f1ae7f9
--- a/src/vtegtk.cc
Debarshi Ray f1ae7f9
+++ b/src/vtegtk.cc
Debarshi Ray 6231503
@@ -712,6 +712,9 @@ try
Debarshi Ray f1ae7f9
                 case PROP_REWRAP_ON_RESIZE:
Debarshi Ray f1ae7f9
                         g_value_set_boolean (value, vte_terminal_get_rewrap_on_resize (terminal));
Debarshi Ray f1ae7f9
                         break;
Debarshi Ray f1ae7f9
+                case PROP_SCROLL_SPEED:
Debarshi Ray f1ae7f9
+                        g_value_set_uint (value, impl->m_scroll_speed);
Debarshi Ray f1ae7f9
+                        break;
Debarshi Ray f1ae7f9
                 case PROP_SCROLLBACK_LINES:
Debarshi Ray 959a864
                         g_value_set_uint (value, vte_terminal_get_scrollback_lines(terminal));
Debarshi Ray f1ae7f9
                         break;
Debarshi Ray 6231503
@@ -827,6 +830,9 @@ try
Debarshi Ray f1ae7f9
                 case PROP_REWRAP_ON_RESIZE:
Debarshi Ray f1ae7f9
                         vte_terminal_set_rewrap_on_resize (terminal, g_value_get_boolean (value));
Debarshi Ray f1ae7f9
                         break;
Debarshi Ray f1ae7f9
+                case PROP_SCROLL_SPEED:
Debarshi Ray f1ae7f9
+                        vte_terminal_set_scroll_speed (terminal, g_value_get_uint (value));
Debarshi Ray f1ae7f9
+                        break;
Debarshi Ray f1ae7f9
                 case PROP_SCROLLBACK_LINES:
Debarshi Ray f1ae7f9
                         vte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value));
Debarshi Ray f1ae7f9
                         break;
Debarshi Ray 6231503
@@ -1917,6 +1923,21 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 7dce419
                                       TRUE,
Debarshi Ray f1ae7f9
                                       (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
Debarshi Ray 955c24e
 
Debarshi Ray 7dce419
+        /**
Debarshi Ray f1ae7f9
+         * VteTerminal:scroll-speed:
Debarshi Ray f1ae7f9
+         *
Debarshi Ray f1ae7f9
+         * The number of lines by which the buffer is moved when
Debarshi Ray f1ae7f9
+         * scrolling with a mouse wheel on top of the terminal
Debarshi Ray f1ae7f9
+         * Setting it to zero will cause the buffer to be moved by an
Debarshi Ray f1ae7f9
+         * amount depending on the number of visible rows the widget
Debarshi Ray f1ae7f9
+         * can display.
Debarshi Ray f1ae7f9
+         */
Debarshi Ray f1ae7f9
+        pspecs[PROP_SCROLL_SPEED] =
Debarshi Ray f1ae7f9
+                g_param_spec_uint ("scroll-speed", NULL, NULL,
Debarshi Ray f1ae7f9
+                                   0, G_MAXUINT,
Debarshi Ray f1ae7f9
+                                   0,
Debarshi Ray f1ae7f9
+                                   (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
Debarshi Ray 955c24e
+
Debarshi Ray 7dce419
         /**
Debarshi Ray f1ae7f9
          * VteTerminal:scrollback-lines:
Debarshi Ray f1ae7f9
          *
Debarshi Ray 6231503
@@ -5324,6 +5345,30 @@ catch (...)
Debarshi Ray b6699a2
         return -1;
Debarshi Ray f1ae7f9
 }
Debarshi Ray f1ae7f9
 
Debarshi Ray 7dce419
+/**
Debarshi Ray f1ae7f9
+ * vte_terminal_set_scroll_speed:
Debarshi Ray f1ae7f9
+ * @terminal: a #VteTerminal
Debarshi Ray f1ae7f9
+ * @scroll_speed: move the buffer by this number of lines while scrolling
Debarshi Ray f1ae7f9
+ *
Debarshi Ray f1ae7f9
+ * Sets the number of lines by which the buffer is moved when
Debarshi Ray f1ae7f9
+ * scrolling with a mouse wheel. Setting it to zero will cause the
Debarshi Ray f1ae7f9
+ * buffer to be moved by an amount depending on the number of visible
Debarshi Ray f1ae7f9
+ * rows the widget can display.
Debarshi Ray f1ae7f9
+ */
Debarshi Ray f1ae7f9
+void
Debarshi Ray f1ae7f9
+vte_terminal_set_scroll_speed(VteTerminal *terminal, guint scroll_speed)
Debarshi Ray f1ae7f9
+{
Debarshi Ray f1ae7f9
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
+        GObject *object = G_OBJECT(terminal);
Debarshi Ray f1ae7f9
+        g_object_freeze_notify(object);
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
+        if (IMPL(terminal)->set_scroll_speed(scroll_speed))
Debarshi Ray f1ae7f9
+                g_object_notify_by_pspec(object, pspecs[PROP_SCROLL_SPEED]);
Debarshi Ray f1ae7f9
+
Debarshi Ray f1ae7f9
+        g_object_thaw_notify(object);
Debarshi Ray f1ae7f9
+}
Debarshi Ray f1ae7f9
+
Debarshi Ray 7dce419
 /**
Debarshi Ray f1ae7f9
  * vte_terminal_set_scrollback_lines:
Debarshi Ray f1ae7f9
  * @terminal: a #VteTerminal
Debarshi Ray f1ae7f9
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
Debarshi Ray b6699a2
index b44dfd13a054..30b917786b5b 100644
Debarshi Ray f1ae7f9
--- a/src/vtegtk.hh
Debarshi Ray f1ae7f9
+++ b/src/vtegtk.hh
Debarshi Ray b6699a2
@@ -89,6 +89,7 @@ enum {
Debarshi Ray f1ae7f9
         PROP_MOUSE_POINTER_AUTOHIDE,
Debarshi Ray f1ae7f9
         PROP_PTY,
Debarshi Ray f1ae7f9
         PROP_REWRAP_ON_RESIZE,
Debarshi Ray f1ae7f9
+        PROP_SCROLL_SPEED,
Debarshi Ray f1ae7f9
         PROP_SCROLLBACK_LINES,
Debarshi Ray f1ae7f9
         PROP_SCROLL_ON_KEYSTROKE,
Debarshi Ray f1ae7f9
         PROP_SCROLL_ON_OUTPUT,
Debarshi Ray f1ae7f9
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
Debarshi Ray 6231503
index 7608eecc38d9..79ea9e7f0da0 100644
Debarshi Ray f1ae7f9
--- a/src/vteinternal.hh
Debarshi Ray f1ae7f9
+++ b/src/vteinternal.hh
Debarshi Ray 7bf3512
@@ -696,6 +696,7 @@ public:
Debarshi Ray 12738e9
 	/* Scrolling options. */
Debarshi Ray 22ab67e
         bool m_scroll_on_output{false};
Debarshi Ray 22ab67e
         bool m_scroll_on_keystroke{true};
Debarshi Ray f1ae7f9
+        guint m_scroll_speed;
Debarshi Ray 22ab67e
         vte::grid::row_t m_scrollback_lines{0};
Debarshi Ray f1ae7f9
 
Debarshi Ray f1ae7f9
         /* Restricted scrolling */
Debarshi Ray 6231503
@@ -1512,6 +1513,7 @@ public:
Debarshi Ray 22ab67e
         bool set_input_enabled(bool enabled);
Debarshi Ray 22ab67e
         bool set_mouse_autohide(bool autohide);
Debarshi Ray f1ae7f9
         bool set_rewrap_on_resize(bool rewrap);
Debarshi Ray f1ae7f9
+        bool set_scroll_speed(unsigned int scroll_speed);
Debarshi Ray f1ae7f9
         bool set_scrollback_lines(long lines);
Debarshi Ray f1ae7f9
         bool set_scroll_on_keystroke(bool scroll);
Debarshi Ray f1ae7f9
         bool set_scroll_on_output(bool scroll);
Debarshi Ray f1ae7f9
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray f1ae7f9
Debarshi Ray f1ae7f9
Debarshi Ray 6231503
From 73e7009c342747fbb3bdbef322811e09467dab9b Mon Sep 17 00:00:00 2001
Debarshi Ray f1ae7f9
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray f1ae7f9
Date: Fri, 13 May 2016 17:54:57 +0200
Debarshi Ray b6699a2
Subject: [PATCH 05/10] Test the scroll-speed property
Debarshi Ray f1ae7f9
Debarshi Ray f1ae7f9
https://bugzilla.redhat.com/show_bug.cgi?id=1103380
Debarshi Ray f1ae7f9
---
Debarshi Ray d2ede39
 bindings/vala/app.vala | 4 ++++
Debarshi Ray 959a864
 src/app/app.cc         | 4 ++++
Debarshi Ray 959a864
 2 files changed, 8 insertions(+)
Debarshi Ray f1ae7f9
Debarshi Ray d2ede39
diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala
Debarshi Ray 355cf28
index 634b8ddeeb91..c984b868246d 100644
Debarshi Ray d2ede39
--- a/bindings/vala/app.vala
Debarshi Ray d2ede39
+++ b/bindings/vala/app.vala
9cb9eda
@@ -335,6 +335,7 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 355cf28
     terminal.set_rewrap_on_resize(!Options.no_rewrap);
Debarshi Ray f1ae7f9
     terminal.set_scroll_on_output(false);
Debarshi Ray f1ae7f9
     terminal.set_scroll_on_keystroke(true);
Debarshi Ray 355cf28
+    terminal.set_scroll_speed(Options.scroll_speed);
Debarshi Ray 355cf28
     terminal.set_scrollback_lines(Options.scrollback_lines);
Debarshi Ray 955c24e
 
Debarshi Ray f1ae7f9
     /* Style */
Debarshi Ray 355cf28
@@ -857,6 +858,7 @@ class App : Gtk.Application
Debarshi Ray f1ae7f9
     public static bool object_notifications = false;
Debarshi Ray f1ae7f9
     public static string? output_filename = null;
Debarshi Ray f1ae7f9
     public static bool reverse = false;
Debarshi Ray f1ae7f9
+    public static uint scroll_speed = 0;
Debarshi Ray f1ae7f9
     public static int scrollback_lines = 512;
Debarshi Ray f1ae7f9
     public static int transparency_percent = 0;
Debarshi Ray f1ae7f9
     public static bool version = false;
Debarshi Ray 355cf28
@@ -1050,6 +1052,8 @@ class App : Gtk.Application
Debarshi Ray f1ae7f9
         "Save terminal contents to file at exit", null },
Debarshi Ray f1ae7f9
       { "reverse", 0, 0, OptionArg.NONE, ref reverse,
Debarshi Ray f1ae7f9
         "Reverse foreground/background colors", null },
Debarshi Ray 1c815c0
+      { "scroll-speed", 0, 0, OptionArg.INT, ref scroll_speed,
Debarshi Ray f1ae7f9
+        "Specify the scroll speed", null },
Debarshi Ray f1ae7f9
       { "scrollback-lines", 'n', 0, OptionArg.INT, ref scrollback_lines,
Debarshi Ray f1ae7f9
         "Specify the number of scrollback-lines", null },
Debarshi Ray f1ae7f9
       { "transparent", 'T', 0, OptionArg.INT, ref transparency_percent,
Debarshi Ray 959a864
diff --git a/src/app/app.cc b/src/app/app.cc
Debarshi Ray 7bf3512
index e95f58cd3bac..52893c87414a 100644
Debarshi Ray 959a864
--- a/src/app/app.cc
Debarshi Ray 959a864
+++ b/src/app/app.cc
Debarshi Ray 7bf3512
@@ -108,6 +108,7 @@ public:
Debarshi Ray 959a864
         int verbosity{0};
Debarshi Ray 959a864
         double cell_height_scale{1.0};
Debarshi Ray 959a864
         double cell_width_scale{1.0};
Debarshi Ray 959a864
+        unsigned int scroll_speed{0};
Debarshi Ray 959a864
         VteCursorBlinkMode cursor_blink_mode{VTE_CURSOR_BLINK_SYSTEM};
Debarshi Ray 959a864
         VteCursorShape cursor_shape{VTE_CURSOR_SHAPE_BLOCK};
Debarshi Ray 959a864
         VteTextBlinkMode text_blink_mode{VTE_TEXT_BLINK_ALWAYS};
Debarshi Ray 7bf3512
@@ -569,6 +570,8 @@ public:
Debarshi Ray 959a864
                           "Reverse foreground/background colors", nullptr },
Debarshi Ray 22ab67e
                         { "require-systemd-scope", 0, 0, G_OPTION_ARG_NONE, &require_systemd_scope,
Debarshi Ray 22ab67e
                           "Require use of a systemd user scope", nullptr },
Debarshi Ray 959a864
+                        { "scroll-speed", 0, 0, G_OPTION_ARG_INT, &scroll_speed,
Debarshi Ray 959a864
+                          "Specify the scroll speed", nullptr },
Debarshi Ray 959a864
                         { "scrollback-lines", 'n', 0, G_OPTION_ARG_INT, &scrollback_lines,
Debarshi Ray 959a864
                           "Specify the number of scrollback-lines (-1 for infinite)", nullptr },
Debarshi Ray 7bf3512
                         { "transparent", 'T', 0, G_OPTION_ARG_INT, &transparency_percent,
Debarshi Ray 7bf3512
@@ -2127,6 +2130,7 @@ vteapp_window_constructed(GObject *object)
Debarshi Ray 959a864
         vte_terminal_set_rewrap_on_resize(window->terminal, !options.no_rewrap);
Debarshi Ray 959a864
         vte_terminal_set_scroll_on_output(window->terminal, false);
Debarshi Ray 959a864
         vte_terminal_set_scroll_on_keystroke(window->terminal, true);
Debarshi Ray 959a864
+        vte_terminal_set_scroll_speed(window->terminal, options.scroll_speed);
Debarshi Ray 959a864
         vte_terminal_set_scrollback_lines(window->terminal, options.scrollback_lines);
Debarshi Ray 959a864
         vte_terminal_set_text_blink_mode(window->terminal, options.text_blink_mode);
Debarshi Ray acefea5
 
Debarshi Ray 955c24e
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Debarshi Ray 6231503
From 2fe27cbe7cbb120e9055284c9e7e34423e5add49 Mon Sep 17 00:00:00 2001
Debarshi Ray 53d075d
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 53d075d
Date: Wed, 7 Jan 2015 16:01:00 +0100
Debarshi Ray b6699a2
Subject: [PATCH 06/10] Support preexec notifications from an interactive shell
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Add sequences
Debarshi Ray 53d075d
  OSC 777 ; preexec BEL
Debarshi Ray 53d075d
  OSC 777 ; preexec ST
Debarshi Ray 53d075d
Debarshi Ray 53d075d
that can be used from an interactive shell's preexec hook to notify
Debarshi Ray 53d075d
the terminal emulator that a new command is about to be executed.
Debarshi Ray 53d075d
Examples of such hooks are Bash's PS0 and Zsh's preexec.
Debarshi Ray 53d075d
Debarshi Ray 53d075d
The OSC 777 escape sequence is taken from Enlightenment's Terminology:
Debarshi Ray 53d075d
https://phab.enlightenment.org/T1765
Debarshi Ray 53d075d
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711060
Debarshi Ray 53d075d
---
Debarshi Ray 53d075d
 src/vte.cc            |  7 +++++++
Debarshi Ray 22ab67e
 src/vte.sh.in         |  2 +-
Debarshi Ray 53d075d
 src/vte/vteterminal.h |  3 ++-
Debarshi Ray 53d075d
 src/vtegtk.cc         | 18 ++++++++++++++++++
Debarshi Ray 53d075d
 src/vtegtk.hh         |  1 +
Debarshi Ray 53d075d
 src/vteinternal.hh    |  2 ++
Debarshi Ray 53d075d
 src/vteseq.cc         |  4 ++++
Debarshi Ray 53d075d
 7 files changed, 35 insertions(+), 2 deletions(-)
Debarshi Ray 53d075d
Debarshi Ray 53d075d
diff --git a/src/vte.cc b/src/vte.cc
Debarshi Ray 6231503
index af73288b9f20..d77d27967b50 100644
Debarshi Ray 53d075d
--- a/src/vte.cc
Debarshi Ray 53d075d
+++ b/src/vte.cc
Debarshi Ray 7bf3512
@@ -10161,6 +10161,13 @@ Terminal::emit_pending_signals()
Debarshi Ray 355cf28
                 m_notification_received = false;
Debarshi Ray 355cf28
         }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        if (m_shell_preexec) {
Debarshi Ray 53d075d
+                _vte_debug_print (VTE_DEBUG_SIGNALS,
Debarshi Ray 53d075d
+                                  "Emitting `shell-preexec'.\n");
Debarshi Ray b6699a2
+                g_signal_emit(freezer.get(), signals[SIGNAL_SHELL_PREEXEC], 0);
Debarshi Ray 53d075d
+                m_shell_preexec = FALSE;
Debarshi Ray 53d075d
+        }
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
 	if (m_window_title_changed) {
Debarshi Ray 53d075d
                 if (m_window_title != m_window_title_pending) {
Debarshi Ray 53d075d
                         m_window_title.swap(m_window_title_pending);
Debarshi Ray 22ab67e
diff --git a/src/vte.sh.in b/src/vte.sh.in
Debarshi Ray 6231503
index f7c4fdeff30b..ec094db032c7 100644
Debarshi Ray 22ab67e
--- a/src/vte.sh.in
Debarshi Ray 22ab67e
+++ b/src/vte.sh.in
Debarshi Ray 22ab67e
@@ -38,7 +38,7 @@ __vte_prompt_command() {
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
 case "$TERM" in
Debarshi Ray 53d075d
   xterm*|vte*)
Debarshi Ray 6231503
-    [ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND="__vte_prompt_command"
Debarshi Ray 6231503
+    [ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND="__vte_prompt_command" && PS0=$(printf "\033]777;preexec\033\\")
Debarshi Ray 6231503
     [ -n "${ZSH_VERSION:-}"  ] && precmd_functions+=(__vte_osc7)
Debarshi Ray 53d075d
     ;;
Debarshi Ray 53d075d
 esac
Debarshi Ray 53d075d
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
Debarshi Ray b6699a2
index 203c77e08c57..5668ac7d71df 100644
Debarshi Ray 53d075d
--- a/src/vte/vteterminal.h
Debarshi Ray 53d075d
+++ b/src/vte/vteterminal.h
Debarshi Ray 53d075d
@@ -105,9 +105,10 @@ struct _VteTerminalClass {
Debarshi Ray 53d075d
 	void (*bell)(VteTerminal* terminal);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
 	void (*notification_received)(VteTerminal* terminal, const gchar *summary, const gchar *body);
Debarshi Ray 53d075d
+	void (*shell_preexec)(VteTerminal* terminal);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         /* Padding for future expansion. */
Debarshi Ray 53d075d
-        gpointer padding[15];
Debarshi Ray 53d075d
+        gpointer padding[14];
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         VteTerminalClassPrivate *priv;
Debarshi Ray 53d075d
 };
Debarshi Ray 53d075d
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
Debarshi Ray 6231503
index bf88b9481981..df247f27c038 100644
Debarshi Ray 53d075d
--- a/src/vtegtk.cc
Debarshi Ray 53d075d
+++ b/src/vtegtk.cc
Debarshi Ray 6231503
@@ -941,6 +941,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 53d075d
 	klass->encoding_changed = NULL;
Debarshi Ray 53d075d
 	klass->char_size_changed = NULL;
Debarshi Ray 53d075d
 	klass->notification_received = NULL;
Debarshi Ray 53d075d
+	klass->shell_preexec = NULL;
Debarshi Ray 53d075d
 	klass->window_title_changed = NULL;
Debarshi Ray 53d075d
 	klass->icon_title_changed = NULL;
Debarshi Ray 53d075d
 	klass->selection_changed = NULL;
Debarshi Ray 6231503
@@ -1042,6 +1043,23 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 53d075d
                              G_TYPE_NONE,
Debarshi Ray 53d075d
                              2, G_TYPE_STRING, G_TYPE_STRING);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        /**
Debarshi Ray 53d075d
+         * VteTerminal::shell-preexec:
Debarshi Ray 53d075d
+         * @vteterminal: the object which received the signal
Debarshi Ray 53d075d
+         *
Debarshi Ray 53d075d
+         * Emitted when the interactive shell has read in a complete
Debarshi Ray 53d075d
+         * command and is about to execute it.
Debarshi Ray 53d075d
+         */
Debarshi Ray 53d075d
+        signals[SIGNAL_SHELL_PREEXEC] =
Debarshi Ray 53d075d
+                g_signal_new(I_("shell-preexec"),
Debarshi Ray 53d075d
+                             G_OBJECT_CLASS_TYPE(klass),
Debarshi Ray 53d075d
+                             G_SIGNAL_RUN_LAST,
Debarshi Ray 53d075d
+                             G_STRUCT_OFFSET(VteTerminalClass, shell_preexec),
Debarshi Ray 53d075d
+                             NULL,
Debarshi Ray 53d075d
+                             NULL,
Debarshi Ray 53d075d
+                             g_cclosure_marshal_VOID__VOID,
Debarshi Ray 53d075d
+                             G_TYPE_NONE, 0);
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
         /**
Debarshi Ray 53d075d
          * VteTerminal::window-title-changed:
Debarshi Ray 53d075d
          * @vteterminal: the object which received the signal
Debarshi Ray 53d075d
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
Debarshi Ray b6699a2
index 30b917786b5b..d3ad1435ae53 100644
Debarshi Ray 53d075d
--- a/src/vtegtk.hh
Debarshi Ray 53d075d
+++ b/src/vtegtk.hh
Debarshi Ray 53d075d
@@ -52,6 +52,7 @@ enum {
Debarshi Ray 53d075d
         SIGNAL_RESIZE_WINDOW,
Debarshi Ray 53d075d
         SIGNAL_RESTORE_WINDOW,
Debarshi Ray 53d075d
         SIGNAL_SELECTION_CHANGED,
Debarshi Ray 53d075d
+        SIGNAL_SHELL_PREEXEC,
Debarshi Ray 53d075d
         SIGNAL_TEXT_DELETED,
Debarshi Ray 53d075d
         SIGNAL_TEXT_INSERTED,
Debarshi Ray 53d075d
         SIGNAL_TEXT_MODIFIED,
Debarshi Ray 53d075d
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
Debarshi Ray 6231503
index 79ea9e7f0da0..009500a3ffc6 100644
Debarshi Ray 53d075d
--- a/src/vteinternal.hh
Debarshi Ray 53d075d
+++ b/src/vteinternal.hh
Debarshi Ray 7bf3512
@@ -923,6 +923,8 @@ public:
Debarshi Ray 53d075d
         std::string m_notification_summary;
Debarshi Ray 53d075d
         std::string m_notification_body;
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        gboolean m_shell_preexec;
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
         std::string m_window_title{};
Debarshi Ray 53d075d
         std::string m_current_directory_uri{};
Debarshi Ray 53d075d
         std::string m_current_file_uri{};
Debarshi Ray 53d075d
diff --git a/src/vteseq.cc b/src/vteseq.cc
Debarshi Ray 7bf3512
index c765b0bfb1f4..ad5935063bd9 100644
Debarshi Ray 53d075d
--- a/src/vteseq.cc
Debarshi Ray 53d075d
+++ b/src/vteseq.cc
Debarshi Ray 7bf3512
@@ -1402,6 +1402,10 @@ Terminal::handle_urxvt_extension(vte::parser::Sequence const& seq,
Debarshi Ray 53d075d
                 m_notification_body = *token;
Debarshi Ray 53d075d
                 return;
Debarshi Ray 53d075d
         }
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
+        if (*token == "preexec") {
Debarshi Ray 53d075d
+                m_shell_preexec = TRUE;
Debarshi Ray 53d075d
+        }
Debarshi Ray 53d075d
 }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
 bool
Debarshi Ray 53d075d
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Debarshi Ray 6231503
From 62b4dec7a7493f531de60ee814596176f3b9c082 Mon Sep 17 00:00:00 2001
Debarshi Ray 53d075d
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 53d075d
Date: Fri, 20 Apr 2018 18:21:53 +0200
Debarshi Ray b6699a2
Subject: [PATCH 07/10] Test the shell-preexec signal
Debarshi Ray 53d075d
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711060
Debarshi Ray 53d075d
---
Debarshi Ray 53d075d
 bindings/vala/app.vala | 6 ++++++
Debarshi Ray 53d075d
 src/app/app.cc         | 7 +++++++
Debarshi Ray 53d075d
 2 files changed, 13 insertions(+)
Debarshi Ray 53d075d
Debarshi Ray 53d075d
diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala
Debarshi Ray 355cf28
index c984b868246d..83af686be106 100644
Debarshi Ray 53d075d
--- a/bindings/vala/app.vala
Debarshi Ray 53d075d
+++ b/bindings/vala/app.vala
Debarshi Ray 53d075d
@@ -310,6 +310,7 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 53d075d
       terminal.notify.connect(notify_cb);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
     terminal.notification_received.connect(notification_received_cb);
Debarshi Ray 53d075d
+    terminal.shell_preexec.connect(shell_preexec_cb);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
     /* Settings */
Debarshi Ray 355cf28
     if (Options.no_double_buffer)
Debarshi Ray 53d075d
@@ -788,6 +789,11 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 53d075d
     print ("[%s]: %s\n", summary, body);
Debarshi Ray 53d075d
   }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+  private void shell_preexec_cb(Vte.Terminal terminal)
Debarshi Ray 53d075d
+  {
Debarshi Ray 53d075d
+    print("[shell] executing command\n");
Debarshi Ray 53d075d
+  }
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
 } /* class Window */
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
 class App : Gtk.Application
Debarshi Ray 53d075d
diff --git a/src/app/app.cc b/src/app/app.cc
Debarshi Ray 7bf3512
index 52893c87414a..3ef597e97365 100644
Debarshi Ray 53d075d
--- a/src/app/app.cc
Debarshi Ray 53d075d
+++ b/src/app/app.cc
Debarshi Ray 7bf3512
@@ -1862,6 +1862,12 @@ notification_received_cb(VteTerminal *terminal,
Debarshi Ray 53d075d
         g_print("[%s]: %s\n", summary, body);
Debarshi Ray 53d075d
 }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+static void
Debarshi Ray 53d075d
+shell_preexec_cb(VteTerminal *terminal)
Debarshi Ray 53d075d
+{
Debarshi Ray 53d075d
+        g_print("[shell] executing command\n");
Debarshi Ray 53d075d
+}
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
 static void
Debarshi Ray 53d075d
 window_lower_window_cb(VteTerminal* terminal,
Debarshi Ray 53d075d
                        VteappWindow* window)
Debarshi Ray 7bf3512
@@ -2098,6 +2104,7 @@ vteapp_window_constructed(GObject *object)
Debarshi Ray 53d075d
                 g_signal_connect(window->terminal, "notify", G_CALLBACK(window_notify_cb), window);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         g_signal_connect(window->terminal, "notification-received", G_CALLBACK(notification_received_cb), NULL);
Debarshi Ray 53d075d
+        g_signal_connect(window->terminal, "shell-preexec", G_CALLBACK(shell_preexec_cb), NULL);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         /* Settings */
Debarshi Ray 511ade8
         if (options.no_double_buffer) {
Debarshi Ray 53d075d
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Debarshi Ray 6231503
From ce908501de9d32ab9d3e0cc600058e104bec2130 Mon Sep 17 00:00:00 2001
Debarshi Ray 53d075d
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 53d075d
Date: Wed, 2 May 2018 17:20:30 +0200
Debarshi Ray b6699a2
Subject: [PATCH 08/10] Support precmd notifications from an interactive shell
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Add sequences
Debarshi Ray 53d075d
  OSC 777 ; precmd BEL
Debarshi Ray 53d075d
  OSC 777 ; precmd ST
Debarshi Ray 53d075d
Debarshi Ray 53d075d
that can be used from an interactive shell's precmd hook to notify the
Debarshi Ray 53d075d
terminal emulator that a first level prompt is about to be shown.
Debarshi Ray 53d075d
Examples of such hooks are Bash's PROMPT_COMMAND and Zsh's precmd.
Debarshi Ray 53d075d
Debarshi Ray 53d075d
The OSC 777 escape sequence is taken from Enlightenment's Terminology:
Debarshi Ray 53d075d
https://phab.enlightenment.org/T1765
Debarshi Ray 53d075d
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711060
Debarshi Ray 53d075d
---
Debarshi Ray 53d075d
 src/vte.cc            |  7 +++++++
Debarshi Ray 22ab67e
 src/vte.sh.in         |  2 +-
Debarshi Ray 53d075d
 src/vte/vteterminal.h |  3 ++-
Debarshi Ray 53d075d
 src/vtegtk.cc         | 18 ++++++++++++++++++
Debarshi Ray 53d075d
 src/vtegtk.hh         |  1 +
Debarshi Ray 53d075d
 src/vteinternal.hh    |  1 +
Debarshi Ray 53d075d
 src/vteseq.cc         |  4 +++-
Debarshi Ray 53d075d
 7 files changed, 33 insertions(+), 3 deletions(-)
Debarshi Ray 53d075d
Debarshi Ray 53d075d
diff --git a/src/vte.cc b/src/vte.cc
Debarshi Ray 6231503
index d77d27967b50..54654c8589ab 100644
Debarshi Ray 53d075d
--- a/src/vte.cc
Debarshi Ray 53d075d
+++ b/src/vte.cc
Debarshi Ray 7bf3512
@@ -10168,6 +10168,13 @@ Terminal::emit_pending_signals()
Debarshi Ray 53d075d
                 m_shell_preexec = FALSE;
Debarshi Ray 53d075d
         }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        if (m_shell_precmd) {
Debarshi Ray 53d075d
+                _vte_debug_print (VTE_DEBUG_SIGNALS,
Debarshi Ray 53d075d
+                                  "Emitting `shell-precmd'.\n");
Debarshi Ray b6699a2
+                g_signal_emit(freezer.get(), signals[SIGNAL_SHELL_PRECMD], 0);
Debarshi Ray 53d075d
+                m_shell_precmd = FALSE;
Debarshi Ray 53d075d
+        }
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
 	if (m_window_title_changed) {
Debarshi Ray 53d075d
                 if (m_window_title != m_window_title_pending) {
Debarshi Ray 53d075d
                         m_window_title.swap(m_window_title_pending);
Debarshi Ray 22ab67e
diff --git a/src/vte.sh.in b/src/vte.sh.in
Debarshi Ray 6231503
index ec094db032c7..18bb266e8d87 100644
Debarshi Ray 22ab67e
--- a/src/vte.sh.in
Debarshi Ray 22ab67e
+++ b/src/vte.sh.in
Debarshi Ray 22ab67e
@@ -32,7 +32,7 @@ __vte_prompt_command() {
Debarshi Ray 53d075d
   local pwd='~'
Debarshi Ray 53d075d
   [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
acdaf4f
   pwd="${pwd//[[:cntrl:]]}"
Debarshi Ray 22ab67e
-  printf '\033]777;notify;Command completed;%s\033\\\033]0;%s@%s:%s\033\\' "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}"
Debarshi Ray 22ab67e
+  printf '\033]777;notify;Command completed;%s\033\\\033]777;precmd\033\\\033]0;%s@%s:%s\033\\' "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}"
Debarshi Ray 22ab67e
   __vte_osc7
Debarshi Ray 53d075d
 }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
Debarshi Ray b6699a2
index 5668ac7d71df..cbd2a77f9f29 100644
Debarshi Ray 53d075d
--- a/src/vte/vteterminal.h
Debarshi Ray 53d075d
+++ b/src/vte/vteterminal.h
Debarshi Ray 53d075d
@@ -105,10 +105,11 @@ struct _VteTerminalClass {
Debarshi Ray 53d075d
 	void (*bell)(VteTerminal* terminal);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
 	void (*notification_received)(VteTerminal* terminal, const gchar *summary, const gchar *body);
Debarshi Ray 53d075d
+	void (*shell_precmd)(VteTerminal* terminal);
Debarshi Ray 53d075d
 	void (*shell_preexec)(VteTerminal* terminal);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         /* Padding for future expansion. */
Debarshi Ray 53d075d
-        gpointer padding[14];
Debarshi Ray 53d075d
+        gpointer padding[13];
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         VteTerminalClassPrivate *priv;
Debarshi Ray 53d075d
 };
Debarshi Ray 53d075d
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
Debarshi Ray 6231503
index df247f27c038..afccd6d85c65 100644
Debarshi Ray 53d075d
--- a/src/vtegtk.cc
Debarshi Ray 53d075d
+++ b/src/vtegtk.cc
Debarshi Ray 6231503
@@ -941,6 +941,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 53d075d
 	klass->encoding_changed = NULL;
Debarshi Ray 53d075d
 	klass->char_size_changed = NULL;
Debarshi Ray 53d075d
 	klass->notification_received = NULL;
Debarshi Ray 53d075d
+	klass->shell_precmd = NULL;
Debarshi Ray 53d075d
 	klass->shell_preexec = NULL;
Debarshi Ray 53d075d
 	klass->window_title_changed = NULL;
Debarshi Ray 53d075d
 	klass->icon_title_changed = NULL;
Debarshi Ray 6231503
@@ -1043,6 +1044,23 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 53d075d
                              G_TYPE_NONE,
Debarshi Ray 53d075d
                              2, G_TYPE_STRING, G_TYPE_STRING);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        /**
Debarshi Ray 53d075d
+         * VteTerminal::shell-precmd:
Debarshi Ray 53d075d
+         * @vteterminal: the object which received the signal
Debarshi Ray 53d075d
+         *
Debarshi Ray 53d075d
+         * Emitted right before an interactive shell shows a
Debarshi Ray 53d075d
+         * first-level prompt.
Debarshi Ray 53d075d
+         */
Debarshi Ray 53d075d
+        signals[SIGNAL_SHELL_PRECMD] =
Debarshi Ray 53d075d
+                g_signal_new(I_("shell-precmd"),
Debarshi Ray 53d075d
+                             G_OBJECT_CLASS_TYPE(klass),
Debarshi Ray 53d075d
+                             G_SIGNAL_RUN_LAST,
Debarshi Ray 53d075d
+                             G_STRUCT_OFFSET(VteTerminalClass, shell_precmd),
Debarshi Ray 53d075d
+                             NULL,
Debarshi Ray 53d075d
+                             NULL,
Debarshi Ray 53d075d
+                             g_cclosure_marshal_VOID__VOID,
Debarshi Ray 53d075d
+                             G_TYPE_NONE, 0);
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
         /**
Debarshi Ray 53d075d
          * VteTerminal::shell-preexec:
Debarshi Ray 53d075d
          * @vteterminal: the object which received the signal
Debarshi Ray 53d075d
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
Debarshi Ray b6699a2
index d3ad1435ae53..85c2a38d61ec 100644
Debarshi Ray 53d075d
--- a/src/vtegtk.hh
Debarshi Ray 53d075d
+++ b/src/vtegtk.hh
Debarshi Ray 53d075d
@@ -52,6 +52,7 @@ enum {
Debarshi Ray 53d075d
         SIGNAL_RESIZE_WINDOW,
Debarshi Ray 53d075d
         SIGNAL_RESTORE_WINDOW,
Debarshi Ray 53d075d
         SIGNAL_SELECTION_CHANGED,
Debarshi Ray 53d075d
+        SIGNAL_SHELL_PRECMD,
Debarshi Ray 53d075d
         SIGNAL_SHELL_PREEXEC,
Debarshi Ray 53d075d
         SIGNAL_TEXT_DELETED,
Debarshi Ray 53d075d
         SIGNAL_TEXT_INSERTED,
Debarshi Ray 53d075d
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
Debarshi Ray 6231503
index 009500a3ffc6..18ffeaf3a270 100644
Debarshi Ray 53d075d
--- a/src/vteinternal.hh
Debarshi Ray 53d075d
+++ b/src/vteinternal.hh
Debarshi Ray 7bf3512
@@ -923,6 +923,7 @@ public:
Debarshi Ray 53d075d
         std::string m_notification_summary;
Debarshi Ray 53d075d
         std::string m_notification_body;
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+        gboolean m_shell_precmd;
Debarshi Ray 53d075d
         gboolean m_shell_preexec;
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         std::string m_window_title{};
Debarshi Ray 53d075d
diff --git a/src/vteseq.cc b/src/vteseq.cc
Debarshi Ray 7bf3512
index ad5935063bd9..4b66681d713c 100644
Debarshi Ray 53d075d
--- a/src/vteseq.cc
Debarshi Ray 53d075d
+++ b/src/vteseq.cc
Debarshi Ray 7bf3512
@@ -1403,7 +1403,9 @@ Terminal::handle_urxvt_extension(vte::parser::Sequence const& seq,
Debarshi Ray 53d075d
                 return;
Debarshi Ray 53d075d
         }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
-        if (*token == "preexec") {
Debarshi Ray 53d075d
+        if (*token == "precmd") {
Debarshi Ray 53d075d
+                m_shell_precmd = TRUE;
Debarshi Ray 53d075d
+        } else if (*token == "preexec") {
Debarshi Ray 53d075d
                 m_shell_preexec = TRUE;
Debarshi Ray 53d075d
         }
Debarshi Ray 53d075d
 }
Debarshi Ray 53d075d
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 53d075d
Debarshi Ray 53d075d
Debarshi Ray 6231503
From c57e30715838cb9d6eb0d4390867746bea0c42d5 Mon Sep 17 00:00:00 2001
Debarshi Ray 53d075d
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 53d075d
Date: Wed, 2 May 2018 17:30:48 +0200
Debarshi Ray b6699a2
Subject: [PATCH 09/10] Test the shell-precmd signal
Debarshi Ray 53d075d
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711059
Debarshi Ray 53d075d
https://bugzilla.gnome.org/show_bug.cgi?id=711060
Debarshi Ray 53d075d
---
Debarshi Ray 53d075d
 bindings/vala/app.vala | 6 ++++++
Debarshi Ray 53d075d
 src/app/app.cc         | 7 +++++++
Debarshi Ray 53d075d
 2 files changed, 13 insertions(+)
Debarshi Ray 53d075d
Debarshi Ray 53d075d
diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala
Debarshi Ray 355cf28
index 83af686be106..300384f5c74b 100644
Debarshi Ray 53d075d
--- a/bindings/vala/app.vala
Debarshi Ray 53d075d
+++ b/bindings/vala/app.vala
Debarshi Ray 53d075d
@@ -310,6 +310,7 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 53d075d
       terminal.notify.connect(notify_cb);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
     terminal.notification_received.connect(notification_received_cb);
Debarshi Ray 53d075d
+    terminal.shell_precmd.connect(shell_precmd_cb);
Debarshi Ray 53d075d
     terminal.shell_preexec.connect(shell_preexec_cb);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
     /* Settings */
Debarshi Ray 53d075d
@@ -789,6 +790,11 @@ class Window : Gtk.ApplicationWindow
Debarshi Ray 53d075d
     print ("[%s]: %s\n", summary, body);
Debarshi Ray 53d075d
   }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+  private void shell_precmd_cb(Vte.Terminal terminal)
Debarshi Ray 53d075d
+  {
Debarshi Ray 53d075d
+    print("[shell] showing command prompt\n");
Debarshi Ray 53d075d
+  }
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
   private void shell_preexec_cb(Vte.Terminal terminal)
Debarshi Ray 53d075d
   {
Debarshi Ray 53d075d
     print("[shell] executing command\n");
Debarshi Ray 53d075d
diff --git a/src/app/app.cc b/src/app/app.cc
Debarshi Ray 7bf3512
index 3ef597e97365..e1b10ca43b2c 100644
Debarshi Ray 53d075d
--- a/src/app/app.cc
Debarshi Ray 53d075d
+++ b/src/app/app.cc
Debarshi Ray 7bf3512
@@ -1862,6 +1862,12 @@ notification_received_cb(VteTerminal *terminal,
Debarshi Ray 53d075d
         g_print("[%s]: %s\n", summary, body);
Debarshi Ray 53d075d
 }
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
+static void
Debarshi Ray 53d075d
+shell_precmd_cb(VteTerminal *terminal)
Debarshi Ray 53d075d
+{
Debarshi Ray 53d075d
+        g_print("[shell] showing command prompt\n");
Debarshi Ray 53d075d
+}
Debarshi Ray 53d075d
+
Debarshi Ray 53d075d
 static void
Debarshi Ray 53d075d
 shell_preexec_cb(VteTerminal *terminal)
Debarshi Ray 53d075d
 {
Debarshi Ray 7bf3512
@@ -2104,6 +2110,7 @@ vteapp_window_constructed(GObject *object)
Debarshi Ray 53d075d
                 g_signal_connect(window->terminal, "notify", G_CALLBACK(window_notify_cb), window);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         g_signal_connect(window->terminal, "notification-received", G_CALLBACK(notification_received_cb), NULL);
Debarshi Ray 53d075d
+        g_signal_connect(window->terminal, "shell-precmd", G_CALLBACK(shell_precmd_cb), NULL);
Debarshi Ray 53d075d
         g_signal_connect(window->terminal, "shell-preexec", G_CALLBACK(shell_preexec_cb), NULL);
Debarshi Ray 53d075d
 
Debarshi Ray 53d075d
         /* Settings */
Debarshi Ray 53d075d
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 955c24e
Debarshi Ray 3a1a7ca
Debarshi Ray 6231503
From 3e049907ff0981ba235df9b97b56828cb814fb76 Mon Sep 17 00:00:00 2001
Debarshi Ray 3a1a7ca
From: Debarshi Ray <debarshir@gnome.org>
Debarshi Ray 3a1a7ca
Date: Mon, 10 Jun 2019 20:30:18 +0200
Debarshi Ray b6699a2
Subject: [PATCH 10/10] Support tracking the active container inside the
Debarshi Ray 3a1a7ca
 terminal
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
Add sequences
Debarshi Ray 3a1a7ca
  OSC 777 ; container ; push ; NAME ; RUNTIME BEL
Debarshi Ray 3a1a7ca
  OSC 777 ; container ; push ; NAME ; RUNTIME ST
Debarshi Ray 3a1a7ca
  OSC 777 ; container ; pop ; NAME ; RUNTIME BEL
Debarshi Ray 3a1a7ca
  OSC 777 ; container ; pop ; NAME ; RUNTIME ST
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
that let container tools notify the terminal emulator when entering and
Debarshi Ray 3a1a7ca
leaving a container environment. The RUNTIME argument namespaces the
Debarshi Ray 3a1a7ca
NAME and identifies the container tooling being used. eg., docker,
Debarshi Ray 3a1a7ca
flatpak, podman, toolbox, etc..
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
The OSC 777 escape sequence is taken from Enlightenment's Terminology:
Debarshi Ray 3a1a7ca
https://phab.enlightenment.org/T1765
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
It's a VTE-specific extension until a standard escape sequence is
Debarshi Ray 3a1a7ca
agreed upon across multiple different terminal emulators [1].
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
[1] https://gitlab.freedesktop.org/terminal-wg/specifications/issues/17
Debarshi Ray 3a1a7ca
---
Debarshi Ray b6699a2
 src/vte.cc            |  9 +++++
Debarshi Ray 3a1a7ca
 src/vte/vteterminal.h |  4 +++
Debarshi Ray b6699a2
 src/vtegtk.cc         | 77 +++++++++++++++++++++++++++++++++++++++++++
Debarshi Ray 3a1a7ca
 src/vtegtk.hh         |  2 ++
Debarshi Ray b6699a2
 src/vteinternal.hh    | 16 +++++++++
Debarshi Ray b6699a2
 src/vteseq.cc         | 31 +++++++++++++++++
Debarshi Ray b6699a2
 6 files changed, 139 insertions(+)
Debarshi Ray 3a1a7ca
Debarshi Ray 3a1a7ca
diff --git a/src/vte.cc b/src/vte.cc
Debarshi Ray 6231503
index 54654c8589ab..b5f1258bbd99 100644
Debarshi Ray 3a1a7ca
--- a/src/vte.cc
Debarshi Ray 3a1a7ca
+++ b/src/vte.cc
Debarshi Ray 7bf3512
@@ -10189,6 +10189,15 @@ Terminal::emit_pending_signals()
Debarshi Ray 3a1a7ca
                 m_window_title_changed = false;
Debarshi Ray 3a1a7ca
 	}
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+        if (m_containers_changed) {
Debarshi Ray 3a1a7ca
+                _vte_debug_print(VTE_DEBUG_SIGNALS,
Debarshi Ray 3a1a7ca
+                                 "Notifying `current-container-name' and `current-container-runtime'.\n");
Debarshi Ray 3a1a7ca
+
Debarshi Ray b6699a2
+                g_object_notify_by_pspec(freezer.get(), pspecs[PROP_CURRENT_CONTAINER_NAME]);
Debarshi Ray b6699a2
+                g_object_notify_by_pspec(freezer.get(), pspecs[PROP_CURRENT_CONTAINER_RUNTIME]);
Debarshi Ray 3a1a7ca
+                m_containers_changed = false;
Debarshi Ray 3a1a7ca
+        }
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
 	if (m_current_directory_uri_changed) {
Debarshi Ray 3a1a7ca
                 if (m_current_directory_uri != m_current_directory_uri_pending) {
Debarshi Ray 3a1a7ca
                         m_current_directory_uri.swap(m_current_directory_uri_pending);
Debarshi Ray 3a1a7ca
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
Debarshi Ray b6699a2
index cbd2a77f9f29..15aa421a0c68 100644
Debarshi Ray 3a1a7ca
--- a/src/vte/vteterminal.h
Debarshi Ray 3a1a7ca
+++ b/src/vte/vteterminal.h
Debarshi Ray b6699a2
@@ -484,6 +484,10 @@ glong vte_terminal_get_column_count(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VT
Debarshi Ray 3a1a7ca
 _VTE_PUBLIC
Debarshi Ray b6699a2
 const char *vte_terminal_get_window_title(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 3a1a7ca
 _VTE_PUBLIC
Debarshi Ray b6699a2
+const char *vte_terminal_get_current_container_name(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 3a1a7ca
+_VTE_PUBLIC
Debarshi Ray b6699a2
+const char *vte_terminal_get_current_container_runtime(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 3a1a7ca
+_VTE_PUBLIC
Debarshi Ray b6699a2
 const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 3a1a7ca
 _VTE_PUBLIC
Debarshi Ray b6699a2
 const char *vte_terminal_get_current_file_uri(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
Debarshi Ray 3a1a7ca
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
Debarshi Ray 6231503
index afccd6d85c65..242d6d979ddc 100644
Debarshi Ray 3a1a7ca
--- a/src/vtegtk.cc
Debarshi Ray 3a1a7ca
+++ b/src/vtegtk.cc
Debarshi Ray 6231503
@@ -664,6 +664,12 @@ try
Debarshi Ray 3a1a7ca
                 case PROP_CURSOR_BLINK_MODE:
Debarshi Ray 3a1a7ca
                         g_value_set_enum (value, vte_terminal_get_cursor_blink_mode (terminal));
Debarshi Ray 3a1a7ca
                         break;
Debarshi Ray 3a1a7ca
+                case PROP_CURRENT_CONTAINER_NAME:
Debarshi Ray 3a1a7ca
+                        g_value_set_string (value, vte_terminal_get_current_container_name (terminal));
Debarshi Ray 3a1a7ca
+                        break;
Debarshi Ray 3a1a7ca
+                case PROP_CURRENT_CONTAINER_RUNTIME:
Debarshi Ray 3a1a7ca
+                        g_value_set_string (value, vte_terminal_get_current_container_runtime (terminal));
Debarshi Ray 3a1a7ca
+                        break;
Debarshi Ray 3a1a7ca
                 case PROP_CURRENT_DIRECTORY_URI:
Debarshi Ray 3a1a7ca
                         g_value_set_string (value, vte_terminal_get_current_directory_uri (terminal));
Debarshi Ray 3a1a7ca
                         break;
Debarshi Ray 6231503
@@ -2036,6 +2042,27 @@ vte_terminal_class_init(VteTerminalClass *klass)
Debarshi Ray 3a1a7ca
                                      NULL,
Debarshi Ray 3a1a7ca
                                      (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+        /**
Debarshi Ray 3a1a7ca
+         * VteTerminal:current-container-name:
Debarshi Ray 3a1a7ca
+         *
Debarshi Ray 3a1a7ca
+         * The name of the current container, or %NULL if unset.
Debarshi Ray 3a1a7ca
+         */
Debarshi Ray 3a1a7ca
+        pspecs[PROP_CURRENT_CONTAINER_NAME] =
Debarshi Ray 3a1a7ca
+                g_param_spec_string ("current-container-name", NULL, NULL,
Debarshi Ray 3a1a7ca
+                                     NULL,
Debarshi Ray 3a1a7ca
+                                     (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+        /**
Debarshi Ray 3a1a7ca
+         * VteTerminal:current-container-runtime:
Debarshi Ray 3a1a7ca
+         *
Debarshi Ray 3a1a7ca
+         * The name of the runtime toolset used to set up the current
Debarshi Ray 3a1a7ca
+         * container, or %NULL if unset.
Debarshi Ray 3a1a7ca
+         */
Debarshi Ray 3a1a7ca
+        pspecs[PROP_CURRENT_CONTAINER_RUNTIME] =
Debarshi Ray 3a1a7ca
+                g_param_spec_string ("current-container-runtime", NULL, NULL,
Debarshi Ray 3a1a7ca
+                                     NULL,
Debarshi Ray 3a1a7ca
+                                     (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
         /**
Debarshi Ray 3a1a7ca
          * VteTerminal:current-directory-uri:
Debarshi Ray 3a1a7ca
          *
Debarshi Ray 6231503
@@ -4531,6 +4558,56 @@ catch (...)
Debarshi Ray b6699a2
         return -1;
Debarshi Ray 3a1a7ca
 }
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+/**
Debarshi Ray 3a1a7ca
+ * vte_terminal_get_current_container_name:
Debarshi Ray 3a1a7ca
+ * @terminal: a #VteTerminal
Debarshi Ray 3a1a7ca
+ *
Debarshi Ray 3a1a7ca
+ * Returns: (nullable) (transfer none): the name of the current
Debarshi Ray 3a1a7ca
+ *   container, or %NULL
Debarshi Ray 3a1a7ca
+ */
Debarshi Ray 3a1a7ca
+const char *
Debarshi Ray b6699a2
+vte_terminal_get_current_container_name(VteTerminal *terminal) noexcept
Debarshi Ray b6699a2
+try
Debarshi Ray 3a1a7ca
+{
Debarshi Ray 3a1a7ca
+        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
Debarshi Ray 3a1a7ca
+        auto impl = IMPL(terminal);
Debarshi Ray 3a1a7ca
+        if (impl->m_containers.empty())
Debarshi Ray 3a1a7ca
+                return NULL;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+        const VteContainer &container = impl->m_containers.top();
Debarshi Ray 3a1a7ca
+        return container.m_name.c_str();
Debarshi Ray 3a1a7ca
+}
Debarshi Ray b6699a2
+catch (...)
Debarshi Ray b6699a2
+{
Debarshi Ray b6699a2
+        vte::log_exception();
Debarshi Ray b6699a2
+        return NULL;
Debarshi Ray b6699a2
+}
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+/**
Debarshi Ray 3a1a7ca
+ * vte_terminal_get_current_container_runtime:
Debarshi Ray 3a1a7ca
+ * @terminal: a #VteTerminal
Debarshi Ray 3a1a7ca
+ *
Debarshi Ray 3a1a7ca
+ * Returns: (nullable) (transfer none): the name of the runtime
Debarshi Ray 3a1a7ca
+ *   toolset used to set up the current container, or %NULL
Debarshi Ray 3a1a7ca
+ */
Debarshi Ray 3a1a7ca
+const char *
Debarshi Ray b6699a2
+vte_terminal_get_current_container_runtime(VteTerminal *terminal) noexcept
Debarshi Ray b6699a2
+try
Debarshi Ray 3a1a7ca
+{
Debarshi Ray 3a1a7ca
+        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
Debarshi Ray 3a1a7ca
+        auto impl = IMPL(terminal);
Debarshi Ray 3a1a7ca
+        if (impl->m_containers.empty())
Debarshi Ray 3a1a7ca
+                return NULL;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+        const VteContainer &container = impl->m_containers.top();
Debarshi Ray 3a1a7ca
+        return container.m_runtime.c_str();
Debarshi Ray 3a1a7ca
+}
Debarshi Ray b6699a2
+catch (...)
Debarshi Ray b6699a2
+{
Debarshi Ray b6699a2
+        vte::log_exception();
Debarshi Ray b6699a2
+        return NULL;
Debarshi Ray b6699a2
+}
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
 /**
Debarshi Ray 3a1a7ca
  * vte_terminal_get_current_directory_uri:
Debarshi Ray 3a1a7ca
  * @terminal: a #VteTerminal
Debarshi Ray 3a1a7ca
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
Debarshi Ray b6699a2
index 85c2a38d61ec..a258902a3092 100644
Debarshi Ray 3a1a7ca
--- a/src/vtegtk.hh
Debarshi Ray 3a1a7ca
+++ b/src/vtegtk.hh
Debarshi Ray 3a1a7ca
@@ -76,6 +76,8 @@ enum {
Debarshi Ray 3a1a7ca
         PROP_CJK_AMBIGUOUS_WIDTH,
Debarshi Ray 3a1a7ca
         PROP_CURSOR_BLINK_MODE,
Debarshi Ray 3a1a7ca
         PROP_CURSOR_SHAPE,
Debarshi Ray 3a1a7ca
+        PROP_CURRENT_CONTAINER_NAME,
Debarshi Ray 3a1a7ca
+        PROP_CURRENT_CONTAINER_RUNTIME,
Debarshi Ray 3a1a7ca
         PROP_CURRENT_DIRECTORY_URI,
Debarshi Ray 3a1a7ca
         PROP_CURRENT_FILE_URI,
Debarshi Ray 3a1a7ca
         PROP_DELETE_BINDING,
Debarshi Ray 3a1a7ca
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
Debarshi Ray 6231503
index 18ffeaf3a270..f6b98f670ad5 100644
Debarshi Ray 3a1a7ca
--- a/src/vteinternal.hh
Debarshi Ray 3a1a7ca
+++ b/src/vteinternal.hh
Debarshi Ray 7bf3512
@@ -56,6 +56,7 @@
Debarshi Ray 3a1a7ca
 #include <list>
Debarshi Ray 3a1a7ca
 #include <queue>
Debarshi Ray 22ab67e
 #include <optional>
Debarshi Ray 3a1a7ca
+#include <stack>
Debarshi Ray 3a1a7ca
 #include <string>
Debarshi Ray 511ade8
 #include <variant>
Debarshi Ray 3a1a7ca
 #include <vector>
Debarshi Ray 7bf3512
@@ -94,6 +95,18 @@ typedef enum _VteCharacterReplacement {
Debarshi Ray 22ab67e
         VTE_CHARACTER_REPLACEMENT_LINE_DRAWING
Debarshi Ray 3a1a7ca
 } VteCharacterReplacement;
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+struct VteContainer {
Debarshi Ray 3a1a7ca
+public:
Debarshi Ray 3a1a7ca
+        VteContainer(const std::string &name, const std::string &runtime) :
Debarshi Ray 3a1a7ca
+                m_name{name},
Debarshi Ray 3a1a7ca
+                m_runtime{runtime}
Debarshi Ray 3a1a7ca
+        {
Debarshi Ray 3a1a7ca
+        }
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+        std::string m_name;
Debarshi Ray 3a1a7ca
+        std::string m_runtime;
Debarshi Ray 3a1a7ca
+};
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
 typedef struct _VtePaletteColor {
Debarshi Ray 3a1a7ca
 	struct {
Debarshi Ray 3a1a7ca
 		vte::color::rgb color;
Debarshi Ray 7bf3512
@@ -918,6 +931,9 @@ public:
Debarshi Ray 3a1a7ca
         gboolean m_cursor_moved_pending;
Debarshi Ray 3a1a7ca
         gboolean m_contents_changed_pending;
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+        bool m_containers_changed{false};
Debarshi Ray 3a1a7ca
+        std::stack<VteContainer> m_containers;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
         /* desktop notification */
Debarshi Ray 3a1a7ca
         bool m_notification_received{false};
Debarshi Ray 3a1a7ca
         std::string m_notification_summary;
Debarshi Ray 3a1a7ca
diff --git a/src/vteseq.cc b/src/vteseq.cc
Debarshi Ray 7bf3512
index 4b66681d713c..6e7cb8741696 100644
Debarshi Ray 3a1a7ca
--- a/src/vteseq.cc
Debarshi Ray 3a1a7ca
+++ b/src/vteseq.cc
Debarshi Ray 7bf3512
@@ -1385,6 +1385,37 @@ Terminal::handle_urxvt_extension(vte::parser::Sequence const& seq,
Debarshi Ray 3a1a7ca
         if (token == endtoken)
Debarshi Ray 3a1a7ca
                 return;
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
+        if (*token == "container") {
Debarshi Ray 3a1a7ca
+                ++token;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                if (token == endtoken)
Debarshi Ray 3a1a7ca
+                        return;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                const std::string sub_command = *token;
Debarshi Ray 3a1a7ca
+                ++token;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                if (sub_command == "pop") {
Debarshi Ray 3a1a7ca
+                        if (!m_containers.empty()) {
Debarshi Ray 3a1a7ca
+                                m_containers.pop();
Debarshi Ray 3a1a7ca
+                                m_containers_changed = true;
Debarshi Ray 3a1a7ca
+                        }
Debarshi Ray 3a1a7ca
+                } else if (sub_command == "push") {
Debarshi Ray 3a1a7ca
+                        if (token == endtoken)
Debarshi Ray 3a1a7ca
+                                return;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                        const std::string name = *token;
Debarshi Ray 3a1a7ca
+                        ++token;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                        if (token == endtoken)
Debarshi Ray 3a1a7ca
+                                return;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                        const std::string runtime = *token;
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
+                        m_containers.emplace(name, runtime);
Debarshi Ray 3a1a7ca
+                        m_containers_changed = true;
Debarshi Ray 3a1a7ca
+                }
Debarshi Ray 3a1a7ca
+        }
Debarshi Ray 3a1a7ca
+
Debarshi Ray 3a1a7ca
         if (*token == "notify") {
Debarshi Ray 3a1a7ca
                 ++token;
Debarshi Ray 3a1a7ca
 
Debarshi Ray 3a1a7ca
-- 
Debarshi Ray b6699a2
2.25.4
Debarshi Ray 89a8627