updates
This commit is contained in:
parent
e80d9d797c
commit
49d6627ee1
@ -66,4 +66,4 @@ opacity = 0.8
|
||||
title = "Terminal"
|
||||
|
||||
[terminal]
|
||||
shell = { program = "/usr/bin/systemd-run", args = [ "--user", "--scope", "--slice=shells.slice", "--property=PartOf=alacritty.service", "--property=After=alacritty.service", "--slice-inherit", "-S", "-q"]}
|
||||
#shell = { program = "/usr/bin/systemd-run", args = [ "--user", "--scope", "--slice=app-shell.slice", "--property=PartOf=alacritty.service", "--property=After=alacritty.service", "-S", "-q"]}
|
||||
|
||||
@ -260,7 +260,7 @@ include input.conf
|
||||
# Service Management #
|
||||
### ###
|
||||
|
||||
exec ~/.local/lib/voidshell/sway-systemd-start.sh
|
||||
exec exec ~/.local/bin/sway-session-manager.sh setup
|
||||
|
||||
### ###
|
||||
# Generic Local Configuration #
|
||||
|
||||
6
.config/systemd/user/sway-session-pre.target
Normal file
6
.config/systemd/user/sway-session-pre.target
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Sway session services which should run early before the graphical session is brought up
|
||||
Documentation=man:systemd.special(7)
|
||||
Requires=basic.target
|
||||
RefuseManualStart=yes
|
||||
StopWhenUnneeded=yes
|
||||
4
.config/systemd/user/sway-session-shutdown.target
Normal file
4
.config/systemd/user/sway-session-shutdown.target
Normal file
@ -0,0 +1,4 @@
|
||||
[Unit]
|
||||
Description=Cleanup tasks for Sway compositor sessions that run after the compositor shuts down
|
||||
RefuseManualStart=yes
|
||||
StopWhenUnneeded=yes
|
||||
@ -1,6 +1,8 @@
|
||||
[Unit]
|
||||
Description=Sway compositor session
|
||||
Documentation=man:systemd.special
|
||||
Documentation=man:systemd.special(7)
|
||||
BindsTo=graphical-session.target
|
||||
Wants=graphical-session-pre.target
|
||||
After=graphical-session-pre.target
|
||||
Wants=sway-session-pre.target
|
||||
After=sway-session-pre.target
|
||||
RefuseManualStart=yes
|
||||
StopWhenUnneeded=yes
|
||||
|
||||
@ -124,3 +124,5 @@ function mkcd {
|
||||
[[ -e $1 ]] || mkdir -p $1
|
||||
cd $1
|
||||
}
|
||||
|
||||
alias ppctl='/usr/bin/python3 /usr/bin/powerprofilesctl'
|
||||
|
||||
@ -150,7 +150,7 @@ Indent using tabs, render with tab-width of 2.
|
||||
(defun irc-setup ()
|
||||
(if irc-configured (message "IRC configured.") (do-irc-setup)))
|
||||
|
||||
(add-hook 'after-make-frame-functions 'irc-setup)
|
||||
;; (add-hook 'after-make-frame-functions 'irc-setup)
|
||||
(irc-setup)
|
||||
#+END_SRC
|
||||
|
||||
|
||||
100
.local/bin/sway-session-manager.sh
Executable file
100
.local/bin/sway-session-manager.sh
Executable file
@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
export XDG_SESSION_DESKTOP="${XDG_SESSION_DESKTOP:-sway}"
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
VARIABLES="DESKTOP_SESSION XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE"
|
||||
VARIABLES="${VARIABLES} DISPLAY I3SOCK SWAYSOCK WAYLAND_DISPLAY"
|
||||
VARIABLES="${VARIABLES} XCURSOR_THEME XCURSOR_SIZE"
|
||||
SESSION_TARGET="sway-session.target"
|
||||
SESSION_SHUTDOWN_TARGET="sway-session-shutdown.target"
|
||||
SWAY_UNIT="sway.scope"
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF
|
||||
Usage: $0 <setup|cleanup> [ARGS]
|
||||
--help Show this help message and exit.
|
||||
--add-env=NAME, -E NAME
|
||||
Add an variable to the environment imported into
|
||||
systemd and purged on exit.
|
||||
|
||||
setup Perform sway session systemd setup. This will fail
|
||||
if the command is not run as a child of 'sway' (via
|
||||
an 'exec' or 'exec_always' directive or command).
|
||||
cleanup Meant to be called by the service manager as a part
|
||||
of sway-session-shutdown.target.
|
||||
EOF
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
print_usage
|
||||
exit 0 ;;
|
||||
--add-env=?*)
|
||||
VARIABLES="${VARIABLES} ${1#*=}" ;;
|
||||
--add-env | -E)
|
||||
shift
|
||||
VARIABLES="${VARIABLES} ${1}" ;;
|
||||
cleanup)
|
||||
TASK=cleanup ;;
|
||||
setup)
|
||||
TASK=setup ;;
|
||||
-*)
|
||||
echo "Unexpected option: $1" >&2
|
||||
print_usage
|
||||
exit 1 ;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
function setup() {
|
||||
# Get process stack
|
||||
ppid=$(ps -o ppid= $$ | sed 's/ //g')
|
||||
ppcomm=$(ps -o comm= $ppid)
|
||||
|
||||
if [[ $ppcomm == 'sh' ]]; then
|
||||
# sway exec command (a shell) forked before exec, get its parent
|
||||
ppid=$(ps -o ppid= $ppid | sed 's/ //g')
|
||||
ppcomm=$(ps -o comm= $ppid)
|
||||
fi
|
||||
|
||||
if ! [[ $ppcomm == 'sway' ]]; then
|
||||
echo "Error: attempting to run setup while not invoked by sway!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Reset failed units
|
||||
systemctl --user reset-failed
|
||||
|
||||
# Import environment
|
||||
echo $VARIABLES | xargs -- systemctl --user import-environment
|
||||
echo $VARIABLES | xargs -- dbus-update-activation-environment
|
||||
|
||||
# Load scope unit
|
||||
busctl --user call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartTransientUnit 'ssa(sv)a(sa(sv))' \
|
||||
"$SWAY_UNIT" \
|
||||
fail \
|
||||
7 \
|
||||
PIDs au 1 $ppid \
|
||||
Slice s session.slice \
|
||||
Wants as 1 $SESSION_TARGET \
|
||||
Before as 1 $SESSION_TARGET \
|
||||
PropagatesStopTo as 1 $SESSION_TARGET \
|
||||
OnSuccess as 1 $SESSION_SHUTDOWN_TARGET \
|
||||
OnFailure as 1 $SESSION_SHUTDOWN_TARGET \
|
||||
0
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
systemctl --user unset-environment $VARIABLES
|
||||
}
|
||||
|
||||
case $TASK in
|
||||
setup)
|
||||
setup ;;
|
||||
cleanup)
|
||||
cleanup ;;
|
||||
esac
|
||||
Loading…
x
Reference in New Issue
Block a user