add support files for cosmic-session
This commit is contained in:
parent
34bdcc4c47
commit
0db2927c86
6 changed files with 124 additions and 0 deletions
32
data/cosmic-service
Normal file
32
data/cosmic-service
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue