From 42189f6687f6ce8e893d321523215d05aedce158 Mon Sep 17 00:00:00 2001 From: James Bulman Date: Thu, 25 Sep 2025 18:08:46 +0100 Subject: [PATCH] Added bash config Copied over old .bashrc and .bash_aliases because they didn't need really need changing Slightly changed .bash_profile for starting graphical setups Added simple starship.toml setup Updated install script to copy/pull new files --- bash_aliases | 16 ++++++++++++++++ bash_profile | 34 ++++++++++++++++++++++++++++++++++ bashrc | 40 ++++++++++++++++++++++++++++++++++++++++ config/starship.toml | 33 +++++++++++++++++++++++++++++++++ dots | 11 ++++++++++- 5 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 bash_aliases create mode 100644 bash_profile create mode 100644 bashrc create mode 100644 config/starship.toml diff --git a/bash_aliases b/bash_aliases new file mode 100644 index 0000000..4ed6601 --- /dev/null +++ b/bash_aliases @@ -0,0 +1,16 @@ +# Alias sudo to have a space at the end so it can be used with other aliases +alias sudo='sudo ' + +# Auto remove any packages that may be left over as dependencies +alias autorem='pacman -Rsn $(pacman -Qdtq)' + +# Enable basic options for colour etc. +alias ls='ls -CFlvh --color=always --group-directories-first' +alias grep='grep --color=always' +alias less='less -R' + +# Neovim instead of vim +alias vim='nvim' + +# Out of habit +alias quit='exit' diff --git a/bash_profile b/bash_profile new file mode 100644 index 0000000..078dd56 --- /dev/null +++ b/bash_profile @@ -0,0 +1,34 @@ +# Source .bashrc +[[ -f "$HOME/.bashrc" ]] && . "$HOME/.bashrc" + +case $HOSTNAME in + # More can be added here in the future + kanto|tokyo) + HEADLESS=0 + ;; + *) + HEADLESS=1 + ;; +esac + +if [[ $HEADLESS -eq 0 && -z $WAYLAND_DISPLAY && $XDG_VTNR -eq 1 ]]; +then + export GTK_THEME=Adwaita:dark + export MOZ_ENABLE_WAYLAND=1 + export QT_QPA_PLATFORM=wayland-egl + export QT_QPA_PLATFORMTHEME=qt5ct + export SDL_VIDEODRIVER=wayland + + case $HOSTNAME in + kanto) + export WLR_NO_HARDWARE_CURSORS=1 + + # Desktop with nvidia gpu + exec sway --unsupported-gpu + ;; + tokyo) + # Laptop with intel gpu + exec sway + ;; + esac +fi diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..1dcbee1 --- /dev/null +++ b/bashrc @@ -0,0 +1,40 @@ +# Make sure we are running interactively +[[ $- != *i* ]] && return + +# Source aliases +[[ -f "$HOME/.bash_aliases" ]] && . "$HOME/.bash_aliases" + +# Source devkitPro env if available +[[ -f "/etc/profile.d/devkit-env.sh" ]] && . "/etc/profile.d/devkit-env.sh" + +# Misc options +shopt -s checkwinsize +shopt -s globstar + +# History options +HISTCONTROL=ignoreboth +HISTSIZE=1000 +HISTFILESIZE=2000 +shopt -s histappend + +# Disable history file for less +export LESSHISTFILE="-" + +# Use neovim as editor +export EDITOR=nvim + +# Required for passphrase input with gpg +export GPG_TTY="$(tty)" +export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +gpg-connect-agent updatestartuptty /bye > /dev/null + +# Append / to the end of symlinked directories +bind 'set mark-symlinked-directories on' + +# Make C-w only delete up to first / in path +stty werase undef +bind '\C-w:unix-filename-rubout' + +# If available setup execute starship prompt, otherwise default to a basic PS1 +export PS1="[\033[01;92m\u@\h\033[00m] :: \033[00;34m\w \033[01;36m> \033[0;0m" +[[ $(command -v "starship") ]] && eval "$(starship init bash)" diff --git a/config/starship.toml b/config/starship.toml new file mode 100644 index 0000000..9f44658 --- /dev/null +++ b/config/starship.toml @@ -0,0 +1,33 @@ +add_newline = false +scan_timeout = 10 +format = "\\[$username$hostname\\] :: $directory $cmd_duration$character" + +[line_break] +disabled = true + +[hostname] +ssh_only = false +style = "bright-blue bold" +format = "[@$hostname]($style)" + +[username] +show_always = true +style_user = "bright-blue bold" +style_root = "bright-red bold" +format="[$user]($style)" + +[directory] +truncation_length = 3 +truncate_to_repo = true +style = "blue" +read_only = "!" +read_only_style = "red" +format = "[$path]($style)[$read_only]($read_only_style)" + +[cmd_duration] +style = "bold yellow" +format = "[+$duration]($style) " + +[character] +success_symbol = "[>](cyan bold)" +error_symbol = "[>](red bold)" diff --git a/dots b/dots index 6304c15..a282fc1 100755 --- a/dots +++ b/dots @@ -10,6 +10,10 @@ Install() { [[ ! -d "$1" ]] && mkdir -p "$1" + cp "bashrc" "$1/.bashrc" + cp "bash_profile" "$1/.bash_profile" + cp "bash_aliases" "$1/.bash_aliases" + cp -RT "config" "$1/.config" } @@ -18,7 +22,12 @@ Pull() { # echo "[Info] :: Pulling dotfile changes from $1" - cp -r "$1/.config/nvim" "config/" + cp -r "$1/.config/nvim" "config/" + cp "$1/.config/starship.toml" "config/starship.toml" + + cp "$1/.bashrc" "bashrc" + cp "$1/.bash_profile" "bash_profile" + cp "$1/.bash_aliases" "bash_aliases" } INSTALL_DIR=${2:-$HOME}