Merge lp:~daniellimws/gnome-terminal/command-notify into lp:~ubuntu-desktop/gnome-terminal/ubuntu

Proposed by Daniel Lim
Status: Work in progress
Proposed branch: lp:~daniellimws/gnome-terminal/command-notify
Merge into: lp:~ubuntu-desktop/gnome-terminal/ubuntu
Diff against target: 450 lines (+413/-1)
5 files modified
debian/changelog (+11/-0)
debian/control (+1/-1)
debian/patches/command-notify-debug.patch (+80/-0)
debian/patches/command-notify.patch (+319/-0)
debian/patches/series (+2/-0)
To merge this branch: bzr merge lp:~daniellimws/gnome-terminal/command-notify
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Needs Fixing
Review via email: mp+336112@code.launchpad.net

Commit message

Add command line notification patches from Fedora

Description of the change

Add command line notification patches from Fedora.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Putting them on hold for after GCI, Still some fixes to do (in addition to update debian/control.in)

review: Needs Fixing

Unmerged revisions

207. By Daniel Lim

* debian/patches/command-notify.patch:
  Support desktop notification from OSC 777
* debian/patches/command-notify-debug.patch:
  Sprinkle debug messages for notifications
* debian/control:
  Update to use libvte-2.91-dev (>= 0.48.4)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-07-13 15:07:53 +0000
3+++ debian/changelog 2018-01-15 15:00:04 +0000
4@@ -1,3 +1,14 @@
5+gnome-terminal (3.24.2-0ubuntu6) UNRELEASED; urgency=medium
6+
7+ * debian/patches/command-notify.patch:
8+ Support desktop notification from OSC 777
9+ * debian/patches/command-notify-debug.patch:
10+ Sprinkle debug messages for notifications
11+ * debian/control:
12+ Update to use libvte-2.91-dev (>= 0.48.4)
13+
14+ -- daniel <daniel@daniels-ubuntu> Mon, 15 Jan 2018 18:06:38 +0800
15+
16 gnome-terminal (3.24.2-0ubuntu4) artful; urgency=medium
17
18 * debian/patches/0001-screen-window-Extra-padding-around-transparent-termi.patch:
19
20=== modified file 'debian/control'
21--- debian/control 2017-07-13 15:07:48 +0000
22+++ debian/control 2018-01-15 15:00:04 +0000
23@@ -19,7 +19,7 @@
24 libgtk-3-dev (>= 3.20),
25 libglib2.0-dev (>= 2.42.0),
26 # libpcre2-dev (>= 10.00),
27- libvte-2.91-dev (>= 0.48.2),
28+ libvte-2.91-dev (>= 0.48.4),
29 libsm-dev,
30 gnome-pkg-tools (>= 0.10),
31 docbook-to-man,
32
33=== added file 'debian/patches/command-notify-debug.patch'
34--- debian/patches/command-notify-debug.patch 1970-01-01 00:00:00 +0000
35+++ debian/patches/command-notify-debug.patch 2018-01-15 15:00:04 +0000
36@@ -0,0 +1,80 @@
37+From 1a3ff85b3c404f762f01808b802ffe2ed86d4074 Mon Sep 17 00:00:00 2001
38+From: Debarshi Ray <debarshir@gnome.org>
39+Date: Thu, 29 Jan 2015 11:47:21 +0100
40+Subject: [PATCH] Sprinkle debug messages for notifications
41+
42+This can be useful for finding out whether the escape sequence wasn't
43+emitted or the filtering was faulty.
44+
45+https://bugzilla.gnome.org/show_bug.cgi?id=711059
46+---
47+ src/terminal-debug.c | 1 +
48+ src/terminal-debug.h | 3 ++-
49+ src/terminal-screen.c | 6 ++++++
50+ 3 files changed, 9 insertions(+), 1 deletion(-)
51+
52+diff --git a/src/terminal-debug.c b/src/terminal-debug.c
53+index 0ff321f1f0e2..dac79c38d82b 100644
54+--- a/src/terminal-debug.c
55++++ b/src/terminal-debug.c
56+@@ -38,6 +38,7 @@ _terminal_debug_init(void)
57+ { "settings-list", TERMINAL_DEBUG_SETTINGS_LIST },
58+ { "appmenu", TERMINAL_DEBUG_APPMENU },
59+ { "search", TERMINAL_DEBUG_SEARCH },
60++ { "notifications", TERMINAL_DEBUG_NOTIFICATIONS },
61+ };
62+
63+ _terminal_debug_flags = g_parse_debug_string (g_getenv ("GNOME_TERMINAL_DEBUG"),
64+diff --git a/src/terminal-debug.h b/src/terminal-debug.h
65+index 5dc3ca4f3df0..7499ebe06c88 100644
66+--- a/src/terminal-debug.h
67++++ b/src/terminal-debug.h
68+@@ -34,7 +34,8 @@ typedef enum {
69+ TERMINAL_DEBUG_PROFILE = 1 << 6,
70+ TERMINAL_DEBUG_SETTINGS_LIST = 1 << 7,
71+ TERMINAL_DEBUG_APPMENU = 1 << 8,
72+- TERMINAL_DEBUG_SEARCH = 1 << 9
73++ TERMINAL_DEBUG_SEARCH = 1 << 9,
74++ TERMINAL_DEBUG_NOTIFICATIONS = 1 << 10
75+ } TerminalDebugFlags;
76+
77+ void _terminal_debug_init(void);
78+diff --git a/src/terminal-screen.c b/src/terminal-screen.c
79+index 6c96227c2f20..897147903240 100644
80+--- a/src/terminal-screen.c
81++++ b/src/terminal-screen.c
82+@@ -1728,6 +1728,8 @@ terminal_screen_focus_in (GtkWidget *widget,
83+ TerminalApp *app;
84+ TerminalWindow *window;
85+
86++ _terminal_debug_print (TERMINAL_DEBUG_NOTIFICATIONS, "Notification withdrawn\n");
87++
88+ window = terminal_screen_get_window (screen);
89+ if (window != NULL)
90+ {
91+@@ -1866,6 +1868,8 @@ terminal_screen_notification_received (VteTerminal *terminal,
92+ TerminalScreenPrivate *priv = screen->priv;
93+ TerminalWindow *window;
94+
95++ _terminal_debug_print (TERMINAL_DEBUG_NOTIFICATIONS, "Notification received: [%s]: %s\n", summary, body);
96++
97+ if (G_UNLIKELY (!priv->shell_prompt_shown))
98+ {
99+ priv->shell_prompt_shown = TRUE;
100+@@ -1897,6 +1901,7 @@ terminal_screen_notification_received (VteTerminal *terminal,
101+ tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (mdi_container), GTK_WIDGET (screen_container));
102+ terminal_tab_label_set_bold (TERMINAL_TAB_LABEL (tab_label), TRUE);
103+ terminal_tab_label_set_icon (TERMINAL_TAB_LABEL (tab_label), "dialog-information-symbolic", summary);
104++ _terminal_debug_print (TERMINAL_DEBUG_NOTIFICATIONS, "Notify tab\n");
105+ }
106+ }
107+ else
108+@@ -1912,6 +1917,7 @@ terminal_screen_notification_received (VteTerminal *terminal,
109+
110+ app = terminal_app_get ();
111+ g_application_send_notification (G_APPLICATION (app), priv->uuid, notification);
112++ _terminal_debug_print (TERMINAL_DEBUG_NOTIFICATIONS, "Notify desktop\n");
113+ }
114+ }
115+
116+--
117
118=== added file 'debian/patches/command-notify.patch'
119--- debian/patches/command-notify.patch 1970-01-01 00:00:00 +0000
120+++ debian/patches/command-notify.patch 2018-01-15 15:00:04 +0000
121@@ -0,0 +1,319 @@
122+From 5caa9e6a6179ea1408f0c546fb0022d022056de3 Mon Sep 17 00:00:00 2001
123+From: Debarshi Ray <debarshir@gnome.org>
124+Date: Tue, 27 Jan 2015 18:40:13 +0100
125+Subject: [PATCH] Support desktop notifications from OSC 777
126+
127+https://bugzilla.gnome.org/show_bug.cgi?id=711059
128+---
129+ src/terminal-app.c | 32 ++++++++++++++
130+ src/terminal-screen.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++
131+ src/terminal-tab-label.c | 28 +++++++++++-
132+ src/terminal-tab-label.h | 4 ++
133+ 4 files changed, 171 insertions(+), 1 deletion(-)
134+
135+diff --git a/src/terminal-app.c b/src/terminal-app.c
136+index 6c783bc1df79..6a79e98183b3 100644
137+--- a/src/terminal-app.c
138++++ b/src/terminal-app.c
139+@@ -374,6 +374,31 @@ app_menu_quit_cb (GSimpleAction *action,
140+ gtk_widget_destroy (GTK_WIDGET (window));
141+ }
142+
143++/* Other action callbacks */
144++
145++static void
146++action_activate_tab_cb (GSimpleAction *action,
147++ GVariant *parameter,
148++ gpointer user_data)
149++{
150++ GtkApplication *application = user_data;
151++ GtkWidget *toplevel;
152++ TerminalScreen *screen;
153++ const char *uuid;
154++
155++ g_variant_get (parameter, "&s", &uuid);
156++ screen = terminal_app_get_screen_by_uuid (TERMINAL_APP (application), uuid);
157++ if (screen == NULL)
158++ return;
159++
160++ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (screen));
161++ if (!gtk_widget_is_toplevel (toplevel))
162++ return;
163++
164++ terminal_window_switch_screen (TERMINAL_WINDOW (toplevel), screen);
165++ gtk_window_present (GTK_WINDOW (toplevel));
166++}
167++
168+ /* Class implementation */
169+
170+ G_DEFINE_TYPE (TerminalApp, terminal_app, GTK_TYPE_APPLICATION)
171+@@ -396,6 +421,10 @@ terminal_app_startup (GApplication *application)
172+ { "quit", app_menu_quit_cb, NULL, NULL, NULL }
173+ };
174+
175++ const GActionEntry other_actions[] = {
176++ { "activate-tab", action_activate_tab_cb, "s", NULL, NULL }
177++ };
178++
179+ g_application_set_resource_base_path (application, TERMINAL_RESOURCES_PATH_PREFIX);
180+
181+ G_APPLICATION_CLASS (terminal_app_parent_class)->startup (application);
182+@@ -406,6 +435,9 @@ terminal_app_startup (GApplication *application)
183+ g_action_map_add_action_entries (G_ACTION_MAP (application),
184+ app_menu_actions, G_N_ELEMENTS (app_menu_actions),
185+ application);
186++ g_action_map_add_action_entries (G_ACTION_MAP (application),
187++ other_actions, G_N_ELEMENTS (other_actions),
188++ application);
189+
190+
191+ app_load_css (application);
192+diff --git a/src/terminal-screen.c b/src/terminal-screen.c
193+index c67de274f8a1..6c96227c2f20 100644
194+--- a/src/terminal-screen.c
195++++ b/src/terminal-screen.c
196+@@ -54,6 +54,7 @@
197+ #include "terminal-marshal.h"
198+ #include "terminal-schemas.h"
199+ #include "terminal-screen-container.h"
200++#include "terminal-tab-label.h"
201+ #include "terminal-util.h"
202+ #include "terminal-window.h"
203+ #include "terminal-info-bar.h"
204+@@ -89,6 +90,7 @@ struct _TerminalScreenPrivate
205+ char **initial_env;
206+ char **override_command;
207+ gboolean shell;
208++ gboolean shell_prompt_shown;
209+ int child_pid;
210+ GSList *match_tags;
211+ guint launch_child_source_id;
212+@@ -141,11 +143,16 @@ static gboolean terminal_screen_button_press (GtkWidget *widget,
213+ GdkEventButton *event);
214+ static void terminal_screen_hierarchy_changed (GtkWidget *widget,
215+ GtkWidget *previous_toplevel);
216++static gboolean terminal_screen_focus_in (GtkWidget *widget,
217++ GdkEventFocus *event);
218+ static gboolean terminal_screen_do_exec (TerminalScreen *screen,
219+ FDSetupData *data,
220+ GError **error);
221+ static void terminal_screen_child_exited (VteTerminal *terminal,
222+ int status);
223++static void terminal_screen_notification_received (VteTerminal *terminal,
224++ const char *summary,
225++ const char *body);
226+
227+ static void terminal_screen_window_title_changed (VteTerminal *vte_terminal,
228+ TerminalScreen *screen);
229+@@ -485,6 +492,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
230+ object_class->get_property = terminal_screen_get_property;
231+ object_class->set_property = terminal_screen_set_property;
232+
233++ widget_class->focus_in_event = terminal_screen_focus_in;
234+ widget_class->realize = terminal_screen_realize;
235+ widget_class->style_updated = terminal_screen_style_updated;
236+ widget_class->drag_data_received = terminal_screen_drag_data_received;
237+@@ -493,6 +501,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
238+ widget_class->hierarchy_changed = terminal_screen_hierarchy_changed;
239+
240+ terminal_class->child_exited = terminal_screen_child_exited;
241++ terminal_class->notification_received = terminal_screen_notification_received;
242+
243+ signals[PROFILE_SET] =
244+ g_signal_new (I_("profile-set"),
245+@@ -602,6 +611,10 @@ terminal_screen_dispose (GObject *object)
246+ TerminalScreen *screen = TERMINAL_SCREEN (object);
247+ TerminalScreenPrivate *priv = screen->priv;
248+ GtkSettings *settings;
249++ TerminalApp *app;
250++
251++ app = terminal_app_get ();
252++ g_application_withdraw_notification (G_APPLICATION (app), priv->uuid);
253+
254+ settings = gtk_widget_get_settings (GTK_WIDGET (screen));
255+ g_signal_handlers_disconnect_matched (settings, G_SIGNAL_MATCH_DATA,
256+@@ -1707,6 +1720,43 @@ terminal_screen_button_press (GtkWidget *widget,
257+ return FALSE;
258+ }
259+
260++static gboolean
261++terminal_screen_focus_in (GtkWidget *widget,
262++ GdkEventFocus *event)
263++{
264++ TerminalScreen *screen = TERMINAL_SCREEN (widget);
265++ TerminalApp *app;
266++ TerminalWindow *window;
267++
268++ window = terminal_screen_get_window (screen);
269++ if (window != NULL)
270++ {
271++ TerminalScreenContainer *screen_container;
272++
273++ screen_container = terminal_screen_container_get_from_screen (screen);
274++ if (screen_container != NULL)
275++ {
276++ GtkWidget *mdi_container;
277++
278++ mdi_container = terminal_window_get_mdi_container (window);
279++ /* FIXME: add interface method to retrieve tab label */
280++ if (GTK_IS_NOTEBOOK (mdi_container))
281++ {
282++ GtkWidget *tab_label;
283++
284++ tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (mdi_container), GTK_WIDGET (screen_container));
285++ terminal_tab_label_set_bold (TERMINAL_TAB_LABEL (tab_label), FALSE);
286++ terminal_tab_label_set_icon (TERMINAL_TAB_LABEL (tab_label), NULL, NULL);
287++ }
288++ }
289++ }
290++
291++ app = terminal_app_get ();
292++ g_application_withdraw_notification (G_APPLICATION (app), screen->priv->uuid);
293++
294++ return GTK_WIDGET_CLASS (terminal_screen_parent_class)->focus_in_event (widget, event);
295++}
296++
297+ /**
298+ * terminal_screen_get_current_dir:
299+ * @screen:
300+@@ -1807,6 +1857,64 @@ terminal_screen_child_exited (VteTerminal *terminal,
301+ }
302+ }
303+
304++static void
305++terminal_screen_notification_received (VteTerminal *terminal,
306++ const char *summary,
307++ const char *body)
308++{
309++ TerminalScreen *screen = TERMINAL_SCREEN (terminal);
310++ TerminalScreenPrivate *priv = screen->priv;
311++ TerminalWindow *window;
312++
313++ if (G_UNLIKELY (!priv->shell_prompt_shown))
314++ {
315++ priv->shell_prompt_shown = TRUE;
316++ return;
317++ }
318++
319++ window = terminal_screen_get_window (screen);
320++ if (window == NULL)
321++ return;
322++
323++ if (gtk_window_is_active (GTK_WINDOW (window)))
324++ {
325++ GtkWidget *mdi_container;
326++ TerminalScreenContainer *screen_container;
327++
328++ if (screen == terminal_window_get_active (window))
329++ return;
330++
331++ screen_container = terminal_screen_container_get_from_screen (screen);
332++ if (screen_container == NULL)
333++ return;
334++
335++ mdi_container = terminal_window_get_mdi_container (window);
336++ /* FIXME: add interface method to retrieve tab label */
337++ if (GTK_IS_NOTEBOOK (mdi_container))
338++ {
339++ GtkWidget *tab_label;
340++
341++ tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (mdi_container), GTK_WIDGET (screen_container));
342++ terminal_tab_label_set_bold (TERMINAL_TAB_LABEL (tab_label), TRUE);
343++ terminal_tab_label_set_icon (TERMINAL_TAB_LABEL (tab_label), "dialog-information-symbolic", summary);
344++ }
345++ }
346++ else
347++ {
348++ gs_unref_object GNotification *notification = NULL;
349++ TerminalApp *app;
350++ gs_free char *detailed_action = NULL;
351++
352++ notification = g_notification_new (summary);
353++ g_notification_set_body (notification, body);
354++ detailed_action = g_strdup_printf ("app.activate-tab::%s", priv->uuid);
355++ g_notification_set_default_action (notification, detailed_action);
356++
357++ app = terminal_app_get ();
358++ g_application_send_notification (G_APPLICATION (app), priv->uuid, notification);
359++ }
360++}
361++
362+ static void
363+ terminal_screen_drag_data_received (GtkWidget *widget,
364+ GdkDragContext *context,
365+diff --git a/src/terminal-tab-label.c b/src/terminal-tab-label.c
366+index cdd73d0653be..d6909a13ca65 100644
367+--- a/src/terminal-tab-label.c
368++++ b/src/terminal-tab-label.c
369+@@ -34,6 +34,7 @@
370+ struct _TerminalTabLabelPrivate
371+ {
372+ TerminalScreen *screen;
373++ GtkWidget *icon;
374+ GtkWidget *label;
375+ GtkWidget *close_button;
376+ gboolean bold;
377+@@ -179,7 +180,7 @@ terminal_tab_label_constructed (GObject *object)
378+ {
379+ TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
380+ TerminalTabLabelPrivate *priv = tab_label->priv;
381+- GtkWidget *hbox, *label, *close_button;
382++ GtkWidget *hbox, *icon, *label, *close_button;
383+
384+ G_OBJECT_CLASS (terminal_tab_label_parent_class)->constructed (object);
385+
386+@@ -189,6 +190,10 @@ terminal_tab_label_constructed (GObject *object)
387+
388+ gtk_box_set_spacing (GTK_BOX (hbox), SPACING);
389+
390++ priv->icon = icon = gtk_image_new ();
391++ gtk_widget_set_no_show_all (icon, TRUE);
392++ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
393++
394+ priv->label = label = gtk_label_new (NULL);
395+ gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
396+ gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
397+@@ -376,6 +381,27 @@ terminal_tab_label_set_bold (TerminalTabLabel *tab_label,
398+ pango_attr_list_unref (attr_list);
399+ }
400+
401++/**
402++ * terminal_tab_label_set_icon:
403++ * @tab_label: a #TerminalTabLabel
404++ * @icon_name: (allow-none): an icon name
405++ * @tooltip: (allow-none): text to be used as tooltip
406++ *
407++ * Shows an icon at the beginning of @tab_label. If @icon_name is
408++ * %NULL, then the icon will be hidden.
409++ */
410++void
411++terminal_tab_label_set_icon (TerminalTabLabel *tab_label,
412++ const char *icon_name,
413++ const char *tooltip)
414++{
415++ TerminalTabLabelPrivate *priv = tab_label->priv;
416++
417++ gtk_widget_set_visible (priv->icon, icon_name != NULL);
418++ gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon), icon_name, GTK_ICON_SIZE_MENU);
419++ gtk_widget_set_tooltip_text (GTK_WIDGET (priv->icon), tooltip);
420++}
421++
422+ /**
423+ * terminal_tab_label_get_screen:
424+ * @tab_label: a #TerminalTabLabel
425+diff --git a/src/terminal-tab-label.h b/src/terminal-tab-label.h
426+index 20cfbceb36b0..a987025e0524 100644
427+--- a/src/terminal-tab-label.h
428++++ b/src/terminal-tab-label.h
429+@@ -59,6 +59,10 @@ GtkWidget * terminal_tab_label_new (TerminalScreen *screen);
430+ void terminal_tab_label_set_bold (TerminalTabLabel *tab_label,
431+ gboolean bold);
432+
433++void terminal_tab_label_set_icon (TerminalTabLabel *tab_label,
434++ const char *icon_name,
435++ const char *tooltip);
436++
437+ TerminalScreen *terminal_tab_label_get_screen (TerminalTabLabel *tab_label);
438+
439+ G_END_DECLS
440+--
441
442=== modified file 'debian/patches/series'
443--- debian/patches/series 2017-07-13 15:05:17 +0000
444+++ debian/patches/series 2018-01-15 15:00:04 +0000
445@@ -11,3 +11,5 @@
446 scrollbar-background-theming.patch
447 Provide-fallback-for-reading-current-directory-if-OS.patch
448 revert-pcre2.patch
449+command-notify.patch
450+command-notify-debug.patch

Subscribers

People subscribed via source and target branches

to all changes: