#!/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 } usctl(){ systemctl --user $@ } 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 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="" export ENV="$HOME/.shrc" export PROMPT="; " export PS1="$PROMPT" export SUDO_PROMPT="# " 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. # Programs. export OPENER="`which-first xdg-open`" export EDITOR=`which-first nvim vim vi ed` export VISUAL="$EDITOR" export GIT_EDITOR="$VISUAL" export PAGER=`which-first moar bat less more cat` export MANPAGER="`which-first moar less more`" export CLI_DMENU=`which-first fzf` export CLI_FILE_MANAGER=`which-first lf` export XCOMPOSER='river' export XTERMINAL='kitty -1 --instance-group "$DISPLAY"' export XINSIDE_TERMINAL='kitty -1 --instance-group "$DISPLAY"' 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='$XINSIDE_TERMINAL calcurse' export XPUSH_NOTIFICATION_DAEMON='dunst' export XNOTIFY='dunstify' export XLOCKER='swaylock' export XSUSPEND='systemctl suspend' export XCLIPBOARD_MANAGER='clipman store' export XCLIPBOARD_DAEMON='wl-paste -t text --watch $XCLIPBOARD_MANAGER' export XCLIPBOARD_TOOL='clipman pick --tool=CUSTOM --tool-args="$XDMENU"' export XEDITOR="`which-first nvim-qt`" 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' export XTYPE='wtype' 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' # 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. ve(){ $VISUAL $@ } # Editor. e(){ $EDITOR $@ } # Run pager. p() { $PAGER $@ } q() { exit } # Manual find. manf() { if test -z "$CLI_DMENU" ; then echo No 'no $CLI_DMENU env' return 1 fi man `man -k . | $CLI_DMENU -e -1 $(if test ! -z $@ ; then echo -- -q "$@" ; fi ) | awk '{print $1}'` } export GPG_TTY=$(tty) export SSH_TTY=$(tty)