Added setproctitle.

This commit is contained in:
Andrew Dunai 2018-05-09 12:47:41 +03:00
parent 21eb467c8d
commit 15ac3e9bdc
No known key found for this signature in database
GPG key ID: 592B181FC403814E
2 changed files with 13 additions and 3 deletions

View file

@ -64,9 +64,10 @@ Documentation is [available here](http://clay.readthedocs.io/en/latest/).
- [gmusicapi] (PYPI) - [gmusicapi] (PYPI)
- [urwid] (PYPI) - [urwid] (PYPI)
- [PyYAML] (PYPI) - [PyYAML] (PYPI)
- [PyGObject] (native, optional, used for global X keybinds)
- [Keybinder] (native, optional, used for global X keybinds)
- lib[VLC] (native, distributed with VLC player) - lib[VLC] (native, distributed with VLC player)
- [PyGObject] (optional) (native, used for global X keybinds)
- [Keybinder] (optional) (native, used for global X keybinds)
- [setproctitle] (optional) PYPI, used to change clay process name from 'python' to 'clay')
# What works # What works
- Playback - Playback
@ -244,3 +245,4 @@ People who contribute to this project:
[pyyaml]: https://github.com/yaml/pyyaml [pyyaml]: https://github.com/yaml/pyyaml
[PyGObject]: https://pygobject.readthedocs.io/en/latest/getting_started.html [PyGObject]: https://pygobject.readthedocs.io/en/latest/getting_started.html
[Keybinder]: https://github.com/kupferlauncher/keybinder [Keybinder]: https://github.com/kupferlauncher/keybinder
[setproctitle]: https://pypi.org/project/setproctitle/

View file

@ -27,6 +27,7 @@ from clay.notifications import notification_area
from clay.gp import gp from clay.gp import gp
from clay.hotkeys import hotkey_manager from clay.hotkeys import hotkey_manager
class AppWidget(urwid.Frame): class AppWidget(urwid.Frame):
""" """
Root widget. Root widget.
@ -326,7 +327,7 @@ def main():
""" """
Application entrypoint. Application entrypoint.
This method is required to allow Clay to be ran an application when installed via setuptools. This function is required to allow Clay to be ran as application when installed via setuptools.
""" """
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog=meta.APP_NAME, prog=meta.APP_NAME,
@ -363,6 +364,13 @@ def main():
palette = [(name, '', '', '', res['foreground'], res['background']) palette = [(name, '', '', '', res['foreground'], res['background'])
for name, res in settings.colours_config.items()] for name, res in settings.colours_config.items()]
try:
from setproctitle import setproctitle
except ImportError:
pass
else:
setproctitle('clay')
# Run the actual program # Run the actual program
app_widget = AppWidget() app_widget = AppWidget()
loop = urwid.MainLoop(app_widget, palette) loop = urwid.MainLoop(app_widget, palette)