cosmic-session/data/start-cosmic

48 lines
1.5 KiB
Text
Raw Normal View History

#!/bin/bash
# From: https://people.debian.org/~mpitt/systemd.conf-2016-graphical-session.pdf
# robustness: if the previous graphical session left some failed units,
# reset them so that they don't break this startup
for unit in $(systemctl --user --no-legend --state=failed --plain list-units | cut -f1 -d' '); do
partof="$(systemctl --user show -p PartOf --value "$unit")"
for target in cosmic-session.target graphical-session.target; do
if [ "$partof" = "$target" ]; then
systemctl --user reset-failed "$unit"
break
fi
done
done
# /etc/profile contains a lot of important environment variables
source /etc/profile
2022-09-23 10:43:58 -06:00
# load user's profile if it exists
if [ -n "${HOME}" -a -f "${HOME}/.profile" ]
2022-09-23 10:39:43 -06:00
then
source "${HOME}/.profile"
fi
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:=pop:COSMIC}"
export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:=wayland}"
export XCURSOR_THEME="${XCURSOR_THEME:=Adwaita}"
export _JAVA_AWT_WM_NONREPARENTING=1
# experimental X support in cosmic, but still prefer wayland
if [[ ! -z "${COSMIC_X}" ]]; then
export DISPLAY=:0
export GDK_BACKEND=wayland,x11
export MOZ_ENABLE_WAYLAND=1
export COSMIC_BACKEND=kms
fi
# import environment variables from the login manager
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
# Run cosmic-session
2022-07-13 12:04:16 -04:00
if [[ -z "${DBUS_SESSION_BUS_ADDRESS}" ]]; then
exec /usr/bin/dbus-run-session -- /usr/bin/cosmic-session
else
exec /usr/bin/cosmic-session
fi