aboutsummaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-03 02:25:33 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-03 02:25:33 +0200
commitaf85c766fc22f73fb604510ae5b7c471b923990d (patch)
treecd6ec4595a2d57a1dc13376a636360538d377125 /src/__main__.py
parenttypo (diff)
downloadxpybar-af85c766fc22f73fb604510ae5b7c471b923990d.tar.gz
xpybar-af85c766fc22f73fb604510ae5b7c471b923990d.tar.bz2
xpybar-af85c766fc22f73fb604510ae5b7c471b923990d.tar.xz
set title on lightweight processes, properly
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/__main__.py b/src/__main__.py
index cfda11d..f809a5d 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -478,33 +478,6 @@ class Bar:
## Set process title
-def setproctitle(title):
- '''
- Set process title
-
- @param title:str The title of the process
- '''
- import ctypes
- try:
- # Remove path, keep only the file,
- # otherwise we get really bad effects, namely
- # the name title is truncates by the number
- # of slashes in the title. At least that is
- # the observed behaviour when using procps-ng.
- title = title.split('/')[-1]
- # Create string buffer with title
- title = title.encode(sys.getdefaultencoding(), 'replace')
- title = ctypes.create_string_buffer(title)
- if 'linux' in sys.platform:
- # Set process title on Linux
- libc = ctypes.cdll.LoadLibrary('libc.so.6')
- libc.prctl(15, ctypes.byref(title), 0, 0, 0)
- elif 'bsd' in sys.platform:
- # Set process title on at least FreeBSD
- libc = ctypes.cdll.LoadLibrary('libc.so.7')
- libc.setproctitle(ctypes.create_string_buffer(b'-%s'), title)
- except:
- pass
setproctitle(sys.argv[0])