This commit is contained in:
tavo 2025-01-04 23:48:12 -06:00
parent f4b63aad61
commit 1d230d6fff
13 changed files with 328 additions and 250 deletions

View file

@ -1,5 +1,11 @@
#!/bin/bash
# $ printf '[ -f ~/.config/shell/bashrc ] && . ~/.config/shell/bashrc' | sudo tee -a /etc/bash.bashrc
if test -d ~/.config/shell/profile.d/; then
for profile in ~/.config/shell/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
case $- in
*i*) ;;
@ -24,6 +30,10 @@ HISTCONTROL=ignoreboth
HISTIZE=
HISTFILESIZE=
if [ -n "$HISTFILE" ] && ! [ -d "${HISTFILE%/*}" ] ; then
mkdir -p "${HISTFILE%/*}" && touch "$HISTFILE"
fi
format_workdir() {
CODE="$?"
ROOT_DIR="$(git rev-parse --show-toplevel 2>/dev/null)"

View file

@ -1,73 +0,0 @@
#!/bin/sh
# $ printf '[ -f ~/.config/shell/env ] && . ~/.config/shell/env' | sudo tee -a /etc/profile
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu/xclipmenu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/sway${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/dwm${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
PATH="$HOME/.local/state/nix/profile/bin${PATH:+:${PATH}}"
PATH="$HOME/.config/emacs/bin${PATH:+:${PATH}}"
export \
XDG_STATE_HOME="$HOME/.local/state" \
XDG_CACHE_HOME="$HOME/.local/cache" \
XDG_DATA_HOME="$HOME/.local/share" \
XDG_CONFIG_HOME="$HOME/.config" \
export \
BASH_ENV="$XDG_CONFIG_HOME/shell/bashrc" \
_JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java" \
MATHEMATICA_USERBASE="$XDG_CONFIG_HOME/mathematica" \
XCURSOR_PATH=/usr/share/icons:$XDG_DATA_HOME/icons \
GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" \
PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" \
TEXMFCONFIG="$XDG_CONFIG_HOME/texlive/texmf-config" \
TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var" \
TEXMFHOME="$XDG_DATA_HOME/texmf" \
VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc" \
XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" \
MBSYNCRC="$XDG_CONFIG_HOME/isync/mbsyncrc" \
XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" \
HISTFILE="$XDG_STATE_HOME/shell/bash_history" \
XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" \
LESSHISTFILE="$XDG_DATA_HOME/lesshst" \
ELECTRUMDIR="$XDG_DATA_HOME/electrum" \
CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv" \
WINEPREFIX="$HOME/.local/share/wine" \
WGETRC="$HOME/.config/wget/wgetrc" \
GNUPGHOME="$XDG_DATA_HOME/gnupg" \
GOPATH="$XDG_DATA_HOME/go" \
SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config" \
GIT_SSH_COMMAND="ssh -F ${XDG_CONFIG_HOME}/ssh/config" \
if [ -n "$HISTFILE" ] && ! [ -d "${HISTFILE%/*}" ] ; then
mkdir -p "${HISTFILE%/*}" && touch "$HISTFILE"
fi
export \
DATE=$(date -I) \
WEEK=$(date '+%U') \
export \
TERM="xterm-256color" \
BROWSER="firefox-hardened" \
EDITOR="nvim" \
VISUAL="nvim" \
export \
QT_QPA_PLATFORMTHEME="qt5ct" \
CM_SELECTIONS="clipboard" \
GTK_THEME="Materia:dark" \
XCURSOR_THEME="Adwaita" \
CM_MAX_CLIPS=10 \
export \
GIT="ssh://git@git.tavo.one/tavo" \
GITLAB="ssh://git@gitlab.com/tavo-wasd" \
HOMELAB="ssh://drive:/home/drive/drive" \
BOOKMARKS="$HOME/Documents/bookmarks" \
BIB="$HOME/Documents/bibliography" \

View file

@ -1,11 +0,0 @@
#!/bin/sh
export \
DATE=$(date -I) \
WEEK=$(date '+%U') \
VIMINIT="source $HOME/.config/vim/vimrc" \
EDITOR="nvim" \
VISUAL="nvim" \
GITLAB="ssh://git@gitlab.com/tavo-wasd" \
BOOKMARKS="$HOME/Documents/bookmarks" \
BIB="$HOME/Documents/bibliography" \

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
for f in pyv pyv_comp.bash ; do if [ -f ~/.local/share/pyv/$f ] ; then . ~/.local/share/pyv/$f ; fi ; done

View file

@ -0,0 +1,6 @@
export \
QT_QPA_PLATFORMTHEME="qt5ct" \
CM_SELECTIONS="clipboard" \
GTK_THEME="Materia:dark" \
XCURSOR_THEME="Adwaita" \
CM_MAX_CLIPS=10

View file

@ -0,0 +1,5 @@
export \
TERM="xterm-256color" \
BROWSER="firefox-hardened" \
EDITOR="nvim" \
VISUAL="nvim"

10
shell/profile.d/path.sh Normal file
View file

@ -0,0 +1,10 @@
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu/xclipmenu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/sway${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/dwm${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
PATH="$HOME/.local/state/nix/profile/bin${PATH:+:${PATH}}"
PATH="$HOME/.config/emacs/bin${PATH:+:${PATH}}"

7
shell/profile.d/pyv.sh Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
for f in pyv pyv_comp.bash ; do
if [ -f ~/.local/share/pyv/$f ] ; then
. ~/.local/share/pyv/$f
fi
done

View file

@ -0,0 +1,9 @@
export \
GIT="git@git.tavo.one:tavo" \
GITLAB="git@gitlab.com:tavo-wasd" \
GITHUB="git@github.com:tavo-wasd-gh" \
DRIVE="ssh://drive:/home/drive/drive" \
BOOKMARKS="$HOME/Documents/bookmarks" \
BIB="$HOME/Documents/bibliography" \
DATE=$(date -I) \
WEEK=$(date '+%U')

View file

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2034
# Unix shell script kit.
#
@ -33,9 +34,9 @@
# ## Tracking
#
# * Package: unix-shell-script-kit
# * Version: 12.1.1
# * Version: 12.3.0
# * Created: 2017-08-22T00:00:00Z
# * Updated: 2023-08-21T18:37:56Z
# * Updated: 2024-12-10T23:09:11Z
# * License: GPL-2.0 or GPL-3.0 or contact us for more
# * Website: https://github.com/sixarm/unix-shell-script-kit
# * Contact: Joel Parker Henderson (joel@sixarm.com)
@ -115,6 +116,7 @@ EXIT_SUCCESS=0
# E.g. an error, an abort, found no results, lack of data, etc.
#
# Exit 1 meaning failure is a widespread convention as a catch-all code.
#
EXIT_FAILURE=1
# Usage
@ -416,6 +418,94 @@ EXIT_CODE_INVALID=128
#
EXIT_CODE_INVALID=128
##
# Color helpers
##
# ANSI escape color codes. Use these directly. Do not use "tput".
#
# Example:
#
# printf "%sblack\n" $COLOR_BLACK
# printf "%sred\n" $COLOR_RED
# printf "%sgreen\n" $COLOR_GREEN
# printf "%syellow\n" $COLOR_YELLOW
# printf "%sblue\n" $COLOR_BLUE
# printf "%smagenta\n" $COLOR_MAGENTA
# printf "%scyan\n" $COLOR_CYAN
# printf "%swhite\n" $COLOR_WHITE
#
# For the widest support, use the basic set of 8 colors below,
# and respect the user preferences by using the color() function.
#
# Many terminals also support "bright" or "bold" colors;
# these colors have their own set of codes, similar to the
# basic colors yet with an additional ;1 in their codes.
# We do not recommend using these colors in your shell scripts,
# because so many users prefer to set their own terminal colors.
# Reset all color information
COLOR_RESET=''
# Basic Foreground
COLOR_BLACK=''
COLOR_RED=''
COLOR_GREEN=''
COLOR_YELLOW=''
COLOR_BLUE=''
COLOR_MAGENTA=''
COLOR_CYAN=''
COLOR_WHITE=''
# Basic Background
COLOR_BG_BLACK=''
COLOR_BG_RED=''
COLOR_BG_GREEN=''
COLOR_BG_YELLOW=''
COLOR_BG_BLUE=''
COLOR_BG_MAGENTA='[$5m'
COLOR_BG_CYAN=''
COLOR_BG_WHITE=''
# color: should the program use color?
#
# The color logic heuristic in order of priority:
# 1. If NO_COLOR is set to non-empty, then no.
# 2. If CLICOLOR_FORCE is set to non-empty, then yes.
# 3. If the TERM is set to "dumb", then no.
# 4. If the output is on a terminal, then yes.
# 5. Otherwise, no.
#
color() {
if [ -n "${NO_COLOR:-}" ]; then return 0; fi
if [ -n "${CLICOLOR_FORCE:-}" ]; then return 1; fi
if [ "${TERM:-}" = "dumb" ]; then return 0; fi
return 1
}
# Set standard output color start/stop and standard error color start/stop.
# These variables are used by the out() function and err() function below.
#
# If you wish to set these in your terminal, and your terminal supports
# dollar strings with \E meaning escape, then you can use the following:
#
# export STDOUT_COLOR_START=$'\E[34m'
# export STDOUT_COLOR_STOP=$'\E[0m'
# export STDERR_COLOR_START=$'\E[31m'
# export STDERR_COLOR_STOP=$'\E[0m'
#
if color; then
: ${STDOUT_COLOR_START=''}
: ${STDOUT_COLOR_STOP=''}
: ${STDERR_COLOR_START=''}
: ${STDERR_COLOR_STOP=''}
else
: ${STDOUT_COLOR_START=''}
: ${STDOUT_COLOR_STOP=''}
: ${STDERR_COLOR_START=''}
: ${STDERR_COLOR_STOP=''}
fi
##
# Input/output helpers
##
@ -438,7 +528,7 @@ EXIT_CODE_INVALID=128
# * Use the `err` function to print to STDERR.
#
out() {
printf %s\\n "$*"
printf %s%s%s\\n "${STDOUT_COLOR_START:-}" "$*" "${STDOUT_COLOR_STOP:-}"
}
# err: print error message to stderr.
@ -459,7 +549,7 @@ out() {
# * Use the `err` function to print to STDERR.
#
err() {
>&2 printf %s\\n "$*"
>&2 printf %s%s%s\\n "${STDERR_COLOR_START:-}" "$*" "${STDERR_COLOR_STOP:-}"
}
# die: print error message to stderr, then exit with error code.
@ -470,8 +560,22 @@ err() {
# STDERR=> my message
# => exit 1
# ```
#
# Example with an exit code number and name:
# ```
# die $EXIT_UNAVAILABLE EXIT_UNAVAILABLE
# STDERR=> EXIT_UNAVAILABLE
# => exit 69
# ```
#
# Example with more information:
# ```
# false || die $? "Fatal error $? on line $LINENO of $0"
# STDERR=> Fatal error 1 on line 2 of example.sh"
# => exit 1
# ```
die() {
n="$1" ; shift ; >&2 printf %s\\n "$*" ; exit "$n"
n="$1" ; shift ; err "$*"; exit "$n"
}
# big: print a big banner to stdout, good for human readability.
@ -526,7 +630,103 @@ zid() {
# => prompt
# ```
ask() {
read x ; echo "$x" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
read -r x ; echo "$x" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
}
# utf8: should the program print UTF-8 characters such as accents and emoji?
#
# This implementation is a heuristic and subject to change as we learn more.
# This checks the locale charmap. However, it's possible for the charmap to
# be set to UTF-8, but the terminal is unable to render UTF-8 characters.
#
# Example:
# ```
# utf8
# => true
# ```
utf8() {
if [ "$(locale charmap)" = "UTF-8" ]; then return 0; fi
return 1
}
##
# Print messages with pretty formatting, colors, emojis, etc.
##
# Set pretty display of messages for success, warning, failure.
#
# If you wish to set these in your terminal, and your terminal supports
# dollar strings with \E meaning escape, then you can use the following:
#
# export PRINT_SUCCESS_START=$'\E[32m✅ Success: '
# export PRINT_SUCCESS_START=$'\E[35m⚠ Warning: '
# export PRINT_FAILURE_START=$'\E[31m❌ Failure: '
#
if color && utf8; then
: ${PRINT_SUCCESS_START='✅ Success: '}
: ${PRINT_SUCCESS_STOP=''}
: ${PRINT_WARNING_START='⚠ Warning: '}
: ${PRINT_WARNING_START=''}
: ${PRINT_FAILURE_START='❌ Failure: '}
: ${PRINT_FAILURE_STOP=''}
else
: ${PRINT_SUCCESS_START='Success: '}
: ${PRINT_SUCCESS_STOP=''}
: ${PRINT_WARNING_START='Warning: '}
: ${PRINT_WARNING_START=''}
: ${PRINT_FAILURE_START='Failure: '}
: ${PRINT_FAILURE_STOP=''}
fi
# print_success: print a success message to stdout.
#
# Example:
# ```
# print_success "This is a success message."
# => This is a success message.
# ```
#
# The output can be customized by setting:
#
# * PRINT_SUCCESS_START
# * PRINT_SUCCESS_STOP
#
print_success() {
printf %s%s%s\\n "${PRINT_SUCCESS_START:-}" "$*" "${PRINT_SUCCESS_STOP:-}"
}
# print_warning: print a warning message to stdout.
#
# Example:
# ```
# print_warning "This is a warning message."
# => This is a warning message.
# ```
#
# The output can be customized by setting:
#
# * PRINT_WARNING_START
# * PRINT_WARNING_STOP
#
print_warning() {
printf %s%s%s\\n "${PRINT_WARNING_START:-}" "$*" "${PRINT_WARNING_STOP:-}"
}
# print_failure: print a failure message to stdout.
#
# Example:
# ```
# print_failure "This is a failure message."
# => This is a failure message.
# ```
#
# The output can be customized by setting:
#
# * PRINT_FAILURE_START
# * PRINT_FAILURE_STOP
#
print_failure() {
printf %s%s%s\\n "${PRINT_FAILURE_START:-}" "$*" "${PRINT_FAILURE_STOP:-}"
}
##
@ -562,8 +762,8 @@ ask() {
# because this script sends the args along to the system "date" command.
# For example Linux GNU "date" handles this, but macOS BSD "date" doesn't.
#
# shellcheck disable=SC2120
now() {
# shellcheck disable=SC2120
date -u "+%Y-%m-%dT%H:%M:%S.%N+00:00" "$@" | sed 's/N/000000000/'
}
@ -776,7 +976,7 @@ command_version_exists_or_die() {
# var_exists FOO
# => false
# ```
var() {
var_exists() {
! eval 'test -z ${'$1'+x}'
}
@ -1752,6 +1952,38 @@ assert_str_ends_with() {
[ "$1" != "${1%"$2"}" ] || err assert_str_ends_with "$@"
}
# assert_eval_int_eq_x: assert an eval into an integer is equal to an expression.
#
# Example:
# ```
# assert_eval_int_eq_x 'echo "1"' 1
# => success i.e. no output
#
# assert_eval_int_eq_x 'echo "1"' 2
# STDERR=> assert_eval_int_eq_x echo "1" 2
# ```
assert_eval_int_eq_x() {
if [ ! "$(eval "$1")" -eq "$2" ]; then
err assert_eval_int_eq_x "$@"
fi
}
# assert_eval_str_eq_x: assert an eval into a string is equal to an expression.
#
# Example:
# ```
# assert_eval_str_eq_x 'echo "foo"' foo
# => success i.e. no output
#
# assert_eval_str_eq_x 'echo "foo"' bar
# STDERR=> assert_eval_str_eq_x echo "foo" bar
# ```
assert_eval_str_eq_x() {
if [ ! "$(eval "$1")" = "$2" ]; then
err assert_eval_str_eq_x "$@"
fi
}
##
# Make temp helpers
##
@ -1926,10 +2158,14 @@ file_ends_with_newline() {
#
user_dir(){
upper=$(printf %s\\n "$1" | tr '[:lower:]' '[:upper:]')
x=$(set +u; eval printf "%s\\\\n" \$${upper}_DIR)
if [ -n "$x" ]; then printf %s\\n "$x"; return; fi
x=$(set +u; eval printf "%s\\\\n" \$${upper}_HOME)
if [ -n "$x" ]; then printf %s\\n "$x"; return; fi
x=$(set +u; eval printf "%s\\\\n" \$XDG_${upper}_DIR)
if [ -n "$x" ]; then printf %s\\n "$x"; return; fi
x=$(set +u; eval printf "%s\\\\n" \$XDG_${upper}_HOME)
if [ -n "$x" ]; then printf %s\\n "$x"; return; fi
lower=$(printf %s\\n "$1" | tr '[:upper:]' '[:lower:]')
a=$(eval printf "%s\\\\n" \$${upper}_DIR)
b=$(eval printf "%s\\\\n" \$${upper}_HOME)
c=$(eval printf "%s\\\\n" \$XDG_${upper}_DIR)
d=$(eval printf "%s\\\\n" \$XDG_${upper}_HOME)
printf %s\\n "${a:=${b:=${c:=${d:=$HOME/$lower}}}}"
printf %s\\n "$HOME/$lower"
}

View file

@ -0,0 +1,31 @@
export \
XDG_STATE_HOME="$HOME/.local/state" \
XDG_CACHE_HOME="$HOME/.local/cache" \
XDG_DATA_HOME="$HOME/.local/share" \
XDG_CONFIG_HOME="$HOME/.config"
export \
BASH_ENV="$XDG_CONFIG_HOME/shell/bashrc" \
_JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java" \
MATHEMATICA_USERBASE="$XDG_CONFIG_HOME/mathematica" \
XCURSOR_PATH=/usr/share/icons:$XDG_DATA_HOME/icons \
GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" \
PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" \
TEXMFCONFIG="$XDG_CONFIG_HOME/texlive/texmf-config" \
TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var" \
TEXMFHOME="$XDG_DATA_HOME/texmf" \
VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc" \
XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" \
MBSYNCRC="$XDG_CONFIG_HOME/isync/mbsyncrc" \
XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" \
HISTFILE="$XDG_STATE_HOME/shell/bash_history" \
XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" \
LESSHISTFILE="$XDG_DATA_HOME/lesshst" \
ELECTRUMDIR="$XDG_DATA_HOME/electrum" \
CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv" \
WINEPREFIX="$XDG_DATA_HOME/wine" \
WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" \
GNUPGHOME="$XDG_DATA_HOME/gnupg" \
GOPATH="$XDG_DATA_HOME/go" \
SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config" \
GIT_SSH_COMMAND="ssh -F ${XDG_CONFIG_HOME}/ssh/config"

View file

@ -1,149 +0,0 @@
#+title: Tavo's rc file
#+property: header-args :tangle bashrc
* Non-interactive
** PATH
#+begin_src shell
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu/xclipmenu${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/sway${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/dwm${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
#PATH="/usr/local/plan9/bin${PATH:+:${PATH}}"
#+end_src
** Environment
#+begin_src shell
export \
GITLAB="ssh://git@gitlab.com/tavo-wasd" \
BOOKMARKS="$HOME/Documents/bookmarks" \
BIB="$HOME/Documents/bibliography" \
[ -f ~/.config/shell/env ] && . ~/.config/shell/env
#+end_src
* Interactive
#+begin_src shell
case $- in
*i*) ;;
*) return;;
esac
#+end_src
** Bash-only config
#+begin_src bash
if ! shopt -oq posix; then
for comp in /usr/share/bash-completion/bash_completion /etc/bash_completion; do
[ -f $comp ] && . $comp && break
done
fi
bind "set completion-ignore-case on"
shopt -s checkwinsize
shopt -s histappend
complete -cf doas
shopt -s cdspell
shopt -s autocd
set -o vi
#+end_src
** Prompt
#+begin_src shell
git_branch() {
GIT_BRANCH="$(git branch 2>/dev/null | sed '/\*/!d;s/^\*\s*//g;s/\s*$//g')"
[ -n "$GIT_BRANCH" ] && printf "%s " "$GIT_BRANCH"
}
[ -e "/data/data/com.termux" ] && HOSTNAME=""
[ "${HOSTNAME:=$(hostname -s)}" = "laptop" ] && HOSTNAME="󰌢"
[ "${HOSTNAME:=$(hostname -s)}" = "desktop" ] && HOSTNAME="󰇅"
#+end_src
*** Bash-only PS1
#+begin_src bash
PS1='
\[\e[48;5;7m\] \[\e[38;5;240m\]\[\e[48;5;7m\]$?\[\e[38;5;7m\]\[\e[48;5;108m\]\
\[\e[38;5;235m\]\[\e[48;5;108m\] ${HOSTNAME} \[\e[38;5;108m\]\[\e[48;5;66m\]\
\[\e[48;5;66m\]\[\e[38;5;235m\] \W \[\e[45;0m\]\[\e[38;5;66m\]\
\[\e[38;5;240m\] \@ \[\e[1;38;5;5m\]$(git_branch)\[\e[48;0m\]
\[\e[38;5;240m\] ╰─\$\[\e[0m\] '
#+end_src
** Aliases
#+begin_src shell
alias \
src="cd $HOME/.local/src/ && ls" \
cfg="cd $HOME/.config/ && ls" \
tmp="cd $HOME/Desktop/temp/ && ls" \
dsk="cd $HOME/Desktop/ && ls" \
prj="cd $HOME/Desktop/projects/ && ls" \
doc="cd $HOME/Documents/ && ls" \
dow="cd $HOME/Downloads/ && ls" \
mus="cd $HOME/Music/ && ls" \
prt="cd $HOME/Pictures/Screenshots/ && ls" \
bkg="cd $HOME/Pictures/Backgrounds/ && ls" \
img="cd $HOME/Pictures/ && ls" \
vid="cd $HOME/Videos/ && ls" \
fzf="fzf --cycle --reverse" \
diff="diff --color=auto" \
grep="grep --color=auto" \
calc="bc -l" \
ls="ls -Alogh --color=auto --time-style=iso" \
cp="cp -iv" \
mv="mv -iv" \
vim="nvim" \
df-short="df -h | grep -v '\s/dev.*$\|\s/run.*$\|\s/boot.*$'" \
qr-png="qrencode -s 16 -o qr.png" \
qr="qrencode -t ansiutf8" \
if [ "${XDG_SESSION_TYPE}" = "wayland" ] ; then
alias clip="wl-copy"
fi
if [ "${XDG_SESSION_TYPE}" = "x11" ] ; then
alias clip="xsel -ib"
fi
! command -v sudo >/dev/null 2>&1 && alias sudo="doas"
command -v exa >/dev/null 2>&1 && alias ls="exa -al --icons --group-directories-first --no-permissions --no-user --time-style=iso --git"
command -v eza >/dev/null 2>&1 && alias ls="eza -al --icons --group-directories-first --no-permissions --no-user --time-style=iso --git"
command -v trash >/dev/null 2>&1 && alias rm="trash"
#+end_src
** Utils
#+begin_src shell
util_get_ssid() {
[ -e "/sbin/iw" ] && iw="/sbin/iw"
iw="${iw:=$(command -v iw)}"
[ "${iw}" ] || return 1
int="$(sed '/:/!d;s/^ *//;s/:.*$//' /proc/net/wireless)"
if [ "$int" ] && grep 'up' /sys/class/net/w*/operstate >/dev/null 2>&1 ; then
"${iw}" "${int}" link | sed '/SSID/!d;s/^.*: //'
fi
}
#+end_src
** Startup
#+begin_src shell
if [ "$(tty)" = "/dev/tty1" ] ; then
sleep 0.5
amixer &
#exec startx
exec sway
fi
command -v fetch >/dev/null 2>&1 && fetch min
#+end_src