mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
systemd: default launch systemd apps in app.slice
Unless specified, units will launch in `app.slice` under the assumption that they are foreground user applications. Update i3 configuration to remove redundant app.slice definition. Conform to unit naming of app-{name}-{random}.service as documented in https://github.com/systemd/systemd/blob/master/docs/DESKTOP_ENVIRONMENTS.md#pre-defined-systemd-units Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
rand=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 16)
|
||||
rand=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 8)
|
||||
|
||||
args=()
|
||||
while getopts "u:s:e:d:cnw" opt
|
||||
while getopts "s:e:d:cnw" opt
|
||||
do case "$opt" in
|
||||
u) args+=("--unit=$OPTARG-$rand");;
|
||||
s) args+=("--slice=$OPTARG");;
|
||||
s) slice="$OPTARG";;
|
||||
e) args+=("--setenv=$OPTARG");;
|
||||
d) args+=("--working-directory=$OPTARG");;
|
||||
c) args+=("--scope");;
|
||||
@ -17,4 +16,13 @@ do case "$opt" in
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
exec systemd-run --user --collect --unit="$1-$rand" ${args[@]} -- "$@"
|
||||
if [ -z "$slice" ]; then
|
||||
slice=app
|
||||
fi
|
||||
|
||||
exec systemd-run \
|
||||
--user \
|
||||
--collect \
|
||||
--slice="$slice" \
|
||||
--unit="$slice-$1-$rand" \
|
||||
${args[@]} -- "$@"
|
||||
|
Reference in New Issue
Block a user