Kill notification-daemon at startup when running in --replace mode
https://bugzilla.gnome.org/show_bug.cgi?id=606755
This commit is contained in:
parent
803a204604
commit
8fc9d0c8ba
@ -57,18 +57,40 @@ NotificationDaemon.prototype = {
|
|||||||
_init: function() {
|
_init: function() {
|
||||||
DBus.session.exportObject('/org/freedesktop/Notifications', this);
|
DBus.session.exportObject('/org/freedesktop/Notifications', this);
|
||||||
|
|
||||||
let acquiredName = false;
|
this._everAcquiredName = false;
|
||||||
DBus.session.acquire_name('org.freedesktop.Notifications', DBus.SINGLE_INSTANCE,
|
DBus.session.acquire_name('org.freedesktop.Notifications',
|
||||||
function(name) {
|
// We pass MANY_INSTANCES so that if
|
||||||
log("Acquired name " + name);
|
// notification-daemon is running, we'll
|
||||||
acquiredName = true;
|
// get queued behind it and then get the
|
||||||
},
|
// name after killing it below
|
||||||
function(name) {
|
DBus.MANY_INSTANCES,
|
||||||
if (acquiredName)
|
Lang.bind(this, this._acquiredName),
|
||||||
log("Lost name " + name);
|
Lang.bind(this, this._lostName));
|
||||||
else
|
},
|
||||||
log("Could not get name " + name);
|
|
||||||
});
|
_acquiredName: function() {
|
||||||
|
this._everAcquiredName = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
_lostName: function() {
|
||||||
|
if (this._everAcquiredName)
|
||||||
|
log('Lost name org.freedesktop.Notifications!');
|
||||||
|
else if (GLib.getenv('GNOME_SHELL_NO_REPLACE'))
|
||||||
|
log('Failed to acquire org.freedesktop.Notifications');
|
||||||
|
else {
|
||||||
|
log('Failed to acquire org.freedesktop.Notifications; trying again');
|
||||||
|
|
||||||
|
// kill the notification-daemon. pkill is more portable
|
||||||
|
// than killall, but on Linux at least it won't match if
|
||||||
|
// you pass more than 15 characters of the process name...
|
||||||
|
// However, if you use the "-f" flag to match the entire
|
||||||
|
// command line, it will work, but we have to be careful
|
||||||
|
// in that case that we don't match "gedit
|
||||||
|
// notification-daemon.c" or whatever...
|
||||||
|
let p = new Shell.Process({ args: ['pkill', '-f',
|
||||||
|
'^([^ ]*/)?(notification-daemon|notify-osd)$']});
|
||||||
|
p.run();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_sourceId: function(id) {
|
_sourceId: function(id) {
|
||||||
|
5
src/gnome-shell.in
Normal file → Executable file
5
src/gnome-shell.in
Normal file → Executable file
@ -357,8 +357,9 @@ try:
|
|||||||
shell = None
|
shell = None
|
||||||
if options.xephyr:
|
if options.xephyr:
|
||||||
xephyr = start_xephyr()
|
xephyr = start_xephyr()
|
||||||
# This makes us not grab the org.gnome.Panel name
|
# This makes us not grab the org.gnome.Panel or
|
||||||
os.environ['GNOME_SHELL_NO_REPLACE_PANEL'] = '1'
|
# org.freedesktop.Notifications D-Bus names
|
||||||
|
os.environ['GNOME_SHELL_NO_REPLACE'] = '1'
|
||||||
shell = start_shell()
|
shell = start_shell()
|
||||||
else:
|
else:
|
||||||
xephyr = None
|
xephyr = None
|
||||||
|
@ -751,7 +751,7 @@ shell_global_grab_dbus_service (ShellGlobal *global)
|
|||||||
* unless a special environment variable is passed. The environment
|
* unless a special environment variable is passed. The environment
|
||||||
* variable is used by the gnome-shell (no --replace) launcher in
|
* variable is used by the gnome-shell (no --replace) launcher in
|
||||||
* Xephyr */
|
* Xephyr */
|
||||||
if (!g_getenv ("GNOME_SHELL_NO_REPLACE_PANEL"))
|
if (!g_getenv ("GNOME_SHELL_NO_REPLACE"))
|
||||||
{
|
{
|
||||||
if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING,
|
if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING,
|
||||||
"org.gnome.Panel", G_TYPE_UINT,
|
"org.gnome.Panel", G_TYPE_UINT,
|
||||||
|
Loading…
Reference in New Issue
Block a user