aboutsummaryrefslogtreecommitdiff
path: root/.profile
blob: 345f1a7dfe07485329fab11bac5fc76bffcfc226 (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
#!/bin/sh

# XDG base directories
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
# PATHs
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export GEM_HOME="$XDG_DATA_HOME/gem"
export GEM_SPEC_CACHE="$XDG_CACHE_HOME/gem"
export GOPATH="$XDG_DATA_HOME/go"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export LESSHISTFILE="-"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export PIPX_HOME="$XDG_DATA_HOME/pipx"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
export W3M_DIR="$XDG_STATE_HOME/w3m"
export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
export PATH="$PATH:$HOME/.local/bin/script:$HOME/.local/bin:$XDG_DATA_HOME/npm/bin:$CARGO_HOME/bin:$GOPATH/bin:$XDG_CONFIG_HOME/composer/vendor/bin:$GEM_HOME/bin"

# Default programs
if command -v org.mozilla.firefox 1>/dev/null 2>&1; then
	export BROWSER="org.mozilla.firefox"
elif command -v firefox 1>/dev/null 2>&1; then
	export BROWSER="firefox"
else
	export BROWSER="org.mozilla.firefox"
fi
export TERMINAL="st"
export EDITOR="nvim"
export PAGER="less"

# Other
export GOPROXY=direct
export _JAVA_AWT_WM_NONREPARENTING=1
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"

# Make libpaper respect locale
_paper_locale="$(locale -k LC_PAPER 2>/dev/null | cut -d '=' -f 2)"
_paper_height="$(echo "$_paper_locale" | sed -n 1p)"
_paper_width="$(echo "$_paper_locale" | sed -n 2p)"
if [ "$_paper_width" = "210" ] && [ "$_paper_height" = "297" ]; then
	export PAPERSIZE="a4"
elif [ "$_paper_width" = "216" ] && [ "$_paper_height" = "279" ]; then
	export PAPERSIZE="letter"
else
	export PAPERSIZE="a4"
fi

# Symlink XDG music directory for ncmpcpp
type xdg-user-dir 1>/dev/null 2>&1 && ln -snf "$(xdg-user-dir MUSIC)" "${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/music_dir"

# Start a graphical server if window manager is not already running
if [ "$(tty)" = "/dev/tty1" ] && ! pgrep -x Xorg >/dev/null; then
	exec startx "$XDG_CONFIG_HOME/X11/xinitrc" :0 1>/dev/null 2>&1
fi