Merge branch 'master' of ssh://git@git.john.me.tz:223/jpm/.dotfiles.git

This commit is contained in:
John Mertz 2023-03-13 15:38:22 -04:00
commit 44c7322460
18 changed files with 81 additions and 58 deletions

View File

@ -54,8 +54,8 @@ alias isdistrobox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /
# Flag that the directory was just changed (used with prompt)
alias cd='export DIRCHANGED="1"; cd'
if [ $(isdistrobox) ]; then
source $HOME/.dotfiles/bash/bash_aliases.distrobox
if [ "$(isdistrobox)" ]; then
source "$HOME/.dotfiles/bash/bash_aliases.distrobox"
else
source $HOME/.dotfiles/bash/bash_aliases.host
source "$HOME/.dotfiles/bash/bash_aliases.host"
fi

View File

@ -1,2 +1,4 @@
# vim: ft=sh
# Already in a toolbox
alias toolbox="echo You are already in a toolbox"

View File

@ -1,2 +1,4 @@
# vim: ft=sh
# Script to restore toolbox after it was replaced with distrobox and removed the default 'toolbox' name
alias toolbox="$HOME/scripts/toolbox.sh"

View File

@ -1,9 +1,9 @@
#!/bin/bash
# vim: ft=sh
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
# Load aliases
source ${HOME}/.dotfiles/bash/bash_aliases
source "${HOME}/.dotfiles/bash/bash_aliases"
export LANG="C"
export LC_ALL="C"
@ -22,12 +22,12 @@ export GDK_BACKEND="wayland"
export DCONF=".config/dconf/user"
# Suggest session start command if last session is not known
if [ ! -e ${HOME}/.spool/last_login_gui ]; then
if [ ! -e "${HOME}/.spool/last_login_gui" ]; then
echo "Use 'startsway' or 'starti3' to launch a GUI"
fi
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_login.distrobox
source "$HOME/.dotfiles/bash/bash_login.distrobox"
else
source $HOME/.dotfiles/bash/bash_login.host
source "$HOME/.dotfiles/bash/bash_login.host"
fi

View File

@ -0,0 +1,2 @@
# vim: ft=sh

View File

@ -1,15 +1,17 @@
# Configure static SSH Agent
export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock
# vim: ft=sh
## Configure static SSH Agent
export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
if [ -e $SSH_AUTH_SOCK ]; then
rm $SSH_AUTH_SOCK
fi
if [ -e $HOME/.spool/ssh-agent.env ]; then
rm $HOME/.spool/ssh-agent.env
if [ -e "$HOME/.spool/ssh-agent.env "]; then
rm "$HOME/.spool/ssh-agent.env"
fi
if [[ "`pgrep ssh-agent`" ]]; then
pkill ssh-agent
fi
. $HOME/scripts/ssh-agent.sh
. "$HOME/scripts/ssh-agent.sh"
# Static/predictable Sway socket
export SWAYSOCK=`sway --get-socketpath`
export SWAYSOCK="`sway --get-socketpath`"

View File

@ -1,7 +1,7 @@
# vim: ft=sh
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_logout.distrobox
source "$HOME/.dotfiles/bash/bash_logout.distrobox"
else
source $HOME/.dotfiles/bash/bash_logout.host
source "$HOME/.dotfiles/bash/bash_logout.host"
fi

View File

@ -0,0 +1,2 @@
# vim: ft=sh

View File

@ -1,8 +1,10 @@
if [ ! $SSH_TTY ]; then
# vim: ft=sh
if [ ! "$SSH_TTY" ]; then
# Remove socket files
rm $SSH_AUTH_SOCK
rm $HOME/.spool/ssh-agent.env
rm $SWAYSOCK
rm "$SSH_AUTH_SOCK"
rm "$HOME/.spool/ssh-agent.env"
rm "$SWAYSOCK"
fi
# when leaving the console clear the screen to increase privacy

View File

@ -17,7 +17,7 @@ PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bash_profile.distrobox
source "$HOME/.dotfiles/bash/bash_profile.distrobox"
else
source $HOME/.dotfiles/bash/bash_profile.host
source "$HOME/.dotfiles/bash/bash_profile.host"
fi

View File

@ -0,0 +1,2 @@
# vim: ft=sh

View File

@ -8,9 +8,9 @@ esac
# agetty is set to automatically log me in on tty1
# Automatically launch GUI on tty1 after login
if [ "$(tty)" == '/dev/tty1' ] && [ ! $SSH_TTY ]; then
. ${HOME}/.dotfiles/bash/bash_login
LAST_GUI=`cat ${HOME}/.spool/last_login_gui 2>/dev/null`
if [ "$(tty)" == '/dev/tty1' ] && [ ! "$SSH_TTY" ]; then
. "${HOME}/.dotfiles/bash/bash_login"
LAST_GUI=$(cat "${HOME}/.spool/last_login_gui" 2>/dev/null)
if [ -f "${HOME}/.spool/last_login_gui" ]; then
${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh
fi
@ -51,7 +51,7 @@ PROMPT_COMMAND="$PROMPT_COMMAND;printf \"\a\"; history -a"
# Enable color support if possible
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
test -r ${HOME}/.dircolors && eval "$(dircolors -b ${HOME}/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
@ -62,16 +62,16 @@ if [ -x /usr/bin/dircolors ]; then
fi
# Load aliases
if [ -f ~/.dotfiles/bash/bash_aliases ]; then
. ~/.dotfiles/bash/bash_aliases
if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then
. "${HOME}/.dotfiles/bash/bash_aliases"
fi
# Add snaps and flatpaks to path
#export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/flatpak/exports/share"
# Perl configs
PERL5LIB="${HOME}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL5LIB="${HOME}/perl5/lib/perl5:${HOME}/perl5/lib/perl5/x86_64-linux-thread-multi:${PERL5LIB}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="${HOME}/perl5/lib/perl5:${HOME}/perl5/lib/perl5/x86_64-linux-thread-multi:${PERL_LOCAL_LIB_ROOT}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
@ -94,9 +94,9 @@ export TERM="xterm"
echo -e -n "\033]2;Welcome to Bash\007"
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/bashrc.distrobox
source "$HOME/.dotfiles/bash/bashrc.distrobox"
else
source $HOME/.dotfiles/bash/bashrc.host
source "$HOME/.dotfiles/bash/bashrc.host"
fi
source "$HOME/.cargo/env"

View File

@ -1,3 +1,5 @@
export DISTROBOX=`grep -oP "(?<=name=\")[^\";]+" /run/.containerenv`
HISTFILE=${HISTFILE}.$DISTROBOX
# vim: ft=sh
export DISTROBOX=$(grep -oP "(?<=name=\")[^\";]+" /run/.containerenv)
HISTFILE="${HISTFILE}.$DISTROBOX"
neofetch

View File

@ -1,10 +1,12 @@
# vim: ft=sh
export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
if [ -z $SSH_AGENT_PID ]; then
if [ -z "$SSH_AGENT_PID" ]; then
if [ -f "$HOME/.spool/ssh-agent.env" ]; then
source $HOME/.spool/ssh-agent.env >/dev/null
source "$HOME/.spool/ssh-agent.env" >/dev/null
else
if [ ! -f $SSH_AUTH_SOCK ]; then
touch $SSH_AUTH_SOCK
if [ ! -f "$SSH_AUTH_SOCK" ]; then
touch "$SSH_AUTH_SOCK"
fi
$HOME/scripts/ssh-agent.sh
fi

View File

@ -1,3 +1,5 @@
# vim: ft=sh
# Local user bin
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
@ -32,9 +34,9 @@ fi
PATH="${HOME}/perl5/bin:$PATH"
if [ -f "/run/.containerenv" ]; then
source $HOME/.dotfiles/bash/path.distrobox
source "$HOME/.dotfiles/bash/path.distrobox"
else
source $HOME/.dotfiles/bash/path.host
source "$HOME/.dotfiles/bash/path.host"
fi
# Rust

View File

@ -0,0 +1 @@
# vim: ft=sh

View File

@ -1,5 +1,7 @@
for i in `find $HOME/scripts/distrobox -maxdepth 1`; do
if [ -d $i ]; then
# vim: ft=sh
for i in $(find $HOME/scripts/distrobox -maxdepth 1); do
if [ -d "$i" ]; then
PATH="$i:$PATH"
fi
done

View File

@ -10,9 +10,9 @@ elif [[ $ARG != '' ]]; then
fi
# If directory was just changed to the root of a git repository, print onefetch
if [ ! -z $DIRCHANGED ]; then
if [ -d $PWD/.git ]; then
$HOME/bin/onefetch
if [ -n "$DIRCHANGED" ]; then
if [ -d "$PWD/.git" ]; then
${HOME}/bin/onefetch
fi
unset DIRCHANGED
fi
@ -53,10 +53,10 @@ declare -A COLOURS='(
# Get current git branch
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
STAT=$(parse_git_dirty)
echo "${COLOURS[\"$GC\",\"PS\"]}(${BRANCH}${STAT})${COLOURS[\"0\",\"PS\"]}"
else
echo ""
@ -65,13 +65,13 @@ function parse_git_branch() {
# Get git status
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
status=$(git status 2>&1 | tee)
dirty=$(echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?")
untracked=$(echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?")
ahead=$(echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?")
newfile=$(echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?")
renamed=$(echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?")
deleted=$(echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?")
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
@ -116,9 +116,9 @@ if [[ $ARG == '-h' ]]; then
fi
# Python venv
if [ $VIRTUAL_ENV ]; then
if [ "$VIRTUAL_ENV" ]; then
VENV="${VIRTUAL_ENV##*/}"
VENV=`echo $VENV | sed -r 's/.*/[\0]/'`
VENV=$(echo "$VENV" | sed -r 's/.*/[\0]/')
PS1="${PS1}${COLOURS["$EC","PS"]}${VENV} "
if [[ $ARG == '-h' ]]; then
setterm --foreground ${COLOURS["$EC","SET"]}; echo "venv"; setterm --foreground default
@ -134,7 +134,7 @@ if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
fi
# User
if [[ `whoami` == 'root' ]]; then
if [[ $(whoami) == 'root' ]]; then
UC=$RC
fi
PS1="${PS1}${COLOURS["$UC","PS"]}\\u"
@ -179,4 +179,4 @@ fi
# \n - start input on new line, again to support copy-paste into bash script
PS1="${PS1}${COLOURS["$PC","PS"]}\\n"
export PS1=$PS1
export PS1