Merge branch 'master' into dependabot/pip/tests/black-24.3.0
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
||||
name: Run test suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.6
|
||||
|
||||
# Run the tests
|
||||
- name: 'Run tests'
|
||||
|
||||
@@ -12,6 +12,14 @@ A local repository can be installed by running:
|
||||
|
||||
./script/install
|
||||
|
||||
Once installed, updates can be applied by running:
|
||||
|
||||
dots
|
||||
|
||||
A specific script can be installed by running:
|
||||
|
||||
dots script1 script2 ...
|
||||
|
||||
### Automated setup
|
||||
|
||||
This repository can be installed without a local copy
|
||||
|
||||
11
files/home/.aliases
Normal file
11
files/home/.aliases
Normal file
@@ -0,0 +1,11 @@
|
||||
# dotfiles
|
||||
alias dots=$DOTFILES/install
|
||||
|
||||
# jump around
|
||||
alias j="z"
|
||||
|
||||
# zip
|
||||
alias tarz="tar -czvf"
|
||||
# unzip
|
||||
alias tarx="tar -xzvf"
|
||||
alias taru="tarx"
|
||||
@@ -85,6 +85,7 @@ if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||
fi
|
||||
|
||||
|
||||
# _ _ _ ____
|
||||
# U /"\ u |"| ___ U /"\ u / __"| u
|
||||
# \/ _ \/ U | | u |_"_| \/ _ \/ <\___ \/
|
||||
@@ -93,5 +94,7 @@ fi
|
||||
# \\ >> // \\.-,_|___|_,-.\\ >> )( (__)
|
||||
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
|
||||
#
|
||||
alias j="z"
|
||||
alias fd=`command -v fdfind`
|
||||
|
||||
if [ -f ~/.aliases ]; then
|
||||
source ~/.aliases
|
||||
fi
|
||||
|
||||
@@ -8,10 +8,9 @@ source $HOME/.profile
|
||||
export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
|
||||
ZSH_THEME="powerlevel10k/powerlevel10k"
|
||||
|
||||
export DISABLE_AUTO_UPDATE="true"
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
zstyle ':omz:update' frequency 13
|
||||
|
||||
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
|
||||
plugins=(
|
||||
aliases
|
||||
|
||||
@@ -5,8 +5,8 @@ set -eo pipefail
|
||||
# Script to run all install scripts contained in install.d
|
||||
#
|
||||
|
||||
printf "\n\t <<< dots installer >>>\n"
|
||||
printf "\t========================\n\n\n"
|
||||
printf "\n\t <<< dots >>>\n"
|
||||
printf "\t==============\n\n\n"
|
||||
|
||||
# Prevent running as root
|
||||
if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then
|
||||
@@ -49,12 +49,28 @@ if [[ ! -f "$log_target" ]]; then
|
||||
fi
|
||||
log_abs_target=$(readlink -f "$log_target")
|
||||
|
||||
# Set up targets
|
||||
targets=($@)
|
||||
|
||||
# Run install scripts
|
||||
install() {
|
||||
run() {
|
||||
echo "Running \"$(basename "$0")\" at \"$(date)\""
|
||||
echo "Running as \"$(whoami)\" on \"$(hostname)\""
|
||||
if [[ -n "$targets" ]]; then
|
||||
echo "Running ${#targets[@]} install target(s): ${targets[@]}"
|
||||
else
|
||||
echo "Running all install targets"
|
||||
fi
|
||||
|
||||
for script in $install_dir/*.sh; do
|
||||
if [[ -n "$targets" ]]; then
|
||||
script_name=$(basename $script .sh)
|
||||
script_name=${script_name#*-}
|
||||
if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
script_name=$(basename $script)
|
||||
printf "\n\n<<< $script_name:\n"
|
||||
source $script
|
||||
@@ -63,7 +79,7 @@ install() {
|
||||
done
|
||||
}
|
||||
echo "install: Logging to \"$log_abs_target\""
|
||||
install 2>&1 | tee "$log_abs_target"
|
||||
run 2>&1 | tee "$log_abs_target"
|
||||
|
||||
# Clean up
|
||||
unset uuid dir install_dir log_dir log_abs_target log_target
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
# Print SSH key.
|
||||
#
|
||||
|
||||
# skip if CODESPACES is set
|
||||
if [ -n "$CODESPACES" ]; then
|
||||
export SKIP_SSH_CONFIG=1
|
||||
fi
|
||||
|
||||
# skip if SKIP_SSH_CONFIG is set
|
||||
if [ -z "$SKIP_SSH_CONFIG" ]; then
|
||||
ssh_method="ed25519"
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
export NONINTERACTIVE=1
|
||||
if ! command -v brew &> /dev/null; then
|
||||
echo "Installing Homebrew..."
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
else
|
||||
echo "Homebrew is already installed."
|
||||
fi
|
||||
|
||||
brew update
|
||||
|
||||
@@ -17,3 +17,5 @@ if ! command -v gh &>/dev/null; then
|
||||
brew install gh
|
||||
fi
|
||||
fi
|
||||
|
||||
gh --version
|
||||
17
script/install.d/22-azure.sh
Normal file
17
script/install.d/22-azure.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# Install Azure CLI.
|
||||
#
|
||||
|
||||
if ! command -v az &>/dev/null; then
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
|
||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
brew install azure-cli
|
||||
fi
|
||||
fi
|
||||
|
||||
az --version
|
||||
14
script/install.d/72-meetingbar.sh
Normal file
14
script/install.d/72-meetingbar.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# (macOS only) Install MeetingBar.
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
if ! brew list --cask meetingbar &> /dev/null; then
|
||||
brew install --cask meetingbar
|
||||
else
|
||||
echo "MeetingBar is already installed."
|
||||
fi
|
||||
fi
|
||||
14
script/install.d/73-betterdisplay.sh
Normal file
14
script/install.d/73-betterdisplay.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# (macOS only) Install BetterDisplay.
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
if ! brew list --cask betterdisplay &> /dev/null; then
|
||||
brew install --cask betterdisplay
|
||||
else
|
||||
echo "BetterDisplay is already installed."
|
||||
fi
|
||||
fi
|
||||
14
script/install.d/74-dockutil.sh
Normal file
14
script/install.d/74-dockutil.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# (macOS only) Install dockutil.
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
if ! brew list dockutil &> /dev/null; then
|
||||
brew install dockutil
|
||||
else
|
||||
echo "dockutil is already installed."
|
||||
fi
|
||||
fi
|
||||
14
script/install.d/81-cmatrix.sh
Normal file
14
script/install.d/81-cmatrix.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# Install cmatrix.
|
||||
#
|
||||
|
||||
if ! command -v "cmatrix" &>/dev/null; then
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
sudo apt-get install -qq cmatrix &>/dev/null
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
brew install cmatrix
|
||||
fi
|
||||
fi
|
||||
187
script/install.d/97-macos.sh
Normal file
187
script/install.d/97-macos.sh
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# (macOS only) Configure defaults
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# Keyboard
|
||||
# --------
|
||||
# off -- Keyboard: Capitalize words automatically
|
||||
defaults write -globalDomain NSAutomaticCapitalizationEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Add period with double-space
|
||||
defaults write -globalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Quote substitution
|
||||
defaults write -globalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Dash substitution
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Auto-correct
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
# Appearance
|
||||
# ----------
|
||||
# Multicolour -- Appearance
|
||||
defaults write -globalDomain AppleAquaColorVariant -int 0
|
||||
|
||||
# on -- Appearance: Dark mode
|
||||
defaults write -globalDomain AppleInterfaceStyle -string "Dark"
|
||||
|
||||
# #2CB494 -- Highlight color
|
||||
defaults write -globalDomain AppleHighlightColor -string "0.172549 0.705882 0.580392"
|
||||
|
||||
killall SystemUIServer 2>/dev/null || true
|
||||
|
||||
# Control Center
|
||||
# --------------
|
||||
# off -- Control Center: Show Bluetooth icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
Bluetooth \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Wi-Fi icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
WiFi \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Now Playing icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
NowPlaying \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Battery icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
Battery \
|
||||
-int 24
|
||||
|
||||
killall ControlCenter 2>/dev/null || true
|
||||
|
||||
# Finder
|
||||
# ------
|
||||
# on -- Finder: Add quit option
|
||||
defaults write com.apple.finder QuitMenuItem -bool true
|
||||
|
||||
# on -- Finder: Show hidden files
|
||||
defaults write com.apple.finder AppleShowAllFiles -bool true
|
||||
|
||||
# on -- Finder: Show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# off -- Finder: Show warning before changing an extension
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# on -- Finder: Show path bar
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# on -- Finder: Show status bar
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
|
||||
# on -- Finder: Keep folders on top
|
||||
defaults write com.apple.finder _FXSortFoldersFirst -bool true
|
||||
|
||||
# off -- Finder: Use macOS Crash Reporter
|
||||
defaults write com.apple.CrashReporter DialogType -string "none"
|
||||
|
||||
# off -- Finder: Enable dashboard widgets
|
||||
defaults write com.apple.dashboard mcx-disabled -bool true
|
||||
|
||||
# on -- Finder: Show hard drives on desktop
|
||||
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show external hard drives on desktop
|
||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show removable media on desktop
|
||||
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show mounted servers on desktop
|
||||
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
||||
|
||||
# off -- Finder: Show recent tags
|
||||
defaults write com.apple.finder ShowRecentTags -bool false
|
||||
|
||||
# off -- Finder: Create .DS_Store files
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
|
||||
# home -- Finder: New Finder windows show
|
||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
|
||||
|
||||
# list -- Finder: Preferred view style
|
||||
defaults write com.apple.finder FXPreferredViewStyle -string "nlsv"
|
||||
|
||||
killall Finder 2>/dev/null || true
|
||||
|
||||
# Spotlight
|
||||
# ---------
|
||||
# on -- Spotlight: Hide menu bar icon
|
||||
defaults write com.apple.Spotlight MenuItemHidden -int 1
|
||||
|
||||
killall Spotlight 2>/dev/null || true
|
||||
|
||||
# Dock
|
||||
# ----
|
||||
# off -- Dock: Show recent applications
|
||||
defaults write com.apple.dock show-recents -bool false
|
||||
|
||||
# on -- Dock: Use scroll gestures
|
||||
defaults write com.apple.dock scroll-to-open -bool true
|
||||
|
||||
# Remove default apps from the dock
|
||||
default_apps=(
|
||||
"Messages"
|
||||
"Mail"
|
||||
"Maps"
|
||||
"Photos"
|
||||
"FaceTime"
|
||||
"Calendar"
|
||||
"Contacts"
|
||||
"Reminders"
|
||||
"Freeform"
|
||||
"TV"
|
||||
"Music"
|
||||
"News"
|
||||
"Keynote"
|
||||
"Numbers"
|
||||
"Pages"
|
||||
)
|
||||
for default_app in default_apps; do
|
||||
dockutil --remove "$default_app" --no-restart 1>/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
# Set up apps in the dock
|
||||
dock_order=(
|
||||
"/System/Library/CoreServices/Finder.app" # Cannot be moved
|
||||
"/System/Applications/App Store.app"
|
||||
"/System/Applications/Launchpad.app"
|
||||
"/System/Applications/System Settings.app"
|
||||
"/System/Applications/Utilities/Activity Monitor.app"
|
||||
"/Applications/iTerm.app"
|
||||
)
|
||||
dock_state=$(defaults read com.apple.dock persistent-apps)
|
||||
for i in "${!dock_order[@]}"; do
|
||||
if [[ $i -ne 0 ]]; then
|
||||
path="${dock_order[$i]}"
|
||||
name=$(basename "$path" | sed 's/\.app$//')
|
||||
if [[ $dock_state == *"$name"* ]]; then
|
||||
dockutil --move "${path}" --position $i --no-restart
|
||||
else
|
||||
dockutil --add "${path}" --position $i --no-restart
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ ! $dock_state == *"spacer"* ]]; then
|
||||
dockutil --add '' --type spacer --section apps --position "${#dock_order[@]}" --no-restart
|
||||
fi
|
||||
|
||||
killall Dock 2>/dev/null || true
|
||||
fi
|
||||
Reference in New Issue
Block a user