Skip to content

Commit

Permalink
Fix gnome desktop (#3188)
Browse files Browse the repository at this point in the history
Fix gnome on el7 and find the os and set defaults for them.
  • Loading branch information
johrstrom authored Nov 20, 2023
1 parent 9c934da commit 20b4d9a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions apps/bc_desktop/template/desktops/gnome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion apps/bc_desktop/template/script.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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..."

0 comments on commit 20b4d9a

Please sign in to comment.