# Simple shell aliasing alias emacs="TERM=screen-256color emacsclient -t" alias systemctl="sudo systemctl" alias userctl="\systemctl --user" alias ujournalctl="\journalctl --user" alias reconf="exec zsh" alias cp="cp -i --reflink=auto" alias mv="mv -i" alias rm="rm -i" alias virsh="\virsh -c qemu:///system" alias ls='ls --color=tty' alias ll='ls -lh' alias la='ls -lAh' alias l='ls -lh' alias nuke='echo "Are you sure?"; read -q && rm -rf' alias pkgfile='pkgfile -D $HOME/.cache/pkgfile' alias sign='gpg --sign-with ezri@ezri.dev --detach-sign' alias verify='gpg --verify' alias dnslookup="resolvectl query" alias ip="ip -color=auto" alias bw-personal='BITWARDENCLI_APPDATA_DIR=~/.config/bw-cli-personal bw' function didifuckingstutter { echo $fg[blue]Apologies, milady. Right away.$fg[default] # Run the last command as root last_cmd=$(fc -ln -1) # if last command was emacs, use TRAMP rather than running as root if [[ $last_cmd =~ "^emacs .*" ]]; then cmd="emacsclient -t /sudo::$(echo $last_cmd | cut -d' ' -f2-)" echo "> $fg[white]$cmd$fg[default]" $=cmd else cmd="sudo zsh -c '$(fc -ln -1)'" echo "> $fg[white]$cmd$fg[default]" sudo -p "$fg[red]I'll need your authorization:$fg[default] " $last_cmd fi } function pygrep { success=0 for pid in $(pgrep python); do if cut -d '' -f2 /dev/null; then echo $pid success=1 fi done if ! ((success)); then return 1 fi } function create-discord-timestamp { date --date="$(echo $@)" +'' | tee >(tr -d '\n' | cbcopy) } function copy-text { echo -n $@ | cbcopy } function cbcopy { x_args='-sel clip' if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then wl_args='--primary' x_args='' fi if [[ -x $(command -v wl-copy) ]]; then # Prioritize wayland wl-copy $wl_args return $? fi if [[ -x $(command -v xclip) ]]; then # Next do Xorg xclip $x_args return $? fi if [[ -x $(command -v pbcopy) ]]; then pbcopy return $? fi echo "No known clipboard commands available" return 1 } function cbpaste { x_args='-sel clip' if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then wl_args='--primary' x_args='' fi if [[ -x $(command -v wl-copy) ]]; then # Prioritize wayland wl-paste $wl_args return $? fi if [[ -x $(command -v xclip) ]]; then # Next do Xorg xclip -o $x_args return $? fi if [[ -x $(command -v pbcopy) ]]; then pbpaste return $? fi echo "No known clipboard commands available" >/dev/stderr return 1 } function mkcd { [[ -e $1 ]] || mkdir -p $1 cd $1 } alias ppctl='/usr/bin/python3 /usr/bin/powerprofilesctl'