aboutsummaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-06 17:03:07 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-06 17:03:07 +0200
commit12c0122d3f2dfb65e3c50635c0f1e00d482bfcc1 (patch)
treeedd996b1d356a37ae73a47a7ef37165cf38a8f60 /src/__main__.py
parentadd missing path for nightshiftrc (diff)
downloadnightshift-12c0122d3f2dfb65e3c50635c0f1e00d482bfcc1.tar.gz
nightshift-12c0122d3f2dfb65e3c50635c0f1e00d482bfcc1.tar.bz2
nightshift-12c0122d3f2dfb65e3c50635c0f1e00d482bfcc1.tar.xz
do not allow toggling while dying + change button text to 'Kill immediately' if redshift is already dying0.5
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/__main__.py')
-rwxr-xr-xsrc/__main__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 5e452df..0cd3aef 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -258,7 +258,7 @@ The pathname of the interprocess communication socket for nightshift
red_brightness, red_temperature = 1, 6500
red_brightnesses, red_temperatures = (1, 1), (5500, 3500)
red_period, red_location = 1, (0, 0)
-red_status, red_running = True, True
+red_status, red_running, red_dying = True, True, False
red_condition = None
@@ -349,6 +349,7 @@ def generate_status_message():
message += 'Longitude: %f\n' % red_location[1]
message += 'Enabled: %s\n' % ('yes' if red_status else 'no')
message += 'Running: %s\n' % ('yes' if red_running else 'no')
+ message += 'Dying: %s\n' % ('yes' if red_dying else 'no')
return message
@@ -359,6 +360,7 @@ def use_client(sock, proc):
@param sock:socket The socket connected to the client
@param proc:Popen The redshift process
'''
+ global red_dying
buf = ''
closed = False
while not closed:
@@ -380,6 +382,7 @@ def use_client(sock, proc):
elif message == 'toggle':
proc.send_signal(signal.SIGUSR1)
elif message == 'kill':
+ red_dying = True
proc.terminate()
import time
time.sleep(0.05) # XXX sometimes redshift is too slow