diff --git a/.travis.yml b/.travis.yml index 7eb9d8a36..b5dcf8bf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_install: install: - pip install --upgrade pip pypresence~=3.3.2 - sudo apt-get -qq update - - sudo apt-get install -y python3-yaml python3-gi python3-pil gir1.2-gtk-3.0 psmisc gir1.2-glib-2.0 libgirepository1.0-dev gir1.2-gnomedesktop-3.0 gir1.2-webkit2-4.0 gir1.2-notify-0.7 + - sudo apt-get install -y python3-yaml python3-gi python3-pil python3-setproctitle gir1.2-gtk-3.0 psmisc gir1.2-glib-2.0 libgirepository1.0-dev gir1.2-gnomedesktop-3.0 gir1.2-webkit2-4.0 gir1.2-notify-0.7 script: nosetests # Cache the pip dependencies diff --git a/INSTALL.rst b/INSTALL.rst index c25db45ca..0ab8c7360 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -14,6 +14,7 @@ be installed: * python3-requests * python3-pillow * python3-yaml + * python3-setproctitle * python3-evdev (optional, for controller detection) These dependencies are only for running the Lutris client. To install and run @@ -36,7 +37,8 @@ To install all those dependencies on Ubuntu based systems, you can run:: sudo apt install python3-yaml python3-requests python3-pil python3-gi \ gir1.2-gtk-3.0 gir1.2-gnomedesktop-3.0 gir1.2-webkit2-4.0 \ gir1.2-notify-0.7 psmisc cabextract unzip p7zip curl fluid-soundfont-gs \ - x11-xserver-utils python3-evdev libc6-i386 lib32gcc1 libgirepository1.0-dev + x11-xserver-utils python3-evdev libc6-i386 lib32gcc1 libgirepository1.0-dev \ + python3-setproctitle Note : If you use OpenSUSE, some dependencies are missing. You need to install python3-gobject-Gdk and typelib-1_0-Gtk-3_0 diff --git a/bin/lutris-wrapper b/bin/lutris-wrapper index 475be5050..f478e498d 100755 --- a/bin/lutris-wrapper +++ b/bin/lutris-wrapper @@ -9,6 +9,11 @@ from ctypes.util import find_library from lutris.util.monitor import ProcessMonitor from lutris.util.log import logger +try: + from setproctitle import setproctitle +except ImportError: + setproctitle = print + PR_SET_CHILD_SUBREAPER = 36 @@ -62,7 +67,9 @@ def log(line): def main(): """Runs a command independently from the Lutris client""" set_child_subreaper() - _, include_proc_count, exclude_proc_count, *args = sys.argv + _, proc_title, include_proc_count, exclude_proc_count, *args = sys.argv + + setproctitle("lutris-wrapper: " + proc_title) # So I'm too lazy to implement real argument parsing... sorry. include_proc_count = int(include_proc_count) diff --git a/debian/control b/debian/control index ddfd99f10..f88efdf36 100644 --- a/debian/control +++ b/debian/control @@ -30,6 +30,7 @@ Depends: ${misc:Depends}, python3-requests, python3-pil, python3-gi, + python3-setproctitle, gir1.2-gtk-3.0, gir1.2-gnomedesktop-3.0, gir1.2-webkit2-4.0, diff --git a/lutris/command.py b/lutris/command.py index 34e847b97..bba04808c 100644 --- a/lutris/command.py +++ b/lutris/command.py @@ -34,6 +34,7 @@ class MonitoredCommand: include_processes=None, exclude_processes=None, log_buffer=None, + title=None, ): # pylint: disable=too-many-arguments self.ready_state = True self.env = self.get_environment(env) @@ -60,6 +61,8 @@ class MonitoredCommand: self._stdout = io.StringIO() + self._title = title if title else command + @property def stdout(self): return self._stdout.getvalue() @@ -70,6 +73,7 @@ class MonitoredCommand: return [ WRAPPER_SCRIPT, + self._title, str(len(self.include_processes)), str(len(self.exclude_processes)), ] + self.include_processes + self.exclude_processes + self.command diff --git a/lutris/game.py b/lutris/game.py index d1db91e14..6b8cb4248 100644 --- a/lutris/game.py +++ b/lutris/game.py @@ -562,6 +562,7 @@ class Game(GObject.Object): """Run a background command to lauch the game""" self.game_thread = MonitoredCommand( self.game_runtime_config["args"], + title=self.name, runner=self.runner, env=self.game_runtime_config["env"], term=self.game_runtime_config["terminal"], diff --git a/snapcraft.yaml b/snapcraft.yaml index 4ad7ecda3..2c4913212 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -86,7 +86,7 @@ parts: lutris-runtime: plugin: nil - stage-packages: [python3, python3-yaml, python3-requests, python3-pil, python3-gi, dh-python, curl, cabextract, psmisc, gvfs-backends, unzip, p7zip, mesa-utils, fluid-soundfont-gs, libgnutls30, x11-xserver-utils, on amd64: ['libxrandr-dev:i386', 'libgnutls30:i386', 'x11-xserver-utils:i386', 'libc6-i386', 'lib32gcc1'] ] + stage-packages: [python3, python3-setproctitle, python3-yaml, python3-requests, python3-pil, python3-gi, dh-python, curl, cabextract, psmisc, gvfs-backends, unzip, p7zip, mesa-utils, fluid-soundfont-gs, libgnutls30, x11-xserver-utils, on amd64: ['libxrandr-dev:i386', 'libgnutls30:i386', 'x11-xserver-utils:i386', 'libc6-i386', 'lib32gcc1'] ] stage: [-lib/ld-linux.so.2, -usr/bin/cpp-7, -usr/share/doc/cpp/README.Debian, -usr/share/man/man1/cpp-7.1.gz] after: [enable-i386] diff --git a/tests/test_lutris_wrapper.py b/tests/test_lutris_wrapper.py index 8bf1f9f42..6365f41f0 100644 --- a/tests/test_lutris_wrapper.py +++ b/tests/test_lutris_wrapper.py @@ -23,6 +23,7 @@ class LutrisWrapperTestCase(unittest.TestCase): [ sys.executable, lutris_wrapper_bin, + 'title', '0', '0', 'bash',