86 lines
2.9 KiB
Bash
86 lines
2.9 KiB
Bash
#!/bin/sh
|
|
# shellcheck disable=SC2155
|
|
|
|
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}"
|
|
|
|
. "$SHELL_CONFIG_DIR/env"
|
|
|
|
# set PATH so it includes user's private bin if it exists
|
|
if [ -d "$HOME/.local/bin" ] ; then
|
|
PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# Locales
|
|
export LC_ALL=en_US.UTF-8
|
|
export LANG=en_US.UTF-8
|
|
export LANGUAGE=en_US.UTF-8
|
|
|
|
# Remove programs from root of home directory
|
|
export XDG_CONFIG_HOME="$HOME/.config"
|
|
export XDG_DATA_HOME="$HOME/.local/share"
|
|
export XDG_CACHE_HOME="$HOME/.cache"
|
|
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
|
export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/x11/xinitrc"
|
|
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
|
|
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
|
|
export LESSHISTFILE="-"
|
|
export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc"
|
|
# export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg"
|
|
export WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/wineprefixes/default"
|
|
export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi"
|
|
# export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
|
|
# export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
|
|
# export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
|
|
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
|
|
|
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
|
|
|
# Other programs
|
|
export FZF_DEFAULT_OPTS="--layout=reverse --height 33%"
|
|
export LESS=-R
|
|
export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')"
|
|
export LESS_TERMCAP_md="$(printf '%b' '[1;36m')"
|
|
export LESS_TERMCAP_me="$(printf '%b' '[0m')"
|
|
export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')"
|
|
export LESS_TERMCAP_se="$(printf '%b' '[0m')"
|
|
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
|
|
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
|
|
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
|
|
export VDPAU_DRIVER=va_gl # Fix steam remote play black screen
|
|
# shellcheck disable=SC2046
|
|
export $(dbus-launch)
|
|
|
|
|
|
|
|
# If running in a TTY…
|
|
if [ "$(tty | sed 's-[0-9]$--g')" = /dev/tty ]; then
|
|
export IS_TTY=true
|
|
|
|
# 1- Swap caps and escape
|
|
TMP_KEYMAP=/tmp/keymap_tmp.kmap
|
|
cat <<-EOF >> "$TMP_KEYMAP"
|
|
keycode 1 = Caps_Lock
|
|
keycode 58 = Escape
|
|
EOF
|
|
sudo -n loadkeys "$TMP_KEYMAP" 2>/dev/null
|
|
rm "$TMP_KEYMAP"
|
|
|
|
# 2- Change the prompt theme to one that doesn't use nerdfonts
|
|
export P10K_CONFIG_LOCATION="$HOME/.config/shell/p10k/simple.p10k.zsh"
|
|
|
|
else
|
|
export IS_TTY=false
|
|
|
|
# gnome likes to reset the keymap settings I make and I hate it
|
|
# if… gnome is the desktop, the profile is unloaded, we are not in tmux, and gsettings is a valid command
|
|
if [ "$DESKTOP_SESSION" = "gnome" ] && [ -z "${PROFILE_LOADED+foo}" ] && [ -z "${TMUX+foo}" ] && command -v gsettings > /dev/null; then
|
|
(
|
|
sleep 1 &&
|
|
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape', 'compose:sclk']"
|
|
) &
|
|
fi
|
|
fi
|
|
|
|
export PROFILE_LOADED=true
|
|
|
|
# vim:ft=sh:sw=3:ts=3:nospell
|