Repository: lutris/lutris

Issue:
Disable desktop effects does not work on Gentoo due to expanded $DESKTOP_SESSION variable
**Describe the bug**

[Disable desktop effects](https://github.com/lutris/lutris/blob/4efadf948c6af7611c44855444e56d3852d5a1c3/lutris/util/display.py#L131) uses $DESKTOP_SESSION to figure out which environment is running. On Gentoo with SDDM and Plasma 5, the variable expands to `/usr/share/xsessions/plasma` rather than just `plasma`, preventing the compositor disable command from working.

**Expected behavior**

KWin on Gentoo stops compositing once a game is launched with "Disable desktop effects" enabled

**Current behavior**

Compositing remains enabled

**Steps to reproduce**

- Emerge `lutris` from official gentoo repo
- Log into a KDE Plasma 5 session
- Launch Lutris
- Enable "Disable desktop effects"

**Lutris debugging output**

The terminal output of `lutris -d`.

```
INFO     2020-05-02 17:01:13,531 [application.do_command_line:245]:Running Lutris 0.5.6
INFO     2020-05-02 17:01:13,531 [startup.check_driver:62]:Using X.Org
INFO     2020-05-02 17:01:13,531 [startup.check_driver:67]:Running Mesa driver 20.0.6 on Radeon RX 560 Series (POLARIS11, DRM 3.36.0, 5.6.6-gentoo, LLVM 10.0.0) (0x67ff)
INFO     2020-05-02 17:01:13,531 [startup.check_driver:79]:GPU: 1002:67FF 1458:230A using amdgpu drivers
INFO     2020-05-02 17:01:13,546 [startup.check_vulkan:132]:Vulkan is supported
INFO     2020-05-02 17:01:13,547 [dxvk.get_dxvk_versions:22]:Updating DXVK versions
DEBUG    2020-05-02 17:01:13,772 [http.get:65]:GET https://lutris.net/api/runtime
INFO     2020-05-02 17:01:13,773 [lutriswindow.toggle_connection:642]:Connected to lutris.net as technohacker
DEBUG    2020-05-02 17:01:13,774 [http.get:65]:GET https://lutris.net/api/games/library/technohacker
DEBUG    2020-05-02 17:01:13,778 [store.get_missing_media:209]:Requesting missing icons from API for 15 games
DEBUG    2020-05-02 17:01:13,778 [http.get:65]:GET https://lutris.net/api/games
DEBUG    2020-05-02 17:01:15,691 [api.get_game_api_page:132]:Loaded 6 games from page 1
```



Discussion:

Resolving patch:
diff --git a/lutris/util/display.py b/lutris/util/display.py
--- a/lutris/util/display.py
+++ b/lutris/util/display.py
@@ -129,17 +129,17 @@ def get_compositor_commands():
     start_compositor = None
     stop_compositor = None
     desktop_session = os.environ.get("DESKTOP_SESSION")
-    if desktop_session == "plasma":
+    if desktop_session.endswith("plasma"):
         stop_compositor = ("qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.suspend")
         start_compositor = ("qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.resume")
     elif (
-        desktop_session == "mate"
+        desktop_session.endswith("mate")
         and system.execute("gsettings get org.mate.Marco.general compositing-manager", shell=True) == "true"
     ):
         stop_compositor = ("gsettings set org.mate.Marco.general compositing-manager false")
         start_compositor = ("gsettings set org.mate.Marco.general compositing-manager true")
     elif (
-        desktop_session == "xfce" and system.execute(
+        desktop_session.endswith("xfce") and system.execute(
             "xfconf-query --channel=xfwm4 --property=/general/use_compositing",
             shell=True,
         ) == "true"
@@ -147,7 +147,7 @@ def get_compositor_commands():
         stop_compositor = ("xfconf-query --channel=xfwm4 --property=/general/use_compositing --set=false")
         start_compositor = ("xfconf-query --channel=xfwm4 --property=/general/use_compositing --set=true")
     elif (
-        desktop_session == "deepin" and system.execute(
+        desktop_session.endswith("deepin") and system.execute(
             "dbus-send --session --dest=com.deepin.WMSwitcher --type=method_call "
             "--print-reply=literal /com/deepin/WMSwitcher com.deepin.WMSwitcher.CurrentWM",
             shell=True,


Test patch: