Merge branch 'master' of ssh://git@git.john.me.tz:223/jpm/.dotfiles.git
This commit is contained in:
commit
44c7322460
|
@ -54,8 +54,8 @@ alias isdistrobox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /
|
||||||
# Flag that the directory was just changed (used with prompt)
|
# Flag that the directory was just changed (used with prompt)
|
||||||
alias cd='export DIRCHANGED="1"; cd'
|
alias cd='export DIRCHANGED="1"; cd'
|
||||||
|
|
||||||
if [ $(isdistrobox) ]; then
|
if [ "$(isdistrobox)" ]; then
|
||||||
source $HOME/.dotfiles/bash/bash_aliases.distrobox
|
source "$HOME/.dotfiles/bash/bash_aliases.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/bash_aliases.host
|
source "$HOME/.dotfiles/bash/bash_aliases.host"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
# Already in a toolbox
|
# Already in a toolbox
|
||||||
alias toolbox="echo You are already in a toolbox"
|
alias toolbox="echo You are already in a toolbox"
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
# Script to restore toolbox after it was replaced with distrobox and removed the default 'toolbox' name
|
# Script to restore toolbox after it was replaced with distrobox and removed the default 'toolbox' name
|
||||||
alias toolbox="$HOME/scripts/toolbox.sh"
|
alias toolbox="$HOME/scripts/toolbox.sh"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
# vim: ft=sh
|
||||||
|
|
||||||
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
|
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
|
||||||
|
|
||||||
# Load aliases
|
# Load aliases
|
||||||
source ${HOME}/.dotfiles/bash/bash_aliases
|
source "${HOME}/.dotfiles/bash/bash_aliases"
|
||||||
|
|
||||||
export LANG="C"
|
export LANG="C"
|
||||||
export LC_ALL="C"
|
export LC_ALL="C"
|
||||||
|
@ -22,12 +22,12 @@ export GDK_BACKEND="wayland"
|
||||||
export DCONF=".config/dconf/user"
|
export DCONF=".config/dconf/user"
|
||||||
|
|
||||||
# Suggest session start command if last session is not known
|
# 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"
|
echo "Use 'startsway' or 'starti3' to launch a GUI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "/run/.containerenv" ]; then
|
if [ -f "/run/.containerenv" ]; then
|
||||||
source $HOME/.dotfiles/bash/bash_login.distrobox
|
source "$HOME/.dotfiles/bash/bash_login.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/bash_login.host
|
source "$HOME/.dotfiles/bash/bash_login.host"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
# Configure static SSH Agent
|
# vim: ft=sh
|
||||||
export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock
|
|
||||||
|
## Configure static SSH Agent
|
||||||
|
export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
|
||||||
if [ -e $SSH_AUTH_SOCK ]; then
|
if [ -e $SSH_AUTH_SOCK ]; then
|
||||||
rm $SSH_AUTH_SOCK
|
rm $SSH_AUTH_SOCK
|
||||||
fi
|
fi
|
||||||
if [ -e $HOME/.spool/ssh-agent.env ]; then
|
if [ -e "$HOME/.spool/ssh-agent.env "]; then
|
||||||
rm $HOME/.spool/ssh-agent.env
|
rm "$HOME/.spool/ssh-agent.env"
|
||||||
fi
|
fi
|
||||||
if [[ "`pgrep ssh-agent`" ]]; then
|
if [[ "`pgrep ssh-agent`" ]]; then
|
||||||
pkill ssh-agent
|
pkill ssh-agent
|
||||||
fi
|
fi
|
||||||
. $HOME/scripts/ssh-agent.sh
|
. "$HOME/scripts/ssh-agent.sh"
|
||||||
|
|
||||||
# Static/predictable Sway socket
|
# Static/predictable Sway socket
|
||||||
export SWAYSOCK=`sway --get-socketpath`
|
export SWAYSOCK="`sway --get-socketpath`"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# vim: ft=sh
|
# vim: ft=sh
|
||||||
|
|
||||||
if [ -f "/run/.containerenv" ]; then
|
if [ -f "/run/.containerenv" ]; then
|
||||||
source $HOME/.dotfiles/bash/bash_logout.distrobox
|
source "$HOME/.dotfiles/bash/bash_logout.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/bash_logout.host
|
source "$HOME/.dotfiles/bash/bash_logout.host"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
if [ ! $SSH_TTY ]; then
|
# vim: ft=sh
|
||||||
|
|
||||||
|
if [ ! "$SSH_TTY" ]; then
|
||||||
# Remove socket files
|
# Remove socket files
|
||||||
rm $SSH_AUTH_SOCK
|
rm "$SSH_AUTH_SOCK"
|
||||||
rm $HOME/.spool/ssh-agent.env
|
rm "$HOME/.spool/ssh-agent.env"
|
||||||
rm $SWAYSOCK
|
rm "$SWAYSOCK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# when leaving the console clear the screen to increase privacy
|
# when leaving the console clear the screen to increase privacy
|
||||||
|
|
|
@ -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;
|
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
|
||||||
|
|
||||||
if [ -f "/run/.containerenv" ]; then
|
if [ -f "/run/.containerenv" ]; then
|
||||||
source $HOME/.dotfiles/bash/bash_profile.distrobox
|
source "$HOME/.dotfiles/bash/bash_profile.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/bash_profile.host
|
source "$HOME/.dotfiles/bash/bash_profile.host"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
20
bash/bashrc
20
bash/bashrc
|
@ -8,9 +8,9 @@ esac
|
||||||
|
|
||||||
# agetty is set to automatically log me in on tty1
|
# agetty is set to automatically log me in on tty1
|
||||||
# Automatically launch GUI on tty1 after login
|
# Automatically launch GUI on tty1 after login
|
||||||
if [ "$(tty)" == '/dev/tty1' ] && [ ! $SSH_TTY ]; then
|
if [ "$(tty)" == '/dev/tty1' ] && [ ! "$SSH_TTY" ]; then
|
||||||
. ${HOME}/.dotfiles/bash/bash_login
|
. "${HOME}/.dotfiles/bash/bash_login"
|
||||||
LAST_GUI=`cat ${HOME}/.spool/last_login_gui 2>/dev/null`
|
LAST_GUI=$(cat "${HOME}/.spool/last_login_gui" 2>/dev/null)
|
||||||
if [ -f "${HOME}/.spool/last_login_gui" ]; then
|
if [ -f "${HOME}/.spool/last_login_gui" ]; then
|
||||||
${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh
|
${HOME}/scripts/${LAST_GUI}/start${LAST_GUI}.sh
|
||||||
fi
|
fi
|
||||||
|
@ -51,7 +51,7 @@ PROMPT_COMMAND="$PROMPT_COMMAND;printf \"\a\"; history -a"
|
||||||
|
|
||||||
# Enable color support if possible
|
# Enable color support if possible
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
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 ls='ls --color=auto'
|
||||||
alias dir='dir --color=auto'
|
alias dir='dir --color=auto'
|
||||||
alias vdir='vdir --color=auto'
|
alias vdir='vdir --color=auto'
|
||||||
|
@ -62,16 +62,16 @@ if [ -x /usr/bin/dircolors ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load aliases
|
# Load aliases
|
||||||
if [ -f ~/.dotfiles/bash/bash_aliases ]; then
|
if [ -f ${HOME}/.dotfiles/bash/bash_aliases ]; then
|
||||||
. ~/.dotfiles/bash/bash_aliases
|
. "${HOME}/.dotfiles/bash/bash_aliases"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add snaps and flatpaks to path
|
# 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"
|
#export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/flatpak/exports/share"
|
||||||
|
|
||||||
# Perl configs
|
# Perl configs
|
||||||
PERL5LIB="${HOME}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
|
PERL5LIB="${HOME}/perl5/lib/perl5:${HOME}/perl5/lib/perl5/x86_64-linux-thread-multi:${PERL5LIB}"; export PERL5LIB;
|
||||||
PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
|
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_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
|
||||||
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_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"
|
echo -e -n "\033]2;Welcome to Bash\007"
|
||||||
|
|
||||||
if [ -f "/run/.containerenv" ]; then
|
if [ -f "/run/.containerenv" ]; then
|
||||||
source $HOME/.dotfiles/bash/bashrc.distrobox
|
source "$HOME/.dotfiles/bash/bashrc.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/bashrc.host
|
source "$HOME/.dotfiles/bash/bashrc.host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$HOME/.cargo/env"
|
source "$HOME/.cargo/env"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
export DISTROBOX=`grep -oP "(?<=name=\")[^\";]+" /run/.containerenv`
|
# vim: ft=sh
|
||||||
HISTFILE=${HISTFILE}.$DISTROBOX
|
|
||||||
|
export DISTROBOX=$(grep -oP "(?<=name=\")[^\";]+" /run/.containerenv)
|
||||||
|
HISTFILE="${HISTFILE}.$DISTROBOX"
|
||||||
neofetch
|
neofetch
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
|
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
|
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
|
else
|
||||||
if [ ! -f $SSH_AUTH_SOCK ]; then
|
if [ ! -f "$SSH_AUTH_SOCK" ]; then
|
||||||
touch $SSH_AUTH_SOCK
|
touch "$SSH_AUTH_SOCK"
|
||||||
fi
|
fi
|
||||||
$HOME/scripts/ssh-agent.sh
|
$HOME/scripts/ssh-agent.sh
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
# Local user bin
|
# Local user bin
|
||||||
if [ -d "$HOME/bin" ] ; then
|
if [ -d "$HOME/bin" ] ; then
|
||||||
PATH="$HOME/bin:$PATH"
|
PATH="$HOME/bin:$PATH"
|
||||||
|
@ -32,9 +34,9 @@ fi
|
||||||
PATH="${HOME}/perl5/bin:$PATH"
|
PATH="${HOME}/perl5/bin:$PATH"
|
||||||
|
|
||||||
if [ -f "/run/.containerenv" ]; then
|
if [ -f "/run/.containerenv" ]; then
|
||||||
source $HOME/.dotfiles/bash/path.distrobox
|
source "$HOME/.dotfiles/bash/path.distrobox"
|
||||||
else
|
else
|
||||||
source $HOME/.dotfiles/bash/path.host
|
source "$HOME/.dotfiles/bash/path.host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
# vim: ft=sh
|
|
@ -1,5 +1,7 @@
|
||||||
for i in `find $HOME/scripts/distrobox -maxdepth 1`; do
|
# vim: ft=sh
|
||||||
if [ -d $i ]; then
|
|
||||||
|
for i in $(find $HOME/scripts/distrobox -maxdepth 1); do
|
||||||
|
if [ -d "$i" ]; then
|
||||||
PATH="$i:$PATH"
|
PATH="$i:$PATH"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -10,9 +10,9 @@ elif [[ $ARG != '' ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If directory was just changed to the root of a git repository, print onefetch
|
# If directory was just changed to the root of a git repository, print onefetch
|
||||||
if [ ! -z $DIRCHANGED ]; then
|
if [ -n "$DIRCHANGED" ]; then
|
||||||
if [ -d $PWD/.git ]; then
|
if [ -d "$PWD/.git" ]; then
|
||||||
$HOME/bin/onefetch
|
${HOME}/bin/onefetch
|
||||||
fi
|
fi
|
||||||
unset DIRCHANGED
|
unset DIRCHANGED
|
||||||
fi
|
fi
|
||||||
|
@ -53,10 +53,10 @@ declare -A COLOURS='(
|
||||||
|
|
||||||
# Get current git branch
|
# Get current git branch
|
||||||
function parse_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}" == "" ]
|
if [ ! "${BRANCH}" == "" ]
|
||||||
then
|
then
|
||||||
STAT=`parse_git_dirty`
|
STAT=$(parse_git_dirty)
|
||||||
echo "${COLOURS[\"$GC\",\"PS\"]}(${BRANCH}${STAT})${COLOURS[\"0\",\"PS\"]}"
|
echo "${COLOURS[\"$GC\",\"PS\"]}(${BRANCH}${STAT})${COLOURS[\"0\",\"PS\"]}"
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -65,13 +65,13 @@ function parse_git_branch() {
|
||||||
|
|
||||||
# Get git status
|
# Get git status
|
||||||
function parse_git_dirty {
|
function parse_git_dirty {
|
||||||
status=`git status 2>&1 | tee`
|
status=$(git status 2>&1 | tee)
|
||||||
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
|
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 "$?"`
|
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 "$?"`
|
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 "$?"`
|
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 "$?"`
|
renamed=$(echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?")
|
||||||
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
|
deleted=$(echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?")
|
||||||
bits=''
|
bits=''
|
||||||
if [ "${renamed}" == "0" ]; then
|
if [ "${renamed}" == "0" ]; then
|
||||||
bits=">${bits}"
|
bits=">${bits}"
|
||||||
|
@ -116,9 +116,9 @@ if [[ $ARG == '-h' ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Python venv
|
# Python venv
|
||||||
if [ $VIRTUAL_ENV ]; then
|
if [ "$VIRTUAL_ENV" ]; then
|
||||||
VENV="${VIRTUAL_ENV##*/}"
|
VENV="${VIRTUAL_ENV##*/}"
|
||||||
VENV=`echo $VENV | sed -r 's/.*/[\0]/'`
|
VENV=$(echo "$VENV" | sed -r 's/.*/[\0]/')
|
||||||
PS1="${PS1}${COLOURS["$EC","PS"]}${VENV} "
|
PS1="${PS1}${COLOURS["$EC","PS"]}${VENV} "
|
||||||
if [[ $ARG == '-h' ]]; then
|
if [[ $ARG == '-h' ]]; then
|
||||||
setterm --foreground ${COLOURS["$EC","SET"]}; echo "venv"; setterm --foreground default
|
setterm --foreground ${COLOURS["$EC","SET"]}; echo "venv"; setterm --foreground default
|
||||||
|
@ -134,7 +134,7 @@ if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# User
|
# User
|
||||||
if [[ `whoami` == 'root' ]]; then
|
if [[ $(whoami) == 'root' ]]; then
|
||||||
UC=$RC
|
UC=$RC
|
||||||
fi
|
fi
|
||||||
PS1="${PS1}${COLOURS["$UC","PS"]}\\u"
|
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
|
# \n - start input on new line, again to support copy-paste into bash script
|
||||||
PS1="${PS1}${COLOURS["$PC","PS"]}\\n"
|
PS1="${PS1}${COLOURS["$PC","PS"]}\\n"
|
||||||
|
|
||||||
export PS1=$PS1
|
export PS1
|
||||||
|
|
Loading…
Reference in New Issue