add support files for cosmic-session

This commit is contained in:
Victoria Brekenfeld 2022-02-09 14:27:22 +01:00
parent 34bdcc4c47
commit 0db2927c86
6 changed files with 124 additions and 0 deletions

12
data/cosmic-comp.service Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=Cosmic wayland compositor
BindsTo=cosmic-session.target
Wants=cosmic-session-pre.target
After=cosmic-session-pre.target
Before=cosmic-session.target
[Service]
Type=simple
ExecStart=/usr/bin/cosmic-comp
Restart=never
ExecStopPost=/usr/bin/systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY

32
data/cosmic-service Normal file
View file

@ -0,0 +1,32 @@
#!/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
export XDG_CURRENT_DESKTOP=cosmic
# save environment variables that will be added to systemd
new_env=$(systemctl --user show-environment | cut -d'=' -f 1 | sort | comm -13 - <(env | cut -d'=' -f 1 | sort))
# import environment variables from the login manager
systemctl --user import-environment
# then start the service
systemctl --wait --user start cosmic-comp.service
# cleanup environment
systemctl --user unset-environment $new_env

View file

@ -0,0 +1,8 @@
[Unit]
Description=Cosmic session early services
Documentation=man:systemd.special(7)
RefuseManualStart=yes
StopWhenUnneeded=yes
BindsTo=graphical-session-pre.target
Before=graphical-session-pre.target
Before=cosmic-session.target

View file

@ -0,0 +1,7 @@
[Unit]
Description=Cosmic session
Documentation=man:systemd.special(7)
RefuseManualStart=yes
StopWhenUnneeded=yes
BindsTo=graphical-session.target
Before=graphical-session.target

7
data/cosmic.desktop Normal file
View file

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Cosmic
Commment=This session logs you into Cosmic
Exec=/usr/bin/cosmic-service
Type=Application
DesktopNames=pop:COSMIC
X-GDM-SessionRegisters=false