diff --git a/lain/.config/systemd/user/compton.service b/lain/.config/systemd/user/compton.service new file mode 100644 index 0000000..82a537a --- /dev/null +++ b/lain/.config/systemd/user/compton.service @@ -0,0 +1,9 @@ +[Unit] +Description=X11 Compositor + +[Service] +Type=forking +ExecStart=compton --config /home/lain/.config/compton/config -b + +[Install] +WantedBy=i3@.service diff --git a/lain/.config/systemd/user/emacs.service b/lain/.config/systemd/user/emacs.service new file mode 100644 index 0000000..6deb087 --- /dev/null +++ b/lain/.config/systemd/user/emacs.service @@ -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 diff --git a/lain/.config/systemd/user/i3@.service b/lain/.config/systemd/user/i3@.service new file mode 100644 index 0000000..654bca0 --- /dev/null +++ b/lain/.config/systemd/user/i3@.service @@ -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 diff --git a/lain/.config/systemd/user/polybar-bottom.service b/lain/.config/systemd/user/polybar-bottom.service new file mode 100644 index 0000000..91e0b2c --- /dev/null +++ b/lain/.config/systemd/user/polybar-bottom.service @@ -0,0 +1,9 @@ +[Unit] +Description=Polybar Bottom + +[Service] +Type=simple +ExecStart=polybar bottom + +[Install] +WantedBy=i3@.target diff --git a/lain/.config/systemd/user/polybar-top.service b/lain/.config/systemd/user/polybar-top.service new file mode 100644 index 0000000..d1233d6 --- /dev/null +++ b/lain/.config/systemd/user/polybar-top.service @@ -0,0 +1,9 @@ +[Unit] +Description=Polybar Top + +[Service] +Type=simple +ExecStart=polybar top + +[Install] +WantedBy=i3@.target diff --git a/lain/.config/systemd/user/wallpaper.service b/lain/.config/systemd/user/wallpaper.service index 00d6924..89841cd 100644 --- a/lain/.config/systemd/user/wallpaper.service +++ b/lain/.config/systemd/user/wallpaper.service @@ -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 diff --git a/lain/.config/systemd/user/x11@.target b/lain/.config/systemd/user/x11@.target new file mode 100644 index 0000000..f4cc043 --- /dev/null +++ b/lain/.config/systemd/user/x11@.target @@ -0,0 +1,2 @@ +[Unit] +Description=Connection to X11 display %i diff --git a/lain/.xinitrc b/lain/.xinitrc index c69f4a3..55d9e00 100644 --- a/lain/.xinitrc +++ b/lain/.xinitrc @@ -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" & diff --git a/lain/.xserverrc b/lain/.xserverrc new file mode 100644 index 0000000..8a40e39 --- /dev/null +++ b/lain/.xserverrc @@ -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