diff --git a/apps/bc_desktop/template/desktops/gnome.sh b/apps/bc_desktop/template/desktops/gnome.sh index 5999fd0a74..2081558eea 100755 --- a/apps/bc_desktop/template/desktops/gnome.sh +++ b/apps/bc_desktop/template/desktops/gnome.sh @@ -13,5 +13,33 @@ if [[ -f "${HOME}/.config/monitors.xml" ]]; then mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak" fi +# gnome won't start correctly without DBUS_SESSION_BUS_ADDRESS set. +eval $(dbus-launch --sh-syntax) + +source /etc/os-release + +function classic(){ + export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:-x11}" + export GNOME_SHELL_SESSION_MODE="${GNOME_SHELL_SESSION_MODE:-classic}" + export GNOME_SESSION_MODE="${GNOME_SESSION_MODE:-classic}" +} + +function wayland() { + export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:-x11}" + export GNOME_SHELL_SESSION_MODE="${GNOME_SHELL_SESSION_MODE:-wayland}" + export GNOME_SESSION_MODE="${GNOME_SESSION_MODE:-wayland}" +} + +if [[ "$ID_LIKE" =~ "fedora" ]]; then + if [[ "$VERSION_ID" < "8.0" ]]; then + # el7 will crash using wayland. + classic + else + wayland + fi +else + wayland +fi + # Start up Gnome desktop (block until user logs out of desktop) /etc/X11/xinit/Xsession gnome-session diff --git a/apps/bc_desktop/template/script.sh.erb b/apps/bc_desktop/template/script.sh.erb index 9d7d26fdee..f23f0ffe0e 100755 --- a/apps/bc_desktop/template/script.sh.erb +++ b/apps/bc_desktop/template/script.sh.erb @@ -12,4 +12,4 @@ export SHELL="$(getent passwd $USER | cut -d: -f7)" # Start up desktop echo "Launching desktop '<%= context.desktop %>'..." source "<%= session.staged_root.join("desktops", "#{context.desktop}.sh") %>" -echo "Desktop '<%= context.desktop %>' ended..." +echo "Desktop '<%= context.desktop %>' ended with $? status..."