diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-28 05:12:02 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-28 05:12:02 +0100 |
commit | e5d0d3bea8bddaf468b0692e58aec82b5c04285b (patch) | |
tree | f7106bd8a7a3d0dad3a70f2556d7132ae329108c /src/__main__.py | |
parent | typo (diff) | |
download | blueshift-e5d0d3bea8bddaf468b0692e58aec82b5c04285b.tar.gz blueshift-e5d0d3bea8bddaf468b0692e58aec82b5c04285b.tar.bz2 blueshift-e5d0d3bea8bddaf468b0692e58aec82b5c04285b.tar.xz |
set process title
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/__main__.py')
-rwxr-xr-x | src/__main__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/__main__.py b/src/__main__.py index 6490652..287a142 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -29,6 +29,29 @@ PROGRAM_NAME = 'blueshift' PROGRAM_VERSION = '1.15' +## Set process title +def setproctitle(title): + ''' + Set process title + + @param title:str The title of the process + ''' + import ctypes + try: + title = title.encode(sys.getdefaultencoding(), 'replace') + title = ctypes.create_string_buffer(title) + if 'linux' in sys.platform: + libc = ctypes.cdll.LoadLibrary("libc.so.6") + libc.prctl(15, ctypes.byref(title), 0, 0, 0) + elif 'bsd' in sys.platform: + libc = ctypes.cdll.LoadLibrary("libc.so.7") + libc.setproctitle(ctypes.create_string_buffer(b'-%s'), title) + except: + pass +setproctitle(sys.argv[0]) + + + ## Set global variables global DATADIR, i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate global periodically, wait_period, fadein_time, fadeout_time, fadein_steps, fadeout_steps |