etc/dot/file/profile
2024-07-27 18:59:17 +05:00

177 lines
3.7 KiB
Bash
Executable file

#!/bin/sh
#
# Profile of Surdeus.
#
reload-profile(){
. $PROFILE
}
no-output() {
$@ &> /dev/null
}
lfcd(){
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}
sctl(){
systemctl $@
}
jctl(){
journalctl $@
}
export-loop(){
# Chore, because I'm lazy to type "export" so many times.
# Standard "export" command takes arguments
# from variables from the start, but I want to
# use other variables in definition for next of them.
while test -n "$1" ; do
# Doing until we have arguments.
value="$(eval echo $2)"
name="$1"
export "$name"="$value"
shift 2
done
}
which-first() {
ret=""
for prog in $@ ; do
if no-output which "$prog" ; then
ret="$prog"
break
fi
done
which "$ret"
}
source-if-exist() {
for i in $@ ; do
if test -r "$i" ; then
. "$i"
fi
done
}
if test "$OS" != "Windows_NT" ; then
PATH="$HOME/exe:$HOME/.local/bin:$PATH"
fi
# COMMON
export LANG="en_US.UTF-8"
# Custom.
export KITTY_CONFIG_DIRECTORY="$ETC/kitty"
export OPENER="xdg-open"
export APP="$HOME/app"
export BIN="$HOME/bin"
export LOAD="$HOME/load"
export ETC="$HOME/etc"
export PATH="$PATH:$BIN"
export GIT="https://surdeus.su"
export DEV="$HOME/dev"
# CLI.
export LESS="--RAW-CONTROL-CHARS --quit-if-one-screen --clear-screen --tilde --chop-long-lines --status-column --rscroll='>'"
export ENV="$HOME/.shrc"
export PROMPT="; "
export PS1="$PROMPT"
export SUDO_PROMPT="# "
export EDITOR=`which-first nvim vim vi ed`
export VISUAL="$EDITOR"
export GIT_EDITOR="$VISUAL"
export PAGER=`which-first bat less more cat`
export MANPAGER="$PAGER"
export CMDHIST="$ETC/cmds"
export CMDHISTMAX="100"
export PROFILE="$HOME/.profile"
export ENVDIR="$HOME/env"
export SETENV="$ETCsetenv/sh"
export LOGIN="$ETC/login/sh"
export INDENT=" "
# XDG.
export XDG_UTILS_DEBUG_LEVEL='3'
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/dat"
export PERSONAL_SHELL="sh"
export VIMRC="$HOME/.vimrc"
export XKB_DEFAULT_OPTIONS="caps:escape"
export SSH_ASKPASS=''
# Golang.
export GOPATH="$APP/go"
export GOBIN="$BIN"
export PATH="$PATH:$GOBIN"
# CLI.
export CLI_FILE_MANAGER=`which-first lf`
# X/Wayland stuff.
export XCOMPOSER='river'
export XTERMINAL='kitty'
export XINSIDE_TERMINAL='kitty'
export XRUNNER='fuzzel'
export XDMENU='fuzzel -d'
export XBAR='waybar'
export XBLUETOOTH_MANAGER='blueman-manager'
export XOUTPUT_DAEMON='kanshi'
export XSOUND_CONTROL='pavucontrol'
export XFILE_MANAGER="$XINSIDE_TERMINAL $CLI_FILE_MANAGER"
export XRESOURCE_MONITOR="$XINSIDE_TERMINAL htop"
export XCALENDAR="$XTERMINAL -e calcurse"
export XPUSH_NOTIFICATION_DAEMON='dunst'
export XNOTIFY='dunstify'
export XLOCKER='swaylock'
export XSUSPEND='systemctl suspend'
export XCLIPBOARD_MANAGER='clipman store'
export XEDITOR="`which-first nvim-qt`"
export XCLIPBOARD_TOOL="clipman pick --tool=CUSTOM --tool-args='$XDMENU'"
export XDISPLAY_REGION="slurp"
export XDISPLAY_SCREENSHOT="grim"
export XDISPLAY_REGION_SCREENSHOT='slurp | grim -g - - | wl-copy'
export XVIDEO_PLAYER='mpv'
export XLINK_VIDEO_PLAYER='mpv'
# Android.
export ANDROID_HOME="$HOME/app/android/Sdk"
#export ANDROID_SDK_HOME="$HOME/app/android-sdk"
export ANDROID_USER_HOME=$XDG_CONFIG_HOME/android
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
#export PATH="$PATH:$ANDROID_SDK_HOME/cmdline-tools/*/bin"
source-if-exist "$ETC/script/lf.sh"
test -r $SETENV && . "$SETENV" && setenv profile
# Visual editor.
vedit(){
$VISUAL $@
}
edit(){
$EDITOR $@
}
page() {
$PAGER $@
}
export GPG_TTY=$(tty)
export SSH_TTY=$(tty)