diff options
author | Mason Larobina <mason.larobina@gmail.com> | 2009-10-27 03:59:10 +0800 |
---|---|---|
committer | Mason Larobina <mason.larobina@gmail.com> | 2009-10-27 03:59:10 +0800 |
commit | a20a442bd3f486955d124ed3a664e24fa0dacbce (patch) | |
tree | c8d59f318fc085bf6d855b1d13ef168f1f5e7d48 /examples/data/uzbl/scripts | |
parent | 01d254637ee0f49f797b15f65d99325405fa580b (diff) |
Added --auto-close option to the event manager.
Diffstat (limited to 'examples/data/uzbl/scripts')
-rwxr-xr-x | examples/data/uzbl/scripts/event_manager.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/examples/data/uzbl/scripts/event_manager.py b/examples/data/uzbl/scripts/event_manager.py index aaf3295..9c269c7 100755 --- a/examples/data/uzbl/scripts/event_manager.py +++ b/examples/data/uzbl/scripts/event_manager.py @@ -71,6 +71,7 @@ CACHE_DIR = os.path.join(xdghome('CACHE', '.cache/'), 'uzbl/') config = { 'verbose': False, 'daemon_mode': True, + 'auto_close': False, 'plugins_load': [], 'plugins_ignore': [], @@ -664,16 +665,18 @@ class UzblEventDaemon(dict): '''Clean up after instance close.''' try: - if client not in self['uzbls']: - return - - uzbl = self['uzbls'][client] - uzbl.close() - del self['uzbls'][client] + if client in self['uzbls']: + uzbl = self['uzbls'][client] + uzbl.close() + del self['uzbls'][client] except: print_exc() + if not len(self['uzbls']) and config['auto_close']: + echo('auto closing event manager.') + self.running = False + def quit(self): '''Close all instance socket objects, server socket and delete the @@ -783,6 +786,9 @@ if __name__ == "__main__": parser.add_option('-n', '--no-daemon', dest="daemon", action="store_true", help="don't enter daemon mode.") + parser.add_option('-a', '--auto-close', dest='autoclose', + action='store_true', help='auto close after all instances disconnect.') + (options, args) = parser.parse_args() # init like {start|stop|..} daemon control section. @@ -831,6 +837,10 @@ if __name__ == "__main__": echo('ignoring plugin(s): %s' % ', '.join(plugins_ignore)) + if options.autoclose: + config['auto_close'] = True + echo('will auto close.') + if options.pid: config['pid_file'] = options.pid echo("pid file location: %r" % config['pid_file']) |