diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-26 13:16:57 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-26 13:16:57 +0200 |
commit | 9de9d3a5263148534f6b230df922ac256e4b2b40 (patch) | |
tree | 796c29af991dc798e2d2fc3b06228ad94f099e2c /src/__main__.py | |
parent | bump version (diff) | |
download | nightshift-9de9d3a5263148534f6b230df922ac256e4b2b40.tar.gz nightshift-9de9d3a5263148534f6b230df922ac256e4b2b40.tar.bz2 nightshift-9de9d3a5263148534f6b230df922ac256e4b2b40.tar.xz |
add x-window-focus
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/__main__.py')
-rwxr-xr-x | src/__main__.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/__main__.py b/src/__main__.py index 09a345b..ee55217 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -194,9 +194,9 @@ for arg in sys.argv[1:]: for arg in subargs: if (add_to_red_opts is None) or add_to_red_opts: add_to_red_opts = None - red_arg += arg[1] + red_arg += arg elif isinstance(config_file, list): - config_file.append(arg[1]) + config_file.append(arg) elif arg in ('-d', '--daemon'): daemon = 1 elif arg in ('+d', '++daemon'): daemon = 2 elif arg in ('-x', '--reset', '--kill'): kill += 1 @@ -218,8 +218,11 @@ for arg in sys.argv[1:]: if add_to_red_opts is None: red_opts.append(red_arg) add_to_red_opts = False - if isinstance(config_file, list): + if isinstance(config_file, list) and (len(config_file) > 0): config_file = ''.join(config_file) +if isinstance(config_file, list): + sys.stderr.write('%s: error: premature end of arguments\n' % sys.argv[0]) + sys.exit(1) # Parse help request for -l and -m @@ -400,6 +403,16 @@ def use_client(sock, proc): sock.close() +def start_daemon_threads(proc, sock): + ''' + Start the threads for the daemon + + @param sock:socket The server socket + @param proc:Popen The redshift process + ''' + pass + + def run_as_daemon(sock): ''' Perform daemon logic @@ -417,6 +430,8 @@ def run_as_daemon(sock): command += red_args proc = Popen(command, stdout = PIPE, stderr = open(os.devnull)) + start_daemon_threads(proc, sock) + # Read status from redshift thread = threading.Thread(target = read_status, args = (proc, sock)) thread.setDaemon(True) |