-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxinitrc
executable file
·120 lines (104 loc) · 2.96 KB
/
xinitrc
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
# Basic setup {{{1
# Where my WM init scripts live
# init_dir="$XDG_CONFIG_HOME/init.d"
init_dir="$HOME/etc/init.d"
# xset options {{{1
#
command -v xset >/dev/null && xset b off # Turn off audible bell
# Run custom X init scripts {{{1
#
for f in $init_dir/*; do
[ -x "$f" ] && $f
done
# Merge XResources {{{1
command -v xrdb >/dev/null &&
if [ -r "$HOME/.Xresources" ]; then
test -r "$HOME/.Xresources.$COLORSCHEME" &&
colorscheme="-DCOLORSCHEME=<$HOME/.Xresources.$COLORSCHEME>"
xrdb -merge "$HOME/.Xresources" $colorscheme
unset colorscheme
fi
# Start daemons {{{1
#
# Group start:
# (\
# app1 && \
# app2 && \
# ) &
# Use sleep as necessary to sync things up)
command -v xautolock >/dev/null && xautolock &
command -v xbanish >/dev/null && xbanish &
command -v mopidy >/dev/null && mopidy &
# Start WM {{{1
#
case $WINDOWMANAGER in
dwm)
while true; do
xsetroot -name "$(date "+%F %R")"
sleep 1m
done &
"$HOME/src/dwm/dwm" & wmpid=$!
# dwm_statusbar.sh &
;;
#
# This accepts any WM/DE that does not need specific start up.
# If WINDOWMANAGER isn't found, a terminal emulator is run instead
#
*)
if command -v $WINDOWMANAGER >/dev/null; then
$WINDOWMANAGER & wmpid=$!
else
term="st gnome-terminal rxvt xterm"
for t in $term; do
if command -v "$t" >/dev/null; then
$t & wmpid=$!
break
fi
done
fi
;;
esac
# Show login related things {{{1
#
# These are tasks that would be run in ~/.xsession except that
# they need to run *after* the window manager is launched
#
# Simple test to see if startx was executed
if ! ps x | grep [s]tartx; then
command -v xfortune >/dev/null && xfortune "$HOME/share/games/fortunes"
if command -v keychain >/dev/null; then
if command -v my >/dev/null; then
t=$(my -v terminal)
else
t=xterm
fi
# Find all SSH public keys and add the corresponding private key
#
# Using basename to remove the extension doesn't work because keychain
# cannot find the key without the entire path
# The --confhost option to keychain is supposed to use IdentityFile
# to find the key path but I cannot get that to work
$t -e keychain --quiet --nogui --ignore-missing \
$(find "$HOME/.ssh" -name '*.pub' | rev | cut -f 2- -d. | rev)
fi
fi
# Start desktop apps {{{1
#
command -v signal-desktop >/dev/null && signal-desktop
command -v discord >/dev/null && discord
# Start other apps {{{1
#
# Run this stuff forever {{{1
#
# while true; do
# stuff to run forever
# e.g. setting variables for scripts to watch
# such as temperature or IP address
# sleep 20s # Reasonable CPU cycles
# done &
# Wait for WM to exit {{{1
wait $wmpid
# Do any necessary clean up
command -v virsh >/dev/null &&
virsh list | awk '/[[:digit:]]/ {print $2}' | xargs virsh shutdown