aboutsummaryrefslogtreecommitdiffstats
path: root/base/user-profile
blob: 370d637cc1eca3a6d0cfb9d07abeb53e6a2651ce (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- shell-script -*-

# Set locale
export LOCALE="en_GB.UTF-8"
export LC_ALL="en_GB.UTF-8"
export LANG="en_GB.UTF-8"

# Set audio interface
export MAIN_ALSA_CARD=0
export MAIN_ALSA_MIXER=PCM

# Set man section order
export MANSECT="1p:8p:1:8:2:3p:3:0:5:4:9:6:7:n:l"

# Ensure ~/.local/bin and ~/.usr/bin are in PATH
if ! ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.local/bin >/dev/null; then
	export PATH="${HOME}/.local/bin:${PATH}"
fi
if ! ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.usr/bin >/dev/null; then
	export PATH="${HOME}/.usr/bin:${PATH}"
fi

# Maybe set user directories
if test -z "${XDG_CONFIG_HOME}"; then
        export XDG_CONFIG_HOME="${HOME}/.config"
fi
if test -z "${XDG_CACHE_HOME}"; then
        export XDG_CACHE_HOME="${HOME}/.var/cache"
fi
if test -z "${XDG_SPOOL_HOME}"; then
        export XDG_SPOOL_HOME="${HOME}/.var/spool"
fi
if test -z "${XDG_STATE_HOME}"; then
        export XDG_STATE_HOME="${HOME}/.var/lib"
fi
if test -z "${XDG_DATA_HOME}"; then
        export XDG_DATA_HOME="${HOME}/.local/share"
fi

# Maybe set system directories
if test -z "${XDG_DATA_DIRS}"; then
        export XDG_DATA_DIRS="/usr/local/share:/usr/share"
fi
if test -z "${XDG_CONFIG_DIRS}"; then
        export XDG_CONFIG_DIRS="/etc/xgd:/etc"
fi

# Maybe set directory for temporary files, atleast create it
if test -z "${XDG_RUNTIME_DIR}"; then
	export XDG_RUNTIME_DIR='/tmp/.~'"$(whoami)"
fi
mkdir -p -- "${XDG_RUNTIME_DIR}"

# Set editor
if test -x ~/.local/bin/e; then
	export EDITOR=~/.local/bin/e
elif test -x /usr/bin/emacs; then
	export EDITOR="emacs -nw"
elif test -x /usr/bin/vis; then
	export EDITOR="vis"
elif test -x /usr/bin/nano; then
	export EDITOR="nano"
elif test -x /usr/bin/vim; then
	export EDITOR="vim"
elif test -x /usr/bin/vi; then
	export EDITOR="vi"
fi
export VISUAL="${EDITOR}"

# Load package specific profiles
for __script in ~/.config/profile.d/*; do
	if test -r "${__script}"; then
		. "${__script}"
	fi
done
unset __script

# Load machine specific profile
if test -r ~/.config/"profile-$(hostname)"; then
	. ~/.config/"profile-$(hostname)"
fi

# Load work related profile
if test -r ~/work/.config/profile; then
	. ~/work/.config/profile
fi