add setup config and fixes to setup
This commit is contained in:
parent
3d22601122
commit
4f2e5cd520
9 changed files with 222 additions and 36 deletions
24
README.md
24
README.md
|
|
@ -8,17 +8,23 @@ Welcome to the .local-bin repository! Find key components below to enhance your
|
|||
## Binary Files
|
||||
|
||||
- **[aactivator.py](scripts/aactivator.py):** A powerful script designed to automate the sourcing of environments in an interactive shell. Activate it effortlessly by evaluating `$(aactivator init)` in your shell.
|
||||
- **[sessionizer](scripts/sessionizer):** This script simplifies the management of tmux sessions by providing an interactive interface to create or switch between sessions. If a session doesn't exist for a selected directory, it creates a new tmux session with the selected directory as the working directory.
|
||||
- **[windownizer](scripts/windownizer):** This script is designed to streamline the process of sending commands to a specific tmux window. It takes a branch name (or any identifier) as an argument, creates a new window if it doesn't exist in the current tmux session, and sends the provided command to that window.
|
||||
- **[update_brew_lists](scripts/update_brew_lists):** This script automates the process of updating Homebrew and associated package lists. It can be used to keep track of installed packages and update them as needed.
|
||||
- **[setup_dev_environment](scripts/setup_dev_env):** This script automates the setup of a development environment by installing essential tools, configuring common settings, and providing options for customization. It supports the following options:
|
||||
- **[sessionizer.sh](scripts/sessionizer.sh):** This script simplifies the management of tmux sessions by providing an interactive interface to create or switch between sessions. If a session doesn't exist for a selected directory, it creates a new tmux session with the selected directory as the working directory.
|
||||
- **[windownizer.sh](scripts/windownizer.sh):** This script is designed to streamline the process of sending commands to a specific tmux window. It takes a branch name (or any identifier) as an argument, creates a new window if it doesn't exist in the current tmux session, and sends the provided command to that window.
|
||||
- **[update_brew_lists.sh](scripts/update_brew_lists.sh):** This script automates the process of updating Homebrew and associated package lists. It can be used to keep track of installed packages and update them as needed.
|
||||
- **[setup_dev_env.sh](scripts/setup_dev_env.sh):** This script automates the setup of a development environment by installing essential tools, configuring common settings, and providing options for customization. It supports the following options:
|
||||
- `-a` or `--disable-auto-update`: Disable Homebrew auto-updates.
|
||||
- `-n` or `--disable-notification`: Disable notifications during setup.
|
||||
- **[docker_check](scripts/docker_check):** This script automates the process of ensuring Docker is installed and running before executing Docker-related commands. If Docker is not installed, it provides an option to install it via Homebrew.
|
||||
- **[add_yaml_header](scripts/add_yaml_header):** This script ensures that YAML files within a specified directory contain the necessary `---` header. If a YAML file does not have the `---` header, the script adds it.
|
||||
- **[wzp](scripts/wzp):** This script automates the process of starting a new Wezterm project. It allows you to select a project from a predefined list or specify a project name as an argument.
|
||||
- **[volumizer](scripts/volumizer):** This script manages volume levels on macOS and Linux systems. It limits the volume to a specified maximum when headphones are connected, protecting users' hearing. It integrates notifications to alert users of volume changes and headphone status seamlessly.
|
||||
- **[fzf_theme](scripts/fzf_theme):** This script configures the `fzf` color theme based on the system's appearance mode (Light or Dark) for both macOS and Linux systems. It automatically detects the system's appearance or can be overridden with a specified mode, adjusting the `fzf` theme colors accordingly.
|
||||
- **[docker_check.sh](scripts/docker_check.sh):** This script automates the process of ensuring Docker is installed and running before executing Docker-related commands. If Docker is not installed, it provides an option to install it via Homebrew.
|
||||
- **[add_yaml_header.sh](scripts/add_yaml_header.sh):** This script ensures that YAML files within a specified directory contain the necessary `---` header. If a YAML file does not have the `---` header, the script adds it.
|
||||
- **[wzp.sh](scripts/wzp.sh):** This script automates the process of starting a new Wezterm project. It allows you to select a project from a predefined list or specify a project name as an argument.
|
||||
- **[volumizer.sh](scripts/volumizer.sh):** This script manages volume levels on macOS and Linux systems. It limits the volume to a specified maximum when headphones are connected, protecting users' hearing. It integrates notifications to alert users of volume changes and headphone status seamlessly.
|
||||
- **[fzf_theme.sh](scripts/fzf_theme.sh):** This script configures the `fzf` color theme based on the system's appearance mode (Light or Dark) for both macOS and Linux systems. It automatically detects the system's appearance or can be overridden with a specified mode, adjusting the `fzf` theme colors accordingly.
|
||||
- **[bootstrap_setup.sh](scripts/bootstrap_setup.sh):**
|
||||
- **[check_alias.sh](scripts/check_alias.sh):**
|
||||
- **[most_recent_note.sh](scripts/most_recent_note.sh):**
|
||||
- **[buildnote.sh](scripts/buildnote.sh):**
|
||||
- **[kaggle_manager](scripts/kaggle_manager.sh):**
|
||||
- **[notetaker.sh](scripts/notetaker.sh):**
|
||||
|
||||
## Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ Welcome to the documentation for the `.local-bin` repository. This collection is
|
|||
- [docker_check](docker_check/Usage.md): This script automates the process of ensuring Docker is installed and running before executing Docker-related commands. If Docker is not installed, it provides an option to install it via Homebrew.
|
||||
- [add_yaml_header](add_yaml_header/Usage.md): This script ensures that YAML files within a specified directory contain the necessary `---` header. If a YAML file does not have the `---` header, the script adds it.
|
||||
- [wzp](wzp/Usage.md): This script automates the process of starting a new Wezterm project. It allows you to select a project from a predefined list or specify a project name as an argument.
|
||||
- **[bootstrap_setup.sh](scripts/bootstrap_setup.sh):**
|
||||
- **[check_alias.sh](scripts/check_alias.sh):**
|
||||
- **[most_recent_note.sh](scripts/most_recent_note.sh):**
|
||||
- **[buildnote.sh](scripts/buildnote.sh):**
|
||||
- **[kaggle_manager](scripts/kaggle_manager.sh):**
|
||||
- **[notetaker.sh](scripts/notetaker.sh):**
|
||||
|
||||
Feel free to use these scripts to simplify tasks and enhance your development workflow.
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ remember your answer. You can later adjust your per-project preferences in the
|
|||
|
||||
see also: https://github.com/Yelp/aactivator
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import io
|
||||
|
|
@ -55,9 +56,7 @@ else
|
|||
if ! ( echo "$PROMPT_COMMAND" | grep -Fq '{cmd}' ); then
|
||||
PROMPT_COMMAND='{cmd}; '"$PROMPT_COMMAND"
|
||||
fi
|
||||
fi""".format(
|
||||
version=__version__, arg0=arg0, cmd=cmd, varname=ENVIRONMENT_VARIABLE
|
||||
)
|
||||
fi""".format(version=__version__, arg0=arg0, cmd=cmd, varname=ENVIRONMENT_VARIABLE)
|
||||
|
||||
|
||||
def get_filesystem_id(path):
|
||||
|
|
@ -195,7 +194,7 @@ class ActivateConfig(object):
|
|||
if response.startswith("N"):
|
||||
self.disallowed.append(path)
|
||||
print(
|
||||
"aactivator will remember this: " "~/.cache/aactivator/disallowed",
|
||||
"aactivator will remember this: ~/.cache/aactivator/disallowed",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return False
|
||||
|
|
@ -207,7 +206,7 @@ class ActivateConfig(object):
|
|||
elif response.startswith("y"):
|
||||
self.allowed.append(path)
|
||||
print(
|
||||
"aactivator will remember this: " "~/.cache/aactivator/allowed",
|
||||
"aactivator will remember this: ~/.cache/aactivator/allowed",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return True
|
||||
|
|
|
|||
45
scripts/bootstrap_setup.sh
Executable file
45
scripts/bootstrap_setup.sh
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
GH_USERNAME="jfrays"
|
||||
|
||||
# Dry run mode
|
||||
DRY_RUN=false
|
||||
if [[ "$1" == "--dry-run" ]]; then
|
||||
DRY_RUN=true
|
||||
echo "🧪 Dry run mode enabled: commands will be echoed but not executed."
|
||||
fi
|
||||
|
||||
run() {
|
||||
echo "+ $*"
|
||||
if [[ "$DRY_RUN" == false ]]; then
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
run_shell() {
|
||||
echo "+ $*"
|
||||
if [[ "$DRY_RUN" == false ]]; then
|
||||
bash -c "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
# Install package manager tools
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
run sudo apt update
|
||||
run sudo apt install -y git stow curl
|
||||
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
run xcode-select --install
|
||||
run_shell "/bin/bash -c '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)'"
|
||||
run brew install stow git curl
|
||||
fi
|
||||
|
||||
# Clone dotfiles
|
||||
run git clone "https://github.com/$GH_USERNAME/dotfiles.git" "$HOME/.dotfiles"
|
||||
run bash -c "cd \"$HOME/.dotfiles\" && ./setup.sh"
|
||||
|
||||
# Setup dev scripts
|
||||
run mkdir -p "$HOME/.local/bin/scripts"
|
||||
run git clone "https://github.com/$GH_USERNAME/scripts.git" "$HOME/.local/bin/scripts"
|
||||
run bash -c "cd \"$HOME/.local/bin/scripts\" && chmod +x setup_dev_env.sh && ./setup_dev_env.sh"
|
||||
|
|
@ -1,32 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Check if nvim is installed
|
||||
# Safer aliases that depend on tools being available
|
||||
|
||||
# Use Neovim if available
|
||||
if command -v nvim >/dev/null; then
|
||||
alias v="nvim"
|
||||
alias v="nvim"
|
||||
fi
|
||||
|
||||
# Check if eza is installed
|
||||
# Enhanced ls with eza
|
||||
if command -v eza >/dev/null; then
|
||||
alias ls='eza --group-directories-first --color=auto'
|
||||
alias la='eza -la --group-directories-first --color=auto'
|
||||
alias ll='eza -l --group-directories-first --color=auto'
|
||||
alias lt='eza -lt modified --sort newest'
|
||||
alias lS='eza -lS --group-directories-first --color=auto'
|
||||
alias tree='eza --tree --level=3'
|
||||
alias lg='eza --git'
|
||||
alias ls='eza --group-directories-first --color=auto'
|
||||
alias la='eza -a --group-directories-first --color=auto'
|
||||
alias ll='eza -lh --group-directories-first --color=auto'
|
||||
alias lla='eza -la --group-directories-first --color=auto'
|
||||
alias l='eza --classify'
|
||||
alias lt='eza -lt modified --sort newest'
|
||||
alias lS='eza -lS --group-directories-first --color=auto'
|
||||
alias tree='eza --tree --level=3'
|
||||
alias lg='eza --git'
|
||||
fi
|
||||
|
||||
# Check if bat is installed
|
||||
# Bat for pretty `cat` and help
|
||||
if command -v bat >/dev/null; then
|
||||
alias cat="bat --paging=never"
|
||||
# Define a function instead of aliasing inside same unit
|
||||
cat() {
|
||||
command bat --paging=never "$@"
|
||||
}
|
||||
|
||||
help() {
|
||||
"$@" --help 2>&1 | bathelp
|
||||
}
|
||||
alias bathelp="bat --plain --language=help"
|
||||
bathelp() {
|
||||
bat --plain --language=help
|
||||
}
|
||||
|
||||
# Overwriting -h and --help with bat highlights
|
||||
alias -g :h='-h 2>&1 | bat --language=help --style=plain'
|
||||
alias -g :help='--help 2>&1 | bat --language=help --style=plain'
|
||||
help() {
|
||||
"$@" --help 2>&1 | bathelp
|
||||
}
|
||||
|
||||
# Global aliases for help text
|
||||
alias -g :h='-h 2>&1 | bat --language=help --style=plain'
|
||||
alias -g :help='--help 2>&1 | bat --language=help --style=plain'
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DOTFILES_REPO="git@github.com:jfraeys/dotfiles.git"
|
||||
DOTFILES_DIR="$HOME/.dotfiles"
|
||||
DOTFILES_DIR="${XDG_HOME:-$HOME}/dotfiles"
|
||||
|
||||
# Function to check if a command is available
|
||||
command_exists() {
|
||||
|
|
@ -164,7 +164,6 @@ setup_macos_dock() {
|
|||
defaults write com.apple.dock largesize -int 64
|
||||
defaults write com.apple.dock orientation -string "left"
|
||||
defaults write com.apple.dock mineffect -string "scale"
|
||||
default
|
||||
}
|
||||
|
||||
# Function to install and configure zsh
|
||||
|
|
|
|||
30
scripts/setup_mactex_poppler.sh
Executable file
30
scripts/setup_mactex_poppler.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
echo "==> Setting up MacTeX and Poppler..."
|
||||
echo "==> Checking for Homebrew..."
|
||||
if ! command -v brew &>/dev/null; then
|
||||
echo "Homebrew not found. Install it from https://brew.sh/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
brew update
|
||||
brew install --cask mactex-no-gui
|
||||
brew install poppler
|
||||
|
||||
TEX_BIN="/Library/TeX/texbin"
|
||||
if [[ ":$PATH:" != *":$TEX_BIN:"* ]]; then
|
||||
echo "export PATH='/Library/TeX/texbin:$PATH'" >>~/.zprofile
|
||||
export PATH="/Library/TeX/texbin:$PATH"
|
||||
fi
|
||||
|
||||
echo -n "pdflatex: "
|
||||
pdflatex --version | head -n1
|
||||
echo -n "xelatex: "
|
||||
xelatex --version | head -n1
|
||||
echo -n "latexmk: "
|
||||
latexmk -v | head -n1
|
||||
echo -n "pdfinfo: "
|
||||
pdfinfo -v | head -n1
|
||||
|
||||
echo "✅ Done."
|
||||
42
scripts/update_border_theme.sh
Executable file
42
scripts/update_border_theme.sh
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aerospace/aerospace.toml"
|
||||
|
||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||
echo "Error: Aerospace config not found at $CONFIG_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
detect_appearance() {
|
||||
defaults read -g AppleInterfaceStyle 2>/dev/null | grep -qi "Dark" && echo "dark" || echo "light"
|
||||
}
|
||||
|
||||
# Allow override
|
||||
if [[ $# -eq 1 ]]; then
|
||||
mode="$1"
|
||||
else
|
||||
mode="$(detect_appearance)"
|
||||
fi
|
||||
|
||||
# Set target border config per mode
|
||||
if [[ "$mode" == "dark" ]]; then
|
||||
new_border_line='borders active_color=0xffe6e8eb inactive_color=0xff3a3f4b width=5.0'
|
||||
elif [[ "$mode" == "light" ]]; then
|
||||
new_border_line='borders active_color=0xff002b36 inactive_color=0xff93a1a1 width=5.0'
|
||||
else
|
||||
echo "Invalid mode: $mode" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use sd if available, fallback to sed
|
||||
if command -v sd >/dev/null 2>&1; then
|
||||
sd '^borders .*' "$new_border_line" "$CONFIG_FILE"
|
||||
else
|
||||
SED_OPTS=()
|
||||
[[ "$OSTYPE" == "darwin"* ]] && SED_OPTS=(-i '')
|
||||
sed "${SED_OPTS[@]}" "s/^borders .*/$new_border_line/" "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
eval "${new_border_line}"
|
||||
50
scripts/update_starship_theme.sh
Executable file
50
scripts/update_starship_theme.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
STARSHIP_CONFIG=$(realpath "$CONFIG_DIR/starship.toml")
|
||||
|
||||
if [[ ! -f "$STARSHIP_CONFIG" ]]; then
|
||||
echo "Error: starship.toml not found at $STARSHIP_CONFIG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
detect_appearance() {
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
defaults read -g AppleInterfaceStyle 2>/dev/null | grep -qi "Dark" && echo "dark" || echo "light"
|
||||
elif command -v gsettings >/dev/null 2>&1; then
|
||||
gsettings get org.gnome.desktop.interface color-scheme 2>/dev/null | grep -qi 'dark' && echo "dark" || echo "light"
|
||||
else
|
||||
echo "dark"
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine target palette
|
||||
if [[ $# -eq 1 ]]; then
|
||||
target_palette="$1"
|
||||
else
|
||||
case "$(detect_appearance)" in
|
||||
dark) target_palette="monokai_pro" ;;
|
||||
light) target_palette="solarized_light" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Extract current palette from config
|
||||
current_palette=$(awk -F'=' '/^palette/ {gsub(/[[:space:]"]/, "", $2); print $2}' "$STARSHIP_CONFIG")
|
||||
|
||||
# Compare and update if necessary
|
||||
if [[ "$current_palette" == "$target_palette" ]]; then
|
||||
echo "Starship palette already set to '$target_palette'. No changes made."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Update
|
||||
if command -v sd >/dev/null 2>&1; then
|
||||
sd 'palette\s*=.*' "palette = \"$target_palette\"" "$STARSHIP_CONFIG"
|
||||
else
|
||||
SED_OPTS=()
|
||||
[[ "$OSTYPE" == "darwin"* ]] && SED_OPTS=(-i '')
|
||||
sed "${SED_OPTS[@]}" "s/palette *=.*/palette = \"$target_palette\"/" "$STARSHIP_CONFIG"
|
||||
fi
|
||||
|
||||
echo "Updated Starship palette to '$target_palette' in $STARSHIP_CONFIG"
|
||||
Loading…
Reference in a new issue