Compare commits

..

No commits in common. "d396e06e4e211c477f6b172f3ee3fd570edd2a08" and "ca3d62952de144eeed18797124f393220b704f31" have entirely different histories.

8 changed files with 134 additions and 85 deletions

View File

@ -15,28 +15,28 @@ export PATH=${HOME}/bin:$PATH:/usr/lib/wine/bin:/sbin:/usr/sbin:/usr/local/bin
# Give the path to the dotfiles
export _DOTFILES="${HOME}/dotfiles"
# Allow checking for automatic updates
export ENABLE_DOTFILES_AUTO_UPDATE=true
# Allow automatic updates
export DISABLE_DOTFILES_AUTO_UPDATE="FALSE"
# Set "true" to update without asking first
export DISABLE_DOTFILES_UPDATE_PROMPT=false
export DISABLE_DOTFILES_UPDATE_PROMPT="FALSE"
# Update every 2 weeks (OMZ default)
export UPDATE_DOTFILES_DAYS=13
# Whether or not to automatically connect to a TMUX session when opening the shell
export ENABLE_TMUXAC=false
export ENABLE_TMUXAC="FALSE"
# If there is not an active tmux session, we probably want one
# Otherwise, the shell will not open the session again (eg. opening tabs, new terminals)
if $(tmux list-sessions >> /dev/null 2>&1); then
export TMUXATT=true
export TMUXATT="TRUE"
else
export TMUXATT=false
export TMUXATT="FALSE"
fi
# Automatically attach tmux session "C0DE"
if [[ -z "$TMUX" && "$TMUXATT" && "$ENABLE_TMUXAC" ]]; then
if [[ -z "$TMUX" && "$TMUXATT" != "TRUE" && "$ENABLE_TMUXAC" != "FALSE" ]]; then
tmux attach -t C0DE || tmux new -s C0DE
fi

17
.zshrc
View File

@ -14,8 +14,8 @@ setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
# Say how long a command took, if it took more than 5 seconds
export REPORTTIME=5
# Say how long a command took, if it took more than 15 seconds
export REPORTTIME=15
# Prompts for confirmation after 'rm *' etc
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
@ -30,10 +30,19 @@ setopt NOCLOBBER
# Dont nice background processes
setopt NO_BG_NICE
# Makes Alt-s insert a sudo at beginning of prompt
function insert_sudo {
if [[ $BUFFER != "sudo "* ]]; then
BUFFER="sudo $BUFFER"; CURSOR+=6
fi
}
zle -N insert-sudo insert_sudo
bindkey "^[s" insert-sudo
# Check for updates...
# Stolen and modified Oh-My-ZSH's update system
if [ "${ENABLE_DOTFILES_AUTO_UPDATE}" ]; then
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/check_for_upgrade.sh
if [ "$DISABLE_DOTFILES_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/internal_bin/check_for_upgrade.sh
fi
# Oh-My-ZSH Options below this line

View File

@ -1,6 +1,6 @@
#!/bin/bash
DF_PATH=${HOME}/dotfiles/.config/i3
DF_PATH=${HOME}/dotfiles/home/.config/i3
CONFIG_PATH=${DF_PATH}/conf.d
DST_FILE=${DF_PATH}/config

View File

@ -3,24 +3,15 @@
# This ensures that the entire script is downloaded before execution
{
if ! which git >>/dev/null ; then
echo "Error: git is not installed"
exit 1
fi
# Change this url to point to your repo if you made customizations
repourl="git://github.com/alopexc0de/dotfiles.git"
# Exit the script if any errors are encountered
#set -e
# Change this url to point to your repo if you made customizations
GIT_REPO="git://github.com/alopexc0de/dotfiles.git"
DOTFILES=${HOME}/dotfiles
POSTINSTALL_SCRIPT=${HOME}/.dotfiles.postinst
if [ ! -e "${POSTINSTALL_SCRIPT}" ]; then
echo "No post install script found."
echo "Optionally create one at ${POSTINSTALL_SCRIPT} and rerun this script"
fi
basedir=$HOME/dotfiles
bindir=$HOME/bin
postinst=$HOME/.dotfiles.postinst
# Attempts to safely install the configs as symlinks (backing up existing ones)
function symlink() {
@ -48,82 +39,100 @@ function symlink() {
read -p "Press enter to install my dotfiles " WAIT_FOR_INPUT
# If the update script exists, try to do a normal update
if [ -x "${DOTFILES}/check_for_upgrade.sh" ]; then
source "${DOTFILES}/.environment"
env DOTFILES=${DOTFILES} DISABLE_UPDATE_PROMPT=false zsh -f ${DOTFILES}/check_for_upgrade.sh
else
echo "Cloning dotfiles to ${DOTFILES}"
rm -rf "${DOTFILES}"
git clone --recurse-submodules -j$(nproc) "${GIT_REPO}" "${DOTFILES}"
read -p "[Dotfiles] Would you like to detect distro and auto-install dependencies? [Y/n]: " line
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
distrourl="https://raw.githubusercontent.com/alopexc0de/dotfiles/master/internal_bin"
if [ -f /etc/arch-release ]; then
bash <(curl -sL $distrourl/install.arch)
elif [ -f /etc/debian_version ]; then
bash <(curl -sL $distrourl/install.deb)
else
echo "This system does not have an auto-install file. Please install the dependencies manually"
fi
fi
if ! which git >>/dev/null ; then
echo "Error: git is not installed"
exit 1
fi
# If the update script exists, try to do a normal update
if [ -x "$basedir/internal_bin/check_for_upgrade.sh" ]; then
source "$basedir/shell/env"
env _DOTFILES=$basedir DISABLE_UPDATE_PROMPT='FALSE' zsh -f $basedir/internal_bin/check_for_upgrade.sh
else
echo "Cloning dotfiles to $basedir"
rm -rf $basedir
git clone --depth=1 $repourl $basedir
fi
# Start installing config
echo "Linking config and local files"
# Environment
symlink $basedir/home/.local $HOME/.local
symlink $basedir/home/.config $HOME/.config
echo "Installing Oh-My-ZSH"
echo "When the install is done, type \"exit\" to continue installing dotfiles"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo "Changing default shell to ZSH..."
chsh -s /usr/bin/zsh
echo "Building i3 configuration"
${DOTFILES}/bin/build-i3-config
$basedir/bin/build-i3-config
echo "Installing user binary directory to ~/bin"
symlink ${DOTFILES}/bin ${HOME}/bin
echo "Linking X-Session files"
# Stuff related to the X-Session
symlink $basedir/home/.config/compton.conf $HOME/.compton.conf
symlink $basedir/home/Xresources $HOME/.Xresources
symlink $basedir/home/xinitrc $HOME/.xinitrc
echo "Linking Configuration files..."
echo "Linking shell files"
# Shell stuff
symlink $basedir/home/shell/tmux.conf $HOME/.tmux.conf
symlink $basedir/home/shell/bashrc $HOME/.bashrc
symlink $basedir/home/shell/zshrc $HOME/.zshrc
symlink $basedir/home/shell/vimrc $HOME/.vimrc
symlink $basedir/home/dmenurc $HOME/.dmenurc
symlink $basedir/home/dmrc $HOME/.dmrc
# All the dotfiles that live in the home dir directly
symlink ${DOTFILES}/.aliases ${HOME}/.aliases
symlink ${DOTFILES}/.bashrc ${HOME}/.bashrc
symlink ${DOTFILES}/.dmenurc ${HOME}/.dmenurc
symlink ${DOTFILES}/.dmrc ${HOME}/.dmrc
symlink ${DOTFILES}/.editorconfig ${HOME}/.editorconfig
symlink ${DOTFILES}/.environment ${HOME}/.environment
symlink ${DOTFILES}/.functions ${HOME}/.functions
symlink ${DOTFILES}/.gitconfig ${HOME}/.gitconfig
symlink ${DOTFILES}/.stalonetrayrc ${HOME}/.stalonetrayrc
symlink ${DOTFILES}/.tmux.conf ${HOME}/.tmux.conf
symlink ${DOTFILES}/.vimrc ${HOME}/.vimrc
symlink ${DOTFILES}/.zshrc ${HOME}/.zshrc
# Global git
symlink $basedir/home/gitconfig $HOME/.gitconfig
# Install ~/.config stuff
symlink ${DOTFILES}/.config/.rofi ${HOME}/.config/.rofi
symlink ${DOTFILES}/.config/compton ${HOME}/.config/compton
symlink ${DOTFILES}/.config/dunst ${HOME}/.config/dunst
symlink ${DOTFILES}/.config/gtk-2.0 ${HOME}/.config/gtk-2.0
symlink ${DOTFILES}/.config/gtk-3.0 ${HOME}/.config/gtk-3.0
symlink ${DOTFILES}/.config/htop ${HOME}/.config/htop
symlink ${DOTFILES}/.config/i3 ${HOME}/.config/i3
symlink ${DOTFILES}/.config/morc_menu ${HOME}/.config/morc_menu
symlink ${DOTFILES}/.config/nitrogen ${HOME}/.config/nitrogen
symlink ${DOTFILES}/.config/ranger ${HOME}/.config/ranger
symlink ${DOTFILES}/.config/terminator ${HOME}/.config/terminator
symlink ${DOTFILES}/.config/viewnior ${HOME}/.config/viewnior
symlink ${DOTFILES}/.config/volumeicon ${HOME}/.config/volumeicon
symlink ${DOTFILES}/.config/mimeapps.list ${HOME}/.config/mimeapps.list
echo "Installing shell-history"
python3 -m pip install shellhistory
echo "Installing VIM Pathogen..."
mkdir -p ${HOME}/.vim/{autoload,bundle}
curl -LSs https://tpo.pe/pathogen.vim -o ${HOME}/.vim/autoload/pathogen.vim
mkdir -p $HOME/.vim/autoload $HOME/.vim/bundle
curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
echo "Installing VIM Sensible..."
git clone git://github.com/tpope/vim-sensible.git ${HOME}/.vim/bundle/vim-sensible
cd $HOME/.vim/bundle
git clone git://github.com/tpope/vim-sensible.git
echo "Installing VIM Iceberg theme"
cd /tmp
wget https://www.vim.org/scripts/download_script.php?src_id=25718 -O iceberg.zip
unzip iceberg.zip
cp -r iceberg.vim/{autoload,colors} ${HOME}/.vim/
rm -rf /tmp/iceberg*
cd ${HOME}
cp -r iceberg.vim/{autoload,colors} ~/.vim/
if [ -e "$POSTINSTALL_SCRIPT" ]; then
echo "Adding user bin..."
mkdir -p $bindir
for file_path in $basedir/bin/*; do
symlink $file_path $bindir/$(basename $file_path)
done
echo "Changing default shell to ZSH..."
chsh -s /usr/bin/zsh
if [ -e "$postinst" ]; then
echo "Running post install..."
source "$POSTINSTALL_SCRIPT"
source "$postinst"
else
echo "No post install script found. Optionally create one at $postinst and reinstall your dotfies"
fi
echo "Install done."
echo "Log out and back in again for everything to take effect."
echo "Check tmux, vim, and your shell to verify everything is correct"
echo "you may need to launch a new instance of your shell"
} # Ensures that the whole script is downloaded before execution

View File

@ -10,14 +10,15 @@ function _current_epoch() {
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
}
function _touch_dotfiles_update() {
function _update_dotfiles_update() {
echo "export LAST_EPOCH=$(_current_epoch)" > ${HOME}/.dotfiles-update
echo "touched ~/.dotfiles-update"
}
function _upgrade_dotfiles() {
env _DOTFILES=$_DOTFILES sh $_DOTFILES/upgrade.sh
_touch_dotfiles_update
env _DOTFILES=$_DOTFILES sh $_DOTFILES/internal_bin/upgrade.sh
# update the zsh file
_update_dotfiles_update
}
# Configure this in shell/env
@ -48,12 +49,12 @@ if mkdir -p "$_DOTFILES/update.lock" 2>/dev/null; then
if [[ -z "$LAST_EPOCH" ]]; then
echo "Missing \$LAST_EPOCH"
_touch_dotfiles_update && return 0;
_update_dotfiles_update && return 0;
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
if [ $epoch_diff -gt $epoch_target ]; then
if [ "${DISABLE_UPDATE_PROMPT}" ]; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_dotfiles
else
echo "[Dotfiles] Would you like to check for updates? [Y/n]: \c"
@ -61,14 +62,14 @@ if mkdir -p "$_DOTFILES/update.lock" 2>/dev/null; then
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
_upgrade_dotfiles
else
_touch_dotfiles_update
_update_dotfiles_update
fi
fi
fi
else
echo "Missing ~/.dotfiles-update"
# create the zsh file
_touch_dotfiles_update
_update_dotfiles_update
fi
rmdir $_DOTFILES/update.lock

16
internal_bin/install.arch Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# This ensures that the entire script is downloaded before execution
{
sudo pacman -Syu
sudo pacman -S yay
yay -Syu
yay -S tmux zsh vim git \
terminator rofi feh xcompmgr \
i3lock-fancy i3blocks ffcast
sudo pip install ntfy
}

14
internal_bin/install.deb Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# This ensures that the entire script is downloaded before execution
{
sudo apt update
sudo apt upgrade
sudo apt install tmux zsh vim git\
terminator rofi feh xcompmgr\
i3lock-fancy i3blocks
sudo pip install ntfy
}