From c0c5ffc2b7ddfd7df35e76715e0eef9e711ab12d Mon Sep 17 00:00:00 2001
From: Ruben Rodriguez <ruben@trisquel.info>
Date: Sun, 25 Dec 2022 14:12:56 -0500
Subject: [PATCH] mate-session-manager: improve compositor selector

---
 helpers/DATA/mate-session-manager/mate-wm | 11 +++++++++--
 helpers/make-mate-session-manager         |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/helpers/DATA/mate-session-manager/mate-wm b/helpers/DATA/mate-session-manager/mate-wm
index 3acb6e8a5..7f8c5cb51 100755
--- a/helpers/DATA/mate-session-manager/mate-wm
+++ b/helpers/DATA/mate-session-manager/mate-wm
@@ -4,8 +4,15 @@ WINDOW_MANAGER=xterm
 [ -f /usr/bin/marco ] && WINDOW_MANAGER=marco
 [ -f /usr/bin/marco-no-composite ] && WINDOW_MANAGER=marco-no-composite
 
-if glxinfo | grep -q Accelerated.*yes  && [ -f /usr/bin/picom ] && [ -f /usr/bin/marco-xrender ] ; then
-    WINDOW_MANAGER=marco-xrender
+# Check for hardware acceleration
+if glxinfo -B | grep "OpenGL renderer string" | grep -qv llvmpipe ; then
+  WINDOW_MANAGER=marco
+  # Use marco-glx (picom) on non-intel gpu, if available
+  if glxinfo -B | grep -qiv vendor.*intel; then
+    if [ -f /usr/bin/picom ] && [ -f /usr/bin/marco-glx ] ; then
+      WINDOW_MANAGER=marco-glx
+    fi
+  fi
 fi
 
 gsettings set org.mate.session.required-components windowmanager $WINDOW_MANAGER
diff --git a/helpers/make-mate-session-manager b/helpers/make-mate-session-manager
index 84f0229b8..8e474a852 100644
--- a/helpers/make-mate-session-manager
+++ b/helpers/make-mate-session-manager
@@ -17,7 +17,7 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 #
 
-VERSION=6
+VERSION=7
 
 . ./config
 
-- 
GitLab