Add check for xtitle and screen installation

This commit is contained in:
Antonio J. Delgado 2022-05-05 16:05:06 +03:00
parent 97ebbd7ba2
commit aa53908efe
6 changed files with 52 additions and 0 deletions

23
bashrc.d/always_screen Normal file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Create a Screen session everytime, unless you don't want
if [ -n "$(which screen)" ]; then
if [ -n "${STY}" ]; then
echo "This is screen session '${STY//[0-9]*\./}'"
else
echo "This is not a screen session, let's create one. Name of the session?"
read -r session_name
if [ -n "${session_name}" ] && [ "${session_name}" != "" ]; then
if [ -n "$(which xtitle)" ]; then
xtitle "${session_name}"
else
echo "xtitle is not installed so I can't update the title of the X window with the session name. Install it and the experience will be better)"
fi
screen -t "${session_name}" -S "${session_name}" && exit
else
echo "Ok, I'll leave you alone without a session..."
fi
fi
else
echo "Screen is not installed. Install it so always_screen in your bashrc will work."
fi

5
bashrc.d/gpg_ssh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
# GPG and SSH
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
gpgconf --launch gpg-agent

View file

@ -0,0 +1,5 @@
#!/bin/bash
if [ "$(which kubectl)" != "" ]; then
# shellcheck disable=SC1090
source <(kubectl completion bash)
fi

View file

@ -0,0 +1,2 @@
#!/bin/bash
complete -C /usr/bin/terraform terraform

8
bashrc.d/wsl_return_home Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
# Windows Subsystem for Linux start in the
# Windows profile folder, but this change
# it to change to the WSL home folder instead
if [ -n "${WSL_DISTRO_NAME}" ]; then
cd "${HOME}" ||exit 1
fi

9
install_my_bashrc.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
my_dir=$(dirname "${0}")
if [ -e "${HOME}/.bashrc" ]; then
mv "${HOME}/.bashrc" "${HOME}/.bashrc.bak"
fi
cp "${my_dir}/bash_rc" "${HOME}/.bashrc" -rfp
cp "${my_dir}/bashrc.d" "${HOME}/.bashrc.d" -rfp