etc/dot/file/profile

228 lines
4.8 KiB
Text
Raw Normal View History

2020-11-04 02:03:20 +03:00
#!/bin/sh
2024-02-21 15:47:10 +03:00
#
# Profile of Surdeus.
2024-07-11 10:28:52 +03:00
#
2024-08-17 02:40:54 +03:00
# The main configuraton for each PC via the env directory.
export ETC="$HOME/etc"
export ENVDIR="$HOME/env"
export SETENV="$ETC/setenv/sh"
2024-07-11 10:28:52 +03:00
reload-profile(){
. $PROFILE
}
2020-11-04 02:03:20 +03:00
2024-08-17 02:40:54 +03:00
use-nvidia(){
. $ETC/script/use-nvidia.sh
}
2024-07-12 18:54:58 +03:00
no-output() {
$@ &> /dev/null
}
2024-07-27 16:59:17 +03:00
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
}
2024-07-30 20:24:58 +03:00
usctl(){
systemctl --user $@
}
sctl(){
systemctl $@
}
jctl(){
journalctl $@
}
2024-07-12 18:40:54 +03:00
export-loop(){
2020-11-04 02:03:20 +03:00
# 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.
2024-04-06 17:43:22 +03:00
while test -n "$1" ; do
2020-11-04 02:03:20 +03:00
# Doing until we have arguments.
value="$(eval echo $2)"
name="$1"
export "$name"="$value"
shift 2
done
}
2024-07-27 04:42:05 +03:00
which-first() {
ret=""
for prog in $@ ; do
if no-output which "$prog" ; then
ret="$prog"
break
fi
done
which "$ret"
}
2024-07-12 18:40:54 +03:00
source-if-exist() {
for i in $@ ; do
if test -r "$i" ; then
. "$i"
fi
done
}
2024-04-06 17:43:22 +03:00
if test "$OS" != "Windows_NT" ; then
2023-08-30 11:13:45 +03:00
PATH="$HOME/exe:$HOME/.local/bin:$PATH"
fi
2024-07-18 18:01:51 +03:00
2024-08-15 05:44:36 +03:00
# Preconfig.
2024-07-18 18:01:51 +03:00
export APP="$HOME/app"
export BIN="$HOME/bin"
export LOAD="$HOME/load"
export PATH="$PATH:$BIN"
export GIT="https://surdeus.su"
export DEV="$HOME/dev"
2024-08-15 05:44:36 +03:00
export PATH="$PATH:$BIN"
2024-12-19 11:56:59 +03:00
export PATH="$PATH:$HOME/.cargo/bin"
2024-07-18 18:01:51 +03:00
# CLI.
2024-08-15 05:44:36 +03:00
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64"
export LANG="en_US.UTF-8"
2024-07-28 01:04:29 +03:00
export LESS=""
2024-07-18 18:01:51 +03:00
export ENV="$HOME/.shrc"
export PROMPT="; "
export PS1="$PROMPT"
export SUDO_PROMPT="# "
export CMDHIST="$ETC/cmds"
export CMDHISTMAX="100"
export PROFILE="$HOME/.profile"
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"
2024-10-03 00:38:07 +03:00
export PATH="/usr/local/go/bin:$PATH"
2024-07-18 18:01:51 +03:00
export PATH="$PATH:$GOBIN"
2024-07-27 04:42:05 +03:00
# CLI.
2024-07-29 10:40:41 +03:00
# Programs.
2024-08-02 10:23:52 +03:00
export KITTY_CONFIG_DIRECTORY="$ETC/kitty"
2024-07-29 10:40:41 +03:00
export OPENER="`which-first xdg-open`"
2024-12-19 11:56:59 +03:00
export EDITOR=`which-first hx nvim vim vi ed`
2024-07-29 10:40:41 +03:00
export VISUAL="$EDITOR"
export GIT_EDITOR="$VISUAL"
export PAGER=`which-first moar bat less more cat`
export MANPAGER="`which-first moar less more`"
2024-07-28 01:04:29 +03:00
export CLI_DMENU=`which-first fzf`
2024-07-27 04:42:05 +03:00
export CLI_FILE_MANAGER=`which-first lf`
2024-12-19 11:56:59 +03:00
# Xorg
export XAUTHORITY=$HOME/.Xauthority
export XINITRC=$ETC/x/xinitrc
2024-08-15 05:44:36 +03:00
# GUI programs.
2024-07-18 18:01:51 +03:00
export XCOMPOSER='river'
2024-07-30 20:24:58 +03:00
export XTERMINAL='kitty -1 --instance-group "$DISPLAY"'
export XINSIDE_TERMINAL='kitty -1 --instance-group "$DISPLAY"'
2024-07-18 18:01:51 +03:00
export XRUNNER='fuzzel'
export XDMENU='fuzzel -d'
export XBAR='waybar'
export XBLUETOOTH_MANAGER='blueman-manager'
export XOUTPUT_DAEMON='kanshi'
export XSOUND_CONTROL='pavucontrol'
2024-07-29 10:40:41 +03:00
export XFILE_MANAGER='$XINSIDE_TERMINAL $CLI_FILE_MANAGER'
export XRESOURCE_MONITOR='$XINSIDE_TERMINAL htop'
2024-07-30 20:24:58 +03:00
export XCALENDAR='$XINSIDE_TERMINAL calcurse'
2024-07-27 04:42:05 +03:00
export XPUSH_NOTIFICATION_DAEMON='dunst'
export XNOTIFY='dunstify'
export XLOCKER='swaylock'
export XSUSPEND='systemctl suspend'
2024-07-29 10:40:41 +03:00
2024-07-27 04:42:05 +03:00
export XCLIPBOARD_MANAGER='clipman store'
2024-07-29 10:40:41 +03:00
export XCLIPBOARD_DAEMON='wl-paste -t text --watch $XCLIPBOARD_MANAGER'
export XCLIPBOARD_TOOL='clipman pick --tool=CUSTOM --tool-args="$XDMENU"'
2024-07-27 04:42:05 +03:00
export XEDITOR="`which-first nvim-qt`"
2024-07-29 10:40:41 +03:00
export XDISPLAY_REGION='slurp'
2024-07-18 18:01:51 +03:00
export XDISPLAY_SCREENSHOT="grim"
export XDISPLAY_REGION_SCREENSHOT='slurp | grim -g - - | wl-copy'
2024-07-26 01:31:29 +03:00
export XVIDEO_PLAYER='mpv'
export XLINK_VIDEO_PLAYER='mpv'
2024-07-28 01:04:29 +03:00
export XTYPE='wtype'
2024-07-29 10:40:41 +03:00
export XBACKGROUND_DAEMON='swaybg -m fill -i $ETC/img/eat-sleep-code-repeat.png'
export XBLUETOOTH_APPLET='blueman-applet'
export RIVER_TILER='rivertile -view-padding 0 -outer-padding 0'
2024-07-18 18:01:51 +03:00
# 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"
2024-07-15 21:40:20 +03:00
2024-07-12 18:40:54 +03:00
source-if-exist "$ETC/script/lf.sh"
2020-11-04 02:03:20 +03:00
2024-06-23 14:45:24 +03:00
# Visual editor.
2024-07-30 20:24:58 +03:00
ve(){
2024-07-27 04:42:05 +03:00
$VISUAL $@
}
2024-07-28 01:04:29 +03:00
# Editor.
2024-07-30 20:24:58 +03:00
e(){
2024-07-27 04:42:05 +03:00
$EDITOR $@
}
2024-07-28 01:04:29 +03:00
# Run pager.
2024-07-30 20:24:58 +03:00
p() {
2024-07-27 04:42:05 +03:00
$PAGER $@
}
2024-03-03 23:02:04 +03:00
2024-07-30 20:24:58 +03:00
q() {
exit
}
2024-07-28 01:04:29 +03:00
# Manual find.
manf() {
2024-07-29 10:40:41 +03:00
if test -z "$CLI_DMENU" ; then
echo No 'no $CLI_DMENU env'
return 1
fi
2024-08-15 05:44:36 +03:00
pagename=`man -k . | $CLI_DMENU -e -1 $(if test ! -z $@ ; then echo -- -q "$@" ; fi ) | awk '{print $1}'`
if test -z "$pagename" ; then
return 1
fi
man "$pagename"
2024-07-28 01:04:29 +03:00
}
2024-07-18 18:01:51 +03:00
2022-09-05 18:07:23 +03:00
export GPG_TTY=$(tty)
2022-09-06 19:17:21 +03:00
export SSH_TTY=$(tty)
2022-09-05 18:07:23 +03:00
2024-08-17 02:43:04 +03:00
test -r "$SETENV" && . "$SETENV" && setenv profile
2024-07-30 20:24:58 +03:00
2024-12-19 11:56:59 +03:00
. "$HOME/.cargo/env"