--- 3419.good/configure.ac 2009-05-15 14:37:56.000000000 +1000
+++ 3419.hack/configure.ac 2009-05-15 15:44:56.000000000 +1000
@@ -41,6 +41,7 @@
STARTUP_NOTIFICATION_REQUIRED=0.8
DBUS_GLIB_REQUIRED=0.6
VTE_REQUIRED=0.20.0
+LIBNOTIFY_REQUIRED=0.4.4
PKG_CHECK_MODULES([TERM],
[vte >= $VTE_REQUIRED
@@ -50,7 +51,8 @@
gtk+-2.0 >= $GTK_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
- libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_REQUIRED])
+ libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_REQUIRED
+ libnotify >= $LIBNOTIFY_REQUIRED])
# Check the smclient backend
GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
--- 3419.good/help/C/gnome-terminal.xml 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/help/C/gnome-terminal.xml 2009-05-15 15:03:09.000000000 +1000
@@ -860,6 +860,26 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term>
+ <guilabel>Show a desktop notification when the terminal rings the belll</guilabel> </term>
+ <listitem>
+ <para>
+ Select this option to display a popup notification when the terminal rings the bell.
+ The notification text will be the window's title.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <guilabel>Show a desktop notification on bell even if I'm working in that tab</guilabel> </term>
+ <listitem>
+ <para>
+ Select this option to make the above option apply even if the tab is focused
+ (or if the window is focused if there are no tabs).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>
<guilabel>Select-by-word characters</guilabel> </term>
<listitem>
--- 3419.good/src/terminal-profile.c 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/terminal-profile.c 2009-05-15 15:04:22.000000000 +1000
@@ -82,6 +82,8 @@
PROP_WORD_CHARS,
PROP_HIGHLIGHT_ON_BELL,
PROP_HIGHLIGHT_FOCUSED_ON_BELL,
+ PROP_NOTIFY_ON_BELL,
+ PROP_NOTIFY_FOCUSED_ON_BELL,
LAST_PROP
};
@@ -102,6 +104,8 @@
#define KEY_HIGHLIGHT_ON_BELL "highlight_on_bell"
#define KEY_HIGHLIGHT_FOCUSED_ON_BELL "highlight_focused_on_bell_focused"
#define KEY_LOGIN_SHELL "login_shell"
+#define KEY_NOTIFY_ON_BELL "notify_on_bell"
+#define KEY_NOTIFY_FOCUSED_ON_BELL "notify_focused_on_bell_focused"
#define KEY_PALETTE "palette"
#define KEY_SCROLL_BACKGROUND "scroll_background"
#define KEY_SCROLLBACK_LINES "scrollback_lines"
@@ -139,6 +143,8 @@
#define DEFAULT_HIGHLIGHT_FOCUSED_ON_BELL (FALSE)
#define DEFAULT_LOGIN_SHELL (FALSE)
#define DEFAULT_NAME (NULL)
+#define DEFAULT_NOTIFY_ON_BELL (FALSE)
+#define DEFAULT_NOTIFY_FOCUSED_ON_BELL (FALSE)
#define DEFAULT_PALETTE (terminal_palettes[TERMINAL_PALETTE_TANGO])
#define DEFAULT_SCROLL_BACKGROUND (TRUE)
#define DEFAULT_SCROLLBACK_LINES (512)
@@ -1295,6 +1301,8 @@
TERMINAL_PROFILE_PROPERTY_BOOLEAN (HIGHLIGHT_ON_BELL, DEFAULT_HIGHLIGHT_ON_BELL, KEY_HIGHLIGHT_ON_BELL);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (HIGHLIGHT_FOCUSED_ON_BELL, DEFAULT_HIGHLIGHT_FOCUSED_ON_BELL, KEY_HIGHLIGHT_FOCUSED_ON_BELL);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL);
+ TERMINAL_PROFILE_PROPERTY_BOOLEAN (NOTIFY_ON_BELL, DEFAULT_NOTIFY_ON_BELL, KEY_NOTIFY_ON_BELL);
+ TERMINAL_PROFILE_PROPERTY_BOOLEAN (NOTIFY_FOCUSED_ON_BELL, DEFAULT_NOTIFY_FOCUSED_ON_BELL, KEY_NOTIFY_FOCUSED_ON_BELL);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT);
--- 3419.good/src/profile-preferences.glade 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/profile-preferences.glade 2009-05-15 15:07:29.000000000 +1000
@@ -294,7 +294,7 @@
<widget class="GtkCheckButton" id="highlightonbell-checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Flash window _icon and bold tab title on bell</property>
+ <property name="label" translatable="yes">Flash the window list _icon and bold the tab title when the terminal rings the bell</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -329,6 +329,44 @@
</child>
<child>
+ <widget class="GtkCheckButton" id="notifyonbell-checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show a desktop notification when the terminal rings the bell</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="notifyfocusedonbell-checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">..._even if I am working in that tab and window</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkHBox" id="hbox140">
<property name="visible">True</property>
<property name="homogeneous">False</property>
--- 3419.good/src/terminal-profile.h 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/terminal-profile.h 2009-05-15 15:03:41.000000000 +1000
@@ -84,6 +84,8 @@
#define TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL "highlight-focused-on-bell"
#define TERMINAL_PROFILE_LOGIN_SHELL "login-shell"
#define TERMINAL_PROFILE_NAME "name"
+#define TERMINAL_PROFILE_NOTIFY_ON_BELL "notify-on-bell"
+#define TERMINAL_PROFILE_NOTIFY_FOCUSED_ON_BELL "notify-focused-on-bell"
#define TERMINAL_PROFILE_PALETTE "palette"
#define TERMINAL_PROFILE_SCROLL_BACKGROUND "scroll-background"
#define TERMINAL_PROFILE_SCROLLBACK_LINES "scrollback-lines"
--- 3419.good/src/terminal-window.c 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/terminal-window.c 2009-05-15 14:07:10.000000000 +1000
@@ -25,6 +25,7 @@
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <libsn/sn-launchee.h>
+#include <libnotify/notify.h>
#include "skey-popup.h"
#include "terminal-accels.h"
@@ -1363,20 +1364,21 @@
if (should_highlight)
{
- gboolean has_toplevel_focus;
gboolean highlight_focused;
+ gboolean has_toplevel_focus;
g_object_get (window,
"has-toplevel-focus", &has_toplevel_focus,
NULL);
highlight_focused = terminal_profile_get_property_boolean (
- terminal_screen_get_profile (screen),
- TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
+ terminal_screen_get_profile (screen),
+ TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
if (!has_toplevel_focus || highlight_focused)
gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE);
}
+
}
else
{
--- 3419.good/src/profile-editor.c 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/profile-editor.c 2009-05-15 14:58:43.000000000 +1000
@@ -225,6 +225,14 @@
SET_SENSITIVE ("highlightfocusedonbell-checkbutton",
!terminal_profile_property_locked (profile, TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL));
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_NOTIFY_ON_BELL))
+ SET_SENSITIVE ("notifyonbell-checkbutton",
+ !terminal_profile_property_locked (profile, TERMINAL_PROFILE_NOTIFY_ON_BELL));
+
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_NOTIFY_FOCUSED_ON_BELL))
+ SET_SENSITIVE ("notifyfocusedonbell-checkbutton",
+ !terminal_profile_property_locked (profile, TERMINAL_PROFILE_NOTIFY_FOCUSED_ON_BELL));
+
if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
SET_SENSITIVE ("word-chars-entry",
!terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS));
@@ -824,6 +832,8 @@
CONNECT ("highlightfocusedonbell-checkbutton", TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
CONNECT ("image-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
CONNECT ("login-shell-checkbutton", TERMINAL_PROFILE_LOGIN_SHELL);
+ CONNECT ("notifyonbell-checkbutton", TERMINAL_PROFILE_NOTIFY_ON_BELL);
+ CONNECT ("notifyfocusedonbell-checkbutton", TERMINAL_PROFILE_NOTIFY_FOCUSED_ON_BELL);
CONNECT ("profile-name-entry", TERMINAL_PROFILE_VISIBLE_NAME);
CONNECT ("scroll-background-checkbutton", TERMINAL_PROFILE_SCROLL_BACKGROUND);
CONNECT ("scrollbar-position-combobox", TERMINAL_PROFILE_SCROLLBAR_POSITION);
--- 3419.good/src/terminal-screen.c 2009-05-15 14:45:38.000000000 +1000
+++ 3419.hack/src/terminal-screen.c 2009-05-15 15:06:11.000000000 +1000
@@ -32,6 +32,8 @@
#include <gconf/gconf.h>
+#include <libnotify/notify.h>
+
#include "terminal-accels.h"
#include "terminal-app.h"
#include "terminal-debug.h"
@@ -698,7 +700,53 @@
gboolean
terminal_screen_beep_cb (TerminalScreen *screen)
{
+ gboolean should_notify;
+
g_object_set (screen, "bell-raised", TRUE, NULL);
+
+ should_notify = terminal_profile_get_property_boolean (
+ terminal_screen_get_profile (screen),
+ TERMINAL_PROFILE_NOTIFY_ON_BELL);
+
+ if (should_notify)
+ {
+ gboolean screen_has_focus;
+ gboolean notify_focused;
+
+ g_object_get (screen, "has-focus", &screen_has_focus, NULL);
+ notify_focused = terminal_profile_get_property_boolean (
+ terminal_screen_get_profile (screen),
+ TERMINAL_PROFILE_NOTIFY_FOCUSED_ON_BELL);
+ if (!screen_has_focus || notify_focused)
+ {
+ if (notify_init("gnome-terminal"))
+ {
+ NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
+ glong expire_timeout = NOTIFY_EXPIRES_DEFAULT;
+ const gchar *type = NULL;
+ gboolean hint_error = FALSE;
+ NotifyNotification *notify;
+
+ gchar *summary = "Terminal";
+ /* raw_title so we don't include the - Terminal or whatever */
+ gchar *body = (gchar *) terminal_screen_get_raw_title (screen);
+ gchar *icon = NULL;
+
+ notify = notify_notification_new(summary, body, icon, NULL);
+ if (notify != NULL)
+ {
+ notify_notification_set_category(notify, type);
+ notify_notification_set_urgency(notify, urgency);
+ notify_notification_set_timeout(notify, expire_timeout);
+ notify_notification_show(notify, NULL);
+ g_object_unref(G_OBJECT(notify));
+ }
+
+ notify_uninit();
+ }
+ }
+ }
+
return FALSE;
}