1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 04:22:50 -05:00

Xorg as a systemd service

This commit is contained in:
Jack Foltz 2018-12-03 18:47:58 -05:00
parent 4c8d52f0b3
commit c315a09d37
Signed by: foltik
GPG Key ID: D1F0331758D1F29A
9 changed files with 85 additions and 27 deletions

View File

@ -0,0 +1,9 @@
[Unit]
Description=X11 Compositor
[Service]
Type=forking
ExecStart=compton --config /home/lain/.config/compton/config -b
[Install]
WantedBy=i3@.service

View File

@ -0,0 +1,12 @@
[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
[Service]
Type=simple
ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=i3 Window Manager
After=x11@0.target
Requisite=x11@0.target
[Service]
Environment=DISPLAY=:0
Type=simple
ExecStart=/usr/bin/env bash -c 'exec 8>%t/x11-wm@0; exec i3'
SyslogIdentifier=i3
[Install]
RequiredBy=x11@0.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Polybar Bottom
[Service]
Type=simple
ExecStart=polybar bottom
[Install]
WantedBy=i3@.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Polybar Top
[Service]
Type=simple
ExecStart=polybar top
[Install]
WantedBy=i3@.target

View File

@ -3,7 +3,7 @@ Description=Load a random wallpaper and colorscheme
[Service]
Type=forking
ExecStart=/usr/bin/wal -q -i "/home/lain/Pictures/wallpapers" -a "85"
ExecStart=/usr/bin/wal -i "/home/lain/Pictures/wallpapers" -a "85"
[Install]
WantedBy=multi-user.target
WantedBy=i3@.target

View File

@ -0,0 +1,2 @@
[Unit]
Description=Connection to X11 display %i

View File

@ -2,35 +2,32 @@
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
xrdb $userresources
sysresources=/etc/x11/xinit/.Xresources
sysmodmap=/etc/x11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
if [ -f $sysresources ]; then xrdb -merge $sysresources; fi
if [ -f $sysmodmap ]; then xmodmap $sysmodmap; fi
if [ -f $userresources ]; then xrdb -merge $userresources; fi
if [ -f $usermodmap ]; then xmodmap $usermodmap; fi
if [ -d /etc/x11/xinit/xinitrc.d ]; then
for f in /etc/x11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
# The window manager will open this named pipe, closing it once it exits.
mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${DISPLAY:1:2}"
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
# Delete the pipe on exit
trap "rm -f ${XDG_RUNTIME_DIR}/x11-wm@${DISPLAY:1:2}" EXIT
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# Fork a process that will exit once the pipe is closed
cat < "${XDG_RUNTIME_DIR}/x11-wm@${DISPLAY:1:2}" &
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec i3 >~/.config/i3/log
systemctl --user start "x11@${DISPLAY:1:2}.target" &
# Wait for the pipe (window manager) to close
wait
systemctl --user stop "x11@${DISPLAY:1:2}.target" &

7
lain/.xserverrc Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "$XDG_VTNR" ]; then
exec /usr/bin/Xorg -nolisten tcp -nolisten local "@"
else
exec /usr/bin/Xorg -nolisten tcp -nolisten local -keeptty "$@" vt$XDG_VTNR
fi