Package: gtk3-nocsd
Version: 3-1
Severity: important
Tags: patch

Dear Maintainer,

The session detection for gtk3-nocsd doesn't work properly as it still uses old session detection method of gnomerc. It tries to detect the session by shipping 51gtk3-nocsd-detect in /etc/X11/Xsession.d. On Ubuntu, it gets enabled even for pure Gnome session.

51gtk3-nocsd-detect uses:

1) `BASESTARTUP=${STARTUP%% *}` which returns empty as STARTUP was never set on Ubuntu

2) `BASESTARTUP=$(basename $(readlink /etc/alternatives/x-session-manager))` which will fail(it never goes into the inner loop due to previous error) for unity session as unity session also uses gnome-session but wants to set GTK_CSD=0 globally.

The modern way to detect session is to use $XDG_CURRENT_DESKTOP variable. I attached a patch which takes advantage of that.

Ubuntu →  XDG_CURRENT_DESKTOP=ubuntu:GNOME
Debian → XDG_CURRENT_DESKTOP=GNOME
Unity → XDG_CURRENT_DESKTOP=Unity:Unity7:Ubuntu

The patch sets GTK_CSD=0 only for non-gnome sessions and compatible with all other non gnome desktop sessions on both Debian and Ubuntu.

Launchpad bug link: https://bugs.launchpad.net/ubuntu/+source/gtk3-nocsd/+bug/1745206

Thank You.

-- System Information:
Debian Release: stretch/sid
 APT prefers bionic
 APT policy: (500, 'bionic')
Architecture: i386 (i686)

Kernel: Linux 4.2.0-19-generic (SMP w/2 CPU cores)
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8), LANGUAGE=en_IN:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gtk3-nocsd depends on:
ii libgtk3-nocsd0 3-1
--- a/debian/extra/51gtk3-nocsd-detect
+++ b/debian/extra/51gtk3-nocsd-detect
@@ -4,13 +4,8 @@
 # case where gtk3-nocsd is removed but not yet purged is also
 # handled properly.
 if [ -x /usr/bin/gtk3-nocsd ] && ( [ -z "$GTK3_NOCSD_IGNORE" ] || [ x"$GTK3_NOCSD_IGNORE"x = x"0"x ] ) ; then
-    BASESTARTUP=${STARTUP%% *}
-    BASESTARTUP=${BASESTARTUP##*/}
-    if [ "$BASESTARTUP" = x-session-manager ]; then
-        BASESTARTUP=$(basename $(readlink /etc/alternatives/x-session-manager))
-    fi
-    case "$BASESTARTUP" in
-      gnome-session*)
+    case "$XDG_CURRENT_DESKTOP" in
+      *GNOME*|*Gnome*)
           # This is GNOME, make sure GTK_CSD is not set to 0
           if [ x"$GTK_CSD"x = x"0"x ] ; then
               unset GTK_CSD

Reply via email to