From 60fd654e186fbf6427d82c478961ac6a4331c634 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Thu, 1 Feb 2024 02:21:12 +0800 Subject: [PATCH] cinnamon-session: make sure wayland sessions get a login shell (#161) Users expect their shell profiles to get sourced at startup, which doesn't happen with wayland sessions. This commit brings back that feature, by making the cinnamon-session wrapper script run a login shell. ref: https://gitlab.gnome.org/GNOME/gnome-session/-/commit/7e307f8ddb91db5d4051c4c792519a660ba67f35 --- cinnamon-session/cinnamon-session.in | 16 ++++++++++++++++ cinnamon-session/meson.build | 14 +++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 cinnamon-session/cinnamon-session.in diff --git a/cinnamon-session/cinnamon-session.in b/cinnamon-session/cinnamon-session.in new file mode 100755 index 0000000..d9d7cb2 --- /dev/null +++ b/cinnamon-session/cinnamon-session.in @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ "x$XDG_SESSION_TYPE" = "xwayland" ] && + [ "x$XDG_SESSION_CLASS" != "xgreeter" ] && + [ -n "$SHELL" ] && + grep -q "$SHELL" /etc/shells && + ! (echo "$SHELL" | grep -q "false") && + ! (echo "$SHELL" | grep -q "nologin"); then + if [ "$1" != '-l' ]; then + exec bash -c "exec -l '$SHELL' -c '$0 -l $*'" + else + shift + fi +fi + +exec @libexecdir@/cinnamon-session-binary "$@" diff --git a/cinnamon-session/meson.build b/cinnamon-session/meson.build index a244069..b5e8273 100644 --- a/cinnamon-session/meson.build +++ b/cinnamon-session/meson.build @@ -53,7 +53,7 @@ cinnamon_session_sources = [ gdbus_sources, ] -executable('cinnamon-session', +executable('cinnamon-session-binary', cinnamon_session_sources, dependencies: [ cinnamon_desktop, @@ -75,6 +75,18 @@ executable('cinnamon-session', ], include_directories: [ rootInclude ], install: true, + install_dir: get_option('libexecdir'), +) + +script_conf = configuration_data() +script_conf.set('libexecdir', get_option('prefix') / get_option('libexecdir')) + +configure_file( + input: 'cinnamon-session.in', + output: 'cinnamon-session', + install: true, + install_dir: get_option('bindir'), + configuration: script_conf ) units = [