summarylogtreecommitdiffstats
path: root/chrome-shutdown-hook.py
diff options
context:
space:
mode:
authorMichael Göhler2015-06-08 11:12:47 +0200
committerMichael Göhler2015-06-08 11:24:11 +0200
commite2efc1db1d78c4e7fb151548cf34f0305799f0ca (patch)
tree2b76893ba8fa5bb486b819aec88da9a5659a881c /chrome-shutdown-hook.py
downloadaur-e2efc1db1d78c4e7fb151548cf34f0305799f0ca.tar.gz
initial submission to aur4
Diffstat (limited to 'chrome-shutdown-hook.py')
-rw-r--r--chrome-shutdown-hook.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome-shutdown-hook.py b/chrome-shutdown-hook.py
new file mode 100644
index 000000000000..58cf6bc7be97
--- /dev/null
+++ b/chrome-shutdown-hook.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python2
+
+# Author: Michael Goehler
+# Description: Gently shutdown Chrome on logout from Gnome Shell.
+#
+# Based on a script by Seamus Phelan
+# http://unix.stackexchange.com/questions/49333/
+
+import sys
+import subprocess
+import datetime
+import gnome
+import gnome.ui
+import gtk
+
+class Namespace: pass
+ns = Namespace()
+ns.dialog = None
+
+def main():
+ prog = gnome.init("chrome_clean_shutdown", "1.0", gnome.libgnome_module_info_get(), sys.argv, [])
+ client = gnome.ui.master_client()
+ client.connect("save-yourself", chrome_clean_shutdown)
+
+def chrome_clean_shutdown(*args):
+ subprocess.call("/usr/bin/pkill -15 -P 1 chrome", shell=True)
+ return True
+
+main()
+gtk.main()
+
+# vim: set ts=4 sw=4 et: