From 33483bfe5b1a4b30a827162a481e8eff5b33e0e0 Mon Sep 17 00:00:00 2001 From: vit Date: Thu, 19 May 2016 20:05:16 +0800 Subject: [PATCH] check_delay and after_exec_delay in config --- Azot/action.py | 4 ++-- Azot/config.py | 6 ++++++ README.md | 1 + config.sample.json | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Azot/action.py b/Azot/action.py index eff0f98..ca07d25 100644 --- a/Azot/action.py +++ b/Azot/action.py @@ -18,7 +18,7 @@ def do(): def task_exec(): msg = type_exec(action) notify(msg) - sleep(1) + sleep(config['after_exec_delay']) position = get_cursor_position() for action in config['actions']: @@ -40,7 +40,7 @@ def do(): elif action['corner'] == 'left' or action['corner'] == 'right': if position['x'] == corners[ action['corner'] ] and position['y'] > config['corners']['middle_y_start'] and position['y'] < config['corners']['middle_y_end']: task_exec() - sleep(0.3) + sleep(config['check_delay']) # Detect type and execute diff --git a/Azot/config.py b/Azot/config.py index 63d1d25..c3ec683 100644 --- a/Azot/config.py +++ b/Azot/config.py @@ -37,6 +37,12 @@ def load(): config = ast.literal_eval(config) config['corners'] = get_middle_areas() + if not 'check_delay' in config.keys(): + config['check_delay'] = 0.3 + + if not 'after_exec_delay' in config.keys(): + config['after_exec_delay'] = 1 + return config diff --git a/README.md b/README.md index ca44451..ced374f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ By default it's stored in ~/.config/azot/config.json * command: command to execute * corner: Screen corner 'left', 'right', 'top', 'bottom' * position: 'left', 'right', 'middle' +* check_delay and after_exec_delay are set in seconds ### Depends diff --git a/config.sample.json b/config.sample.json index 1430b75..e650d5b 100644 --- a/config.sample.json +++ b/config.sample.json @@ -18,5 +18,7 @@ 'type': 'exec', 'command': 'scrot' } - ] + ], + 'check_delay': 0.3, + 'after_exec_delay': 1 }