aboutsummaryrefslogtreecommitdiffstats
path: root/xmonad/xinit
blob: 1b7bacba9865f6bf96ce190764ee4c45aac1ca27 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- shell-script -*-

# Only apply if starting xmonad as the window manager
if test "${SESSION}" = xmonad; then

	# Tell Java if we are using a non-reparenting window manager
	export _JAVA_AWT_WM_NONREPARENTING=1

	# Use GTK2 theming in Qt applications
	export QT_QPA_PLATFORMTHEME=gtk2

	# Start GTK2 settings daemon
	if test ! "${NO_MATE}" = y; then
		if test -x /usr/lib/mate-settings-daemon/mate-settings-daemon; then
			/usr/lib/mate-settings-daemon/mate-settings-daemon &
			sleep 0.5
		elif test -x /usr/bin/mate-settings-daemon; then
			/usr/bin/mate-settings-daemon &
			sleep 0.5
		elif test -x /usr/libexec/mate-settings-daemon; then
			/usr/libexec/mate-settings-daemon &
			sleep 0.5
		elif test -x /usr/libexec/mate-settings-daemon/mate-settings-daemon; then
			/usr/libexec/mate-settings-daemon/mate-settings-daemon &
			sleep 0.5
		fi
	fi

	# Start gpg-agent, so that it doesn't try the terminal only, and fail when stdin is something else
	if test -x /usr/bin/pinentry-gtk2; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk2 --daemon
	elif test -x /usr/bin/pinentry-gtk-2; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk-2 --daemon
	elif test -x /usr/bin/pinentry-gtk3; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk3 --daemon
	elif test -x /usr/bin/pinentry-gtk-3; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk-3 --daemon
	elif test -x /usr/bin/pinentry-gtk4; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk4 --daemon
	elif test -x /usr/bin/pinentry-gtk-4; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk-4 --daemon
	elif test -x /usr/bin/pinentry-gtk; then
		setsid -f gpg-agent --pinentry-program /usr/bin/pinentry-gtk --daemon
	fi

	# Automatically focus output when mouse is moving in root window
	pdeath HUP xmonad-autofocus-output &

	# Start composition manager
	xcman &

	# Start application panel
	mate-panel &

	# Start screensaver daemon work computers ## TODO not if in virtual machine or at home
	if iswork; then
		mate-screensaver &
	fi

	# Start network manager applet if computer has WiFi
	if test ! $(ifconfig | grep '^w' | wc -l) = 0; then
		nm-applet &
	fi

	# Remove old session
	if test -f ~/.xmonad/xmonad.state; then
		rm -f -- ~/.xmonad/xmonad.state
	fi

fi