# general shit if $HOSTNAME != "riley-laptop": $PROMPT = '{RED} <> {RESET}| {BOLD_GREEN}{cwd_base}{RESET} ) ' else: $PROMPT = '{RED} <3 {RESET}| {BOLD_GREEN}{cwd_base}{RESET} ) ' $XONSH_COLOR_STYLE = 'default' xontrib load apt_tabcomplete argcomplete autovox jedi z # path stuff def load_path(): import sys $PATH.extend([ '~/addins', '~/.local/bin', '~/bin', '~/go/bin' ]) sys.path.insert(0, '') load_path() import addins # my extra stuffs :p def _colortest(): import sys for i in range(256): sys.stdout.write(f"\033[48;5;{i}m ") if (i+1) % 16 == 0: sys.stdout.write("\033[0m\n") # tmux if !(which tmux) and $TERM != 'tmux-256color': folder = p'.' tmux -2 new-session -A -s @(folder.resolve().name) exit # debug def _debug(): if $XONSH_SHOW_TRACEBACK: $XONSH_SHOW_TRACEBACK = False print("Debug mode disabled.") else: $XONSH_SHOW_TRACEBACK = True print("Debug mode enabled.") # bitwarden shit def _bwc(object : str, bw_id: str): if p'~/.bw_session'.exists(): if $XONSH_SHOW_TRACEBACK: print("loaded .bw_session") source ~/.bw_session else: raise FileNotFoundError("~/.bw_session") output = $(bw get @(object) @(bw_id)) $(echo @(output) | xclip -sel clipboard) if "password" in object and !(bw get totp @(object[1]) a> /dev/null): input("totp found, press any key to copy totp ") output = $(bw get totp @(object[1])) $(echo @(output) | xclip -sel clipboard) # return output def _ensure_tmux(args: list): if $XONSH_SHOW_TRACEBACK: print(args) if not $(tmux has-session -t @(args[0])): tmux new-session -d -s @(args[0]) all> /dev/null $(tmux send-keys -t @(args[0]) @(f"cd {args[1]}") C-m) $(tmux send-keys -t @(args[0]) @(f"{args[2]}") C-m) def _alias(): for alias in aliases: if callable(aliases[alias]): print(alias + " = ", aliases[alias].__name__) else: print(alias + " =", " ".join(aliases[alias])) def _mcrcon(args: list): if p"~/.mcrcon".exists(): source "~/.mcrcon" else: raise FileNotFoundError("~/.mcrcon") $(mcrcon @(" ".join(args))) def _mcterm(): if p"~/.mcrcon".exists(): source "~/.mcrcon" else: raise FileNotFoundError("~/.mcrcon") mcrcon -t # aliases aliases.update({ 'bwg': _bwc, 'bwc': _bwc, 'colortest': _colortest, 'config': '/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME', 'debug': _debug, 'ls': 'ls -alhs --color=auto', 'mc': _mcrcon, 'mct': _mcterm, ':q': 'exit', 'owo': 'echo uwu', 'ensure-tmux': _ensure_tmux, 'alias': _alias, }) # man page colors :O $LESS_TERMCAP_mb = "\033[01;31m" # begin blinking $LESS_TERMCAP_md = "\033[01;31m" # begin bold $LESS_TERMCAP_me = "\033[0m" # end mode $LESS_TERMCAP_so = "\033[01;44;36m" # begin standout-mode (bottom of screen) $LESS_TERMCAP_se = "\033[0m" # end standout-mode