summarylogtreecommitdiffstats
path: root/chrome-shutdown-hook.py
blob: 543754054afdba6dd988c4be8b0f86528ed7630b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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

def chrome_clean_shutdown(*args):
    subprocess.call("/usr/bin/pkill -15 -P 1 chrome", shell=True)
    return True

def main():
    prog = gnome.init("chrome_clean_shutdown", "1.1")
    client = gnome.ui.master_client()
    client.connect("save-yourself", chrome_clean_shutdown)

main()
gtk.main()

# vim: set ts=4 sw=4 et: