summaryrefslogtreecommitdiff
path: root/.config/X11/clientrc
blob: e280f8db18f975ce3ef36589bea9d3f2b8fe3635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/hint/sh

# Load system xinit modules (disabled)
# Remove "false &&" to enable
if false && [ -d /etc/X11/xinit/xinitrc.d ]; then
	echo ' ==> Running scripts in Entering xinitrc.d/*'
	for f in /etc/X11/xinit/xinitrc.d/*; do
		echo "  -> $f"
		[ -x "$f" ] && . "$f"
	done
	unset f
	echo '  -> done'
fi

usermodmap="$XDG_CONFIG_HOME/X11/modmap"
if [ -f "$usermodmap" ]; then
	xmodmap "$usermodmap"
fi

dpi=$(LC_ALL=C DISPLAY=:0 xdpyinfo|sed -rn 's/^\s*resolution:\s*(.*) dots per inch$/\1/p')
xrdb -merge <<<"Xft.dpi: ${dpi}"

userresources="$XDG_CONFIG_HOME/X11/resources"
if [ -f "$userresources" ]; then
	xrdb -merge "$userresources"
fi

if [ -z "$XDG_RUNTIME_DIR" ]; then
	printf "XDG_RUNTIME_DIR isn't set\n" >&2
	exit 6
fi

_DISPLAY="$(systemd-escape -- "$DISPLAY")"
trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}")" EXIT
mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}"

cat < "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" &
systemctl --user start "X11@${_DISPLAY}.target" &
wait
systemctl --user stop "X11@${_DISPLAY}.target"