]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - setup.sh
setup.sh: Load xinitrc with lightdm.
[config/dotfiles.git] / setup.sh
1 #!/bin/sh
2
3 # Setup script for X11 configuration files.
4
5 # Copyright (C) 2011-2012  Simon Ruderich
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21 set -e
22
23 . ../lib.sh
24
25 if installed stumpwm; then
26     link stumpwmrc ~/.stumpwmrc
27 fi
28 if installed xmonad; then
29     link xmonad ~/.xmonad
30 fi
31
32 if installed X; then
33     # Prevent code duplication. Term* rules are for all terminals; XTerm rules
34     # are for XTerm and UXTerm. At the moment XTerm, UXTerm and Rxvt are
35     # supported.
36     generate perl Xdefaults -ne \
37         'if (/^Term/) {
38              s/^Term//;
39              print "XTerm", $_;
40              print "UXTerm", $_;
41              print "Rxvt", $_;
42          } elsif (/^XTerm/) {
43              print $_;
44              s/^XTerm//;
45              print "UXTerm", $_;
46          } else {
47              print $_;
48          }'
49     # Xdefaults uses ! as comment instead of #. tmp file necessary because of
50     # different implementations of `sed -i`.
51     sed 's/^#/!/' Xdefaults > Xdefaults.tmp
52     mv Xdefaults.tmp Xdefaults
53
54     if test ! "x`os`" = xdarwin; then
55         link xinitrc ~/.xinitrc
56         # lightdm doesn't use ~/.xinitrc but ~/.xprofile instead. Assume it's
57         # used when the lightdm configuration file is present.
58         if test -f "$HOME/.dmrc"; then
59             link xinitrc ~/.xprofile
60         fi
61     fi
62     if test -f xinitrc.local; then
63         link xinitrc.local ~/.xinitrc.local
64     fi
65     link xmodmaprc ~/.xmodmaprc
66     link Xdefaults ~/.Xdefaults
67     link XCompose ~/.XCompose
68 fi
69
70 if installed xpdf; then
71     link xpdfrc ~/.xpdfrc
72 fi
73 if installed zathura; then
74     mkdir -p ~/.config/zathura
75     link zathurarc ~/.config/zathura/zathurarc
76 fi
77
78 if installed feh; then
79     mkdir -p ~/.config
80     link feh ~/.config/feh
81     # Older feh versions only support theme options and configure them through
82     # ~/.fehrc.
83     link feh/themes ~/.fehrc
84 fi