diff options
author | Michael Göhler | 2015-06-08 11:12:47 +0200 |
---|---|---|
committer | Michael Göhler | 2015-06-08 11:24:11 +0200 |
commit | e2efc1db1d78c4e7fb151548cf34f0305799f0ca (patch) | |
tree | 2b76893ba8fa5bb486b819aec88da9a5659a881c /chrome-shutdown-hook.py | |
download | aur-e2efc1db1d78c4e7fb151548cf34f0305799f0ca.tar.gz |
initial submission to aur4
Diffstat (limited to 'chrome-shutdown-hook.py')
-rw-r--r-- | chrome-shutdown-hook.py | 32 |
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: |