#!/bin/sh catclip () { if [ -n "$WAYLAND_DISPLAY" ]; then cat $@ | wl-copy elif [ -n "$DISPLAY" ]; then cat $@ | xclip -selection clipboard fi } catpass () { PASSWD=$(cat ~/pass.txt); echo "$PASSWD\n$PASSWD" | pass insert "$1"; unset PASSWD } mpt () { for i in $@; do echo "" > $i done } mkcd () { mkdir -p $@ && cd $1 } ntharg () { shift $1 printf '%s\n' "$1" } mvcd () { mv $@ && cd `ntharg $# "$@"` } if [[ "$SHELL" =~ .*zsh$ ]]; then zshaddhistory () { emulate -L zsh if [[ $1 != *"veracrypt"* ]]; then print -sr -- "${1%%$'\n'}" fc -p elif [[ $1 != *"cryptsetup"* ]]; then print -sr -- "${1%%$'\n'}" fc -p else return 1 fi } fi scd () { if [ "$1" = "" ]; then cd $HOME else case "$1" in "-h") # STARTPRINT echo "scd - a script to change directories based on shortcuts. E. - /etc O. - /opt Oa - /opt/Audio Assault R - / U. - /usr Us - /usr/share V. - /var aw - /home/zachir/.config/awesome b. - /home/zachir/.local/bin bb - /home/zachir/.local/bin/blocks bf - /home/zachir/.local/bin/slatpak-sc bg - /home/zachir/.local/bin/generics bi - /home/zachir/.local/bin/ignore bsc - /home/zachir/.local/bin/scripts bsh - /home/zachir/.local/bin/shortcmds bsp - /home/zachir/.local/bin/sp c - /home/zachir/.config db - /home/zachir/.local/src/dwmbar dc - /home/zachir/Documents dl - /home/zachir/.local/src/dwl dm - /home/zachir/.local/src/dmenu do - /home/zachir/Downloads dp - /home/zachir/Downloads/plugin/zachir_librem.one dw - /home/zachir/Downloads/wine e - /home/zachir/Desktop f - /home/zachir/.var/app h - /home/zachir/.config/hypr lb - /home/zachir/.local/bin lc - /home/zachir/Games/cache lf - /home/zachir/.config/lf ls - /home/zachir/.local/share n3 - /home/zachir/.vst3/native ns - /home/zachir/.vst/native nv - /home/zachir/.config/nvim p - /home/zachir/Pictures qb - /home/zachir/.config/qutebrowser qp - /home/zachir/.local/share/qutebrowser-profiles re - /home/zachir/.local/src rs - /etc/runit/sv sc - /home/zachir/.local/bin/scripts sh - /home/zachir/.config/sh sl - /home/zachir/.local/src/slock ss - /etc/s6/sv st - /home/zachir/.local/src/st sx - /home/zachir/.config/sxhkd tr - /home/zachir/.local/share/Trash/files urs - /home/zachir/.runit/sv v3. - /home/zachir/.vst3 v3n - /home/zachir/.vst3/native v3y - /home/zachir/.vst3/yabridge v. - /home/zachir/var vi - /home/zachir/Videos vsn - /home/zachir/.vst/native vs. - /home/zachir/.vst vsy - /home/zachir/.vst/yabridge wdo - /home/zachir/.local/share/wineprefixes/default/drive_c/users/zachir/Downloads wa - /home/zachir/.local/src/wallpapers wd - /home/zachir/.local/share/wineprefixes/default wr - /home/zachir/.local/share/wineprefixes wv3 - /home/zachir/.winvst3 wvs - /home/zachir/.winvst ww - /home/zachir/.local/share/wineprefixes/work x - /home/zachir/.config/X11 y3 - /home/zachir/.vst3/yabridge yb - /home/zachir/.cache/yay yc - /home/zachir/.config/yay zs - /home/zachir/.config/zsh zx - /home/zachir/Documents/zachir.xyz " ;; # STOPPRINT # STARTPATHS "E.") cd "/etc" ;; "O.") cd "/opt" ;; "Oa") cd "/opt/Audio Assault" ;; "R") cd "/" ;; "U.") cd "/usr" ;; "Us") cd "/usr/share" ;; "V.") cd "/var" ;; "aw") cd "$XDG_CONFIG_HOME/awesome" ;; "b.") cd "$HOME/.local/bin" ;; "bb") cd "$HOME/.local/bin/blocks" ;; "bf") cd "$HOME/.local/bin/slatpak-sc" ;; "bg") cd "$HOME/.local/bin/generics" ;; "bi") cd "$HOME/.local/bin/ignore" ;; "bsc") cd "$HOME/.local/bin/scripts" ;; "bsh") cd "$HOME/.local/bin/shortcmds" ;; "bsp") cd "$HOME/.local/bin/sp" ;; "c") cd "$XDG_CONFIG_HOME" ;; "db") cd "$SRCDIR/dwmbar" ;; "dc") cd "$XDG_DOCUMENTS_DIR" ;; "dl") cd "$SRCDIR/dwl" ;; "dm") cd "$SRCDIR/dmenu" ;; "do") cd "$XDG_DOWNLOAD_DIR" ;; "dp") cd "$XDG_DOWNLOAD_DIR/plugin/zachir_librem.one" ;; "dw") cd "$XDG_DOWNLOAD_DIR/wine" ;; "e") cd "$XDG_DESKTOP_DIR" ;; "f") cd "$HOME/.var/app" ;; "h") cd "$XDG_CONFIG_HOME/hypr" ;; "lb") cd "$HOME/.local/bin" ;; "lc") cd "$HOME/Games/cache" ;; "lf") cd "$XDG_CONFIG_HOME/lf" ;; "ls") cd "$XDG_DATA_HOME" ;; "n3") cd "$HOME/.vst3/native" ;; "ns") cd "$HOME/.vst/native" ;; "nv") cd "$XDG_CONFIG_HOME/nvim" ;; "p") cd "$XDG_PICTURES_DIR" ;; "qb") cd "$XDG_CONFIG_HOME/qutebrowser" ;; "qp") cd "$XDG_DATA_HOME/qutebrowser-profiles" ;; "re") cd "$SRCDIR" ;; "rs") cd "/etc/runit/sv" ;; "sc") cd "$HOME/.local/bin/scripts" ;; "sh") cd "$XDG_CONFIG_HOME/sh" ;; "sl") cd "$SRCDIR/slock" ;; "ss") cd "/etc/s6/sv" ;; "st") cd "$SRCDIR/st" ;; "sx") cd "$XDG_CONFIG_HOME/sxhkd" ;; "tr") cd "$XDG_DATA_HOME/Trash/files" ;; "urs") cd "$HOME/.runit/sv" ;; "v3.") cd "$HOME/.vst3" ;; "v3n") cd "$HOME/.vst3/native" ;; "v3y") cd "$HOME/.vst3/yabridge" ;; "v.") cd "$HOME/var" ;; "vi") cd "$XDG_VIDEOS_DIR" ;; "vsn") cd "$HOME/.vst/native" ;; "vs.") cd "$HOME/.vst" ;; "vsy") cd "$HOME/.vst/yabridge" ;; "wdo") cd "$WINEPREFIX/drive_c/users/$USER/Downloads" ;; "wa") cd "$SRCDIR/wallpapers" ;; "wd") cd "$WINEPREFIX" ;; "wr") cd "$WINEROOT" ;; "wv3") cd "$HOME/.winvst3" ;; "wvs") cd "$HOME/.winvst" ;; "ww") cd "$WINEROOT/work" ;; "x") cd "$XDG_CONFIG_HOME/X11" ;; "y3") cd "$HOME/.vst3/yabridge" ;; "yb") cd "$XDG_CACHE_HOME/yay" ;; "yc") cd "$XDG_CONFIG_HOME/yay" ;; "zs") cd "$XDG_CONFIG_HOME/zsh" ;; "zx") cd "$XDG_DOCUMENTS_DIR/zachir.xyz" ;; # STOPPATHS *) echo "\"$1\" is not a known location" ;; esac fi }