#!/usr/bin/env bash # Skip below this big variable value for examples of defining commands. # strings -a is for the benefit of openindiana (solaris) # shellcheck disable=SC2016 magic_command='TTY=$(tty); (echo export DRS_BASHRC_RUN=1; echo "if type gstrings > /dev/null 2>&1; then strings=gstrings; else strings=strings; fi"; echo tty -s \&\& [ \"\$TERM\" != \"\" ] \&\& export PS1=\"\\[\`tput smso\`\\]above cmd output done\ \ \ \ \\D{%Y} \\d \\T \\D{%p %Z}\\[\`tput rmso\`\\]\\n\\[\`tput smso\`\\]\\u@\\h:\\w \$MACHTYPE \$PPID\\[\`tput rmso\`\\]\\n\\n\\$ \"; echo tty -s \&\& [ \"\$TERM\" != \"\" ] \&\& export PSzero=\"\`tput smso\`below cmd output started \\D{%Y} \\d \\T \\D{%p %Z}\`tput rmso\`\\n\"; echo "function vi { if grep -q "AstroNvim Template" ~/.config/nvim/README.md 2> /dev/null; then nvim \"\$@\"; elif type lvim > /dev/null 2>&1 && type nvim > /dev/null 2>&1; then lvim \"\$@\"; elif type vim > /dev/null 2>&1; then vim \"\$@\"; else command vi \"\$@\"; fi; }"; echo "function PreCommand() { if [ -z \"\$AT_PROMPT\" ]; then return; fi; unset AT_PROMPT; preexec; }; FIRST_PROMPT=1; function PostCommand() { AT_PROMPT=1; if [ -n \"\$FIRST_PROMPT\" ]; then unset FIRST_PROMPT; return; fi; }; PROMPT_COMMAND=PostCommand"; echo "set +o histexpand"; echo "set -o vi"; echo "shopt -u progcomp"; echo "shopt -s checkwinsize"; echo export HISTCONTROL=ignoredups; echo export LC_ALL=C; echo export EDITOR=vim; echo export PYLINT_ARGS="\"--max-line-length=132 --module-rgx=[a-zA-Z_][a-zA-Z0-9_-]*\\\$\""; echo export HISTSIZE=10000; echo export PATH=\$HOME/bin:\$HOME/.local/bin:\$HOME/Library/Python/3.9/bin:/var/lib/flatpak/exports/share:\$HOME/.local/share/flatpak/exports/share:/usr/local/bin:/usr/local/sbin:\$HOME/.cargo/bin:\$PATH:/sbin:/usr/sbin:/snap/bin:/usr/gnu/bin:/sw/bin:/opt/X11/bin; echo "function su { if tty -s; then command su --preserve-environment \"\$@\"; else command su \"\$@\"; fi }"; echo "function sudo { if tty -s; then if [ \"\$*\" = bash ]; then command sudo -E bash --rcfile \$HOME/drs-bashrc; else command sudo -E \"\$@\"; fi; else sudo \"\$@\"; fi }"; echo "function preexec { if tty -s; then echo \"\$(tput smso)cmd output started \$(date +%Y\ %a\ %b\ %d\ %r\ %Z)\$(tput rmso)\" > /dev/tty; fi; }"; echo "if \"\$strings\" -a \"\$BASH\" | egrep -q \"^_?ps0_prompt\\\$\"; then export PS0=\"\$PSzero\"; trap - DEBUG; else unset PS0; trap \"PreCommand \\\"\\\$_\\\"\" DEBUG; fi"; echo "export TZ=\"America/Los_Angeles\""; echo "if [ -f $HOME/drs-additional ]; then source $HOME/drs-additional; fi") > $(eval echo $HOME/drs-bashrc); chmod 755 $(eval echo $HOME/drs-bashrc); "$SHELL" --rcfile $(eval echo $HOME/drs-bashrc) < "$TTY" > "$TTY" 2>&1' # You can do these one at a time: ./hcm.py --ignore-already --add-command-group X11 ./hcm.py --ignore-already --add-command X11 xterm xterm '' ./hcm.py --ignore-already --add-command X11 mrxvt mrxvt '' ./hcm.py --ignore-already --add-command X11 'little rdesktop' rdesktop '' ./hcm.py --ignore-already --add-command X11 'medium rdesktop' 'rdesktop -g 1280x800' '' ./hcm.py --ignore-already --add-command X11 'fullscreen rdesktop' 'rdesktop -f' '' # Or all at once, for speed: ./hcm.py --ignore-already --add-command-group Gnome \ --ignore-already --add-command Gnome gnome-terminal gnome-terminal '' \ --ignore-already --add-command Gnome mate-terminal mate-terminal '' \ --ignore-already --add-command Gnome firefox firefox '' \ --ignore-already --add-command Gnome 'firefox profile manager' 'firefox -P' '' \ --ignore-already --add-command Gnome google-chrome google-chrome '' \ --ignore-already --add-command Gnome 'google-chrome with user data' "google-chrome --user-data-dir=.google-chrome/session\${DISPLAY}" '' \ --ignore-already --add-command Gnome 'google-chrome drsalists' 'google-chrome "--user-data-dir=.google-chrome/drsalists"' '' \ --ignore-already --add-command Gnome 'google-chrome dstromberg-lists' 'google-chrome "--user-data-dir=.google-chrome/dstromberg-lists"' '' \ --ignore-already --add-command Gnome lowriter lowriter '' \ --ignore-already --add-command Gnome localc localc '' \ --ignore-already --add-command Gnome loimpress loimpress '' \ --ignore-already --add-command Gnome gvim gvim '' \ --ignore-already --add-command Gnome emacs emacs '' \ --ignore-already --add-command Gnome rhythmbox rhythmbox '' \ --ignore-already --add-command-group KDE \ --ignore-already --add-command KDE konsole konsole '' \ --ignore-already --add-command KDE konqueror konqueror '' \ --ignore-already --add-command KDE keepassxc keepassxc '' \ --ignore-already --add-command-group Mono \ --ignore-already --add-command Mono keepass2 keepass2 '' \ --ignore-already --add-command-group tty \ --ignore-already --add-command tty 'terminology: just bash' "bash --login" 'terminology --title "#g -=- #n"' \ --ignore-already --add-command tty 'terminology: fancy' "$magic_command" 'terminology --title "#g -=- #n"' \ --ignore-already --add-command tty 'mate-terminal: just bash' 'bash --login' 'mate-terminal' \ --ignore-already --add-command tty 'mate-terminal: fancy' "$magic_command" 'mate-terminal' \ --ignore-already --add-command tty 'terminal-window: just bash' 'bash --login' 'terminal-window' \ --ignore-already --add-command tty 'terminal-window: fancy' "$magic_command" 'terminal-window' \ --ignore-already --add-command tty 'terminal-window: just cmd' 'cmd' 'terminal-window' \ --ignore-already --add-command tty 'terminal-window: just PowerShell' 'PowerShell' 'terminal-window' \ --ignore-already --add-command tty 'urxvt: just bash' 'bash --login' 'urxvt' \ --ignore-already --add-command tty 'urxvt: fancy' "$magic_command" 'urxvt' \ --ignore-already --add-command tty 'konsole: just bash' 'bash --login' 'konsole' \ --ignore-already --add-command tty 'konsole: fancy' "$magic_command" 'konsole' \ --ignore-already --add-command tty 'konsole: just cmd' 'cmd' 'konsole' \ --ignore-already --add-command tty 'wezterm-wrapper: just bash' 'bash --login' 'wezterm-wrapper' \ --ignore-already --add-command tty 'wezterm-wrapper: fancy' "$magic_command" 'wezterm-wrapper' \ --ignore-already --add-command tty 'wezterm-wrapper: just cmd' 'cmd' 'wezterm-wrapper'