diff options
author | Rob <rob.manea@gmail.com> | 2009-10-27 00:11:39 +0100 |
---|---|---|
committer | Rob <rob.manea@gmail.com> | 2009-10-27 00:11:39 +0100 |
commit | 9d7ae1b21aefac2cf5418667bd150c110bf8932e (patch) | |
tree | c9dd626c1e9a16dc81ffa1f138d56d8320c68d1d /examples | |
parent | 9fd31dd90cce684ca91e97137d902806af1f59f9 (diff) | |
parent | 7dd0b2b4ce792274d6e2e0e8b1059b510a6e7caf (diff) |
Merge branch 'experimental' of git://github.com/Dieterbe/uzbl into experimental
Diffstat (limited to 'examples')
-rw-r--r-- | examples/data/uzbl/plugins/keycmd.py | 1 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/event_manager.py | 31 |
2 files changed, 24 insertions, 8 deletions
diff --git a/examples/data/uzbl/plugins/keycmd.py b/examples/data/uzbl/plugins/keycmd.py index 9696521..d01d2ac 100644 --- a/examples/data/uzbl/plugins/keycmd.py +++ b/examples/data/uzbl/plugins/keycmd.py @@ -249,7 +249,6 @@ def key_press(uzbl, key): k = get_keylet(uzbl) key = k.key_modmap(key.strip()) - print 'KEY', key if key.startswith("ISO_"): return diff --git a/examples/data/uzbl/scripts/event_manager.py b/examples/data/uzbl/scripts/event_manager.py index 391fb84..9c269c7 100755 --- a/examples/data/uzbl/scripts/event_manager.py +++ b/examples/data/uzbl/scripts/event_manager.py @@ -45,6 +45,12 @@ from traceback import print_exc # ::: Default configuration section :::::::::::::::::::::::::::::::::::::::::: # ============================================================================ +# Automagically set during `make install` +PREFIX = None + +# Check if PREFIX not set and set to default /usr/local/ +if not PREFIX: + PREFIX = '/usr/local/' def xdghome(key, default): '''Attempts to use the environ XDG_*_HOME paths if they exist otherwise @@ -60,16 +66,18 @@ def xdghome(key, default): DATA_DIR = os.path.join(xdghome('DATA', '.local/share/'), 'uzbl/') CACHE_DIR = os.path.join(xdghome('CACHE', '.cache/'), 'uzbl/') + # Config dict (NOT the same as the uzbl.config). config = { 'verbose': False, 'daemon_mode': True, + 'auto_close': False, 'plugins_load': [], 'plugins_ignore': [], 'plugin_dirs': [os.path.join(DATA_DIR, 'plugins/'), - '/usr/local/share/uzbl/examples/data/uzbl/plugins/'], + os.path.join(PREFIX, 'share/uzbl/examples/data/uzbl/plugins/')], 'server_socket': os.path.join(CACHE_DIR, 'event_daemon'), 'pid_file': os.path.join(CACHE_DIR, 'event_daemon.pid'), @@ -657,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 @@ -776,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. @@ -824,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']) |