From 0c515df006e4a441eeae9fce7236421d55f952b6 Mon Sep 17 00:00:00 2001 From: anujc4 Date: Fri, 21 Feb 2025 00:22:33 +0000 Subject: [PATCH 1/5] add empty secretsrc --- roles/zsh/files/common_aliasrc | 140 ------------------------ roles/zsh/files/linuxrc | 6 -- roles/zsh/files/macosrc | 188 --------------------------------- roles/zsh/files/zshrc | 139 ------------------------ zsh/secretsrc | 0 5 files changed, 473 deletions(-) delete mode 100644 roles/zsh/files/common_aliasrc delete mode 100644 roles/zsh/files/linuxrc delete mode 100644 roles/zsh/files/macosrc delete mode 100644 roles/zsh/files/zshrc create mode 100755 zsh/secretsrc diff --git a/roles/zsh/files/common_aliasrc b/roles/zsh/files/common_aliasrc deleted file mode 100644 index 098b8f8..0000000 --- a/roles/zsh/files/common_aliasrc +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -# Common aliases -alias ezsh='code $DOT_SOURCE' -alias rzsh='source ~/.zshrc' -alias rtmux='tmux source ~/.tmux.conf' -alias brewup='brew update; brew upgrade; brew cleanup; brew doctor' -alias f='fuck' - -# General purpose alias -alias tmuxls='tmux list-sessions' -alias tmuxkillall='tmux kill-server' - -print_path() { - echo "$PATH" | tr ':' '\n' -} - -tmuxattach() { - tmux attach-session -t "$1" -} - -tmuxkillsession() { - tmux kill-session -t "$1" -} - -tmuxs() { - tmuxinator start "$1" -} - -tmuxx() { - tmuxinator stop "$1" -} - -# 1Password zsh completions -if command -v op &>/dev/null; then - eval "$(op completion zsh)" -fi - -gitdelete() { - git fetch -p - git branch -r | awk '{print $1}' | grep -E -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d - git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d - git remote prune origin -} - -gitdeletesquashed() { - git checkout -q master && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read -r branch; do - mergeBase=$(git merge-base master "$branch") && - [[ $(git cherry master "$(git commit-tree "$(git rev-parse "$branch^{tree}")" -p "$mergeBase" -m _)") == "-"* ]] && - git branch -D "$branch" - done -} - -# Merges the current branch into the branch specified by the argument -gitmergeinto() { - if [ -z "$1" ]; then - echo "Usage: gitmergeinto " - return 1 - fi - branch=$(current_branch) - echo "Merging $branch into $1" - git checkout "$1" - git fetch - git reset --hard origin/"$1" - git merge "$branch" --no-edit - echo "Merged $branch into $1" -} - -# Squash commits in the current branch into the branch specified by the argument -gitsquashinto() { - if [ -z "$1" ]; then - echo "Usage: gitsquashinto " - return 1 - fi - branch=$(current_branch) - echo "Squashing $branch into $1" - git checkout "$1" - git fetch - git reset --hard origin/"$1" - git merge --squash "$branch" - git commit -m "Merged(squash) $branch into $1" - echo "Squashed $branch into $1" -} - -alias docker='nocorrect docker' -alias dockerkillall='docker stop $(docker ps -a -q)' - -# Open bash in a docker container -dbash() { - docker exec -it "$1" bash -} - -# Copy pwd to system clipboard by ctrl-y -function copypwd { - pwd | pbcopy -} -zle -N copypwd -bindkey '^y' copypwd -bindkey -s '^[R' "rzsh\n" - -function pet_save_previous_command() { - PREV=$(fc -lrn | head -n 1) - sh -c "pet new $(printf %q "$PREV")" -} - -function pet-select() { - # shellcheck disable=SC2034,SC2153 - BUFFER=$(pet search --query "$LBUFFER") - # shellcheck disable=SC2034 - CURSOR=$#BUFFER - zle redisplay -} -zle -N pet-select -stty -ixon -bindkey '^s' pet-select - -# Alias for git-forgit -alias gcoo='git-forgit checkout_branch' - -unalias gcp -alias gcp='git-forgit cherry_pick' - -unalias gd -alias gd='git-forgit diff' - -unalias gss -alias gss='git-forgit stash_show' - -alias gll='git log' - -unalias ga -alias ga='git-forgit add' - -unalias gbd -alias gbd='git-forgit branch_delete' - -# Helper function to pretty print the $PATH -function _path() { - echo "$PATH" | tr ":" "\n" | nl -} diff --git a/roles/zsh/files/linuxrc b/roles/zsh/files/linuxrc deleted file mode 100644 index 231886d..0000000 --- a/roles/zsh/files/linuxrc +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -alias open='xdg-open' -alias wifi='nmtui' - -export PATH="$HOME/.local/bin:$PATH" diff --git a/roles/zsh/files/macosrc b/roles/zsh/files/macosrc deleted file mode 100644 index 7769735..0000000 --- a/roles/zsh/files/macosrc +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/bash - -function ruby_config_arm() { - # Get installation paths of ruby dependencies - openssl="$(brew --prefix openssl@1.1)" - readline="$(brew --prefix readline)" - libyaml="$(brew --prefix libyaml)" - llvm="$(brew --prefix llvm)" - - export PATH="$openssl/bin:$llvm/bin:$PATH" - - ldflags="-L$(xcrun -show-sdk-path)/usr/lib -L$openssl/lib -L$llvm/lib" - export LDFLAGS=$ldflags - - cppflags="-I$(xcrun -show-sdk-path)/usr/include -I$openssl/include -I$llvm/include -I$llvm/include/c++/v1" - export CPPFLAGS=$cppflags - - export PKG_CONFIG_PATH="$openssl/lib/pkgconfig" - - RUBY_CONFIGURE_OPTS="--with-openssl-dir=$openssl --with-opt-dir=$readline:$libyaml" - export RUBY_CONFIGURE_OPTS -} - -# e.g. Apple M1 Max -if [[ "$(sysctl -n machdep.cpu.brand_string)" =~ M[[:digit:]] ]]; then - if [[ "$(uname -m)" == "arm64" ]]; then - eval "$(/opt/homebrew/bin/brew shellenv)" - ruby_config_arm - # Dir to store manual arm binaries - export PATH="$PATH:$HOME/.local/bin" - else - eval "$(/usr/local/homebrew/bin/brew shellenv)" - # Dir to store manual x86 binaries - export PATH="$PATH:$HOME/.local_x86/bin" - fi -else - # MacOS on Intel - export PATH="$PATH:$HOME/.local/bin" -fi - -# Mac OSX specific application alias. -alias studio='open -a /Applications/Android\ Studio.app' -alias rmine='open -a /Applications/RubyMine.app' -alias c='code .' -alias fl='open -a ForkLift .' -alias tail_yabai='tail -f $HOMEBREW_PREFIX/var/log/yabai/*.log' -alias tail_sketchybar='tail -f $HOMEBREW_PREFIX/var/log/sketchybar/*.log' - -export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" - -FORGIT_INSTALL_DIR="/Users/$(whoami)/.oh-my-zsh/custom/plugins/forgit/bin" -if [ -d "$FORGIT_INSTALL_DIR" ]; then - export PATH="$PATH:$FORGIT_INSTALL_DIR" - export FORGIT_FZF_DEFAULT_OPTS - export FORGIT_INSTALL_DIR -fi - -# shellcheck disable=SC2155 -export ANDROID_SDK_ROOT="/Users/$(whoami)/Library/Android/sdk" -export THOR_MERGE="code -d $1 $2" - -alias bsl='brew services ls' -alias bsr='brew services restart' -alias bss='brew services start' -alias bsx='brew services stop' -alias tf='terraform' -alias gbc="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy" - -export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home - -# Uninstallation command for Corretto https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/macos-install.html -# cd /Library/Java/JavaVirtualMachines/ -# sudo rm -rf amazon-corretto-17.jdk - -path+=/usr/local/bin - -function portscan() { - lsof -i :"$1" -} - -function rsp() { - local spec_file - spec_file="$(echo "$1" | sed 's/^spec\///')" - RACK_SERVICE_TIMEOUT=0 bundle exec rspec ./spec/"$spec_file" -} - -alias wip='git add . && git commit -m "WIP Commit"' - -function wip_unset() { - local msg - msg="$(git log -1 --pretty=%B)" - if [ "$msg" = "WIP Commit" ]; then - git reset HEAD~1 - else - echo "No WIP commit found. Check your git log" - return 1 - fi -} - -alias b='bundle' -alias bi='bundle install' -alias ba='bundle add' -alias bu='bundle update' - -function rails() { - if [ -e "Gemfile" ]; then - bundle exec rails "$@" - else - command rails "$@" - fi -} - -function rspec() { - if [ -e "Gemfile" ]; then - bundle exec rspec "$@" - else - command rspec "$@" - fi -} - -alias migrate='rails db:migrate' -alias rollback='rails db:rollback' -alias migrate_test='bundle exec rails db:migrate RAILS_ENV=test' -alias rollback_test='bundle exec rails db:rollback RAILS_ENV=test' -function db_reset() { - set +x - STATEMENT_TIMEOUT=0 bundle exec rails db:drop - STATEMENT_TIMEOUT=0 bundle exec rails db:create - STATEMENT_TIMEOUT=0 bundle exec rails db:migrate - - STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:drop - STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:create - STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:migrate -} - -function securekb() { - ioreg -l -w 0 | - perl -nle 'print $1 if /"kCGSSessionSecureInputPID"=(\d+)/' | - uniq | - xargs -I{} ps -p {} -o comm= -} - -if [ -f "$(brew --prefix asdf)/libexec/asdf.sh" ]; then - # shellcheck source=/dev/null - source "$(brew --prefix asdf)/libexec/asdf.sh" - export ASDF_GOLANG_MOD_VERSION_ENABLED=true - - # shellcheck source=/dev/null - . ~/.asdf/plugins/golang/set-env.zsh -fi - -function suyabai() { - local sha256 - sha256=$(shasum -a 256 "$(which yabai)" | awk "{print \$1;}") - if [ -f "/private/etc/sudoers.d/yabai" ]; then - sudo sed -i '' -e 's/sha256:[[:alnum:]]*/sha256:'"${sha256}"'/' /private/etc/sudoers.d/yabai - else - echo "sudoers file does not exist yet. creating one now" - echo "$(whoami) ALL=(root) NOPASSWD: sha256:${sha256} $(which yabai) --load-sa" | sudo tee /private/etc/sudoers.d/yabai - fi -} - -function presentation-mode() { - local normal_mode_file="alacritty_mac.toml" - local presentation_mode_file="alacritty_mac_presentation_mode.toml" - local destination="$HOME/.config/alacritty/alacritty.toml" - - local normal_mode_abs_file - local presentation_mode_abs_file - normal_mode_abs_file="$DOT_SOURCE/roles/alacritty/files/$normal_mode_file" - presentation_mode_abs_file="$DOT_SOURCE/roles/alacritty/files/$presentation_mode_file" - - if [[ ! -f "$normal_mode_abs_file" || ! -f "$presentation_mode_abs_file" ]]; then - echo "alacritty files are not configured. check your dotfiles" - return 1 - fi - - local abs_path - local base_filename - abs_path=$(readlink -f "$HOME/.config/alacritty/alacritty.toml") - base_filename=$(basename "$abs_path") - - if [[ $base_filename == "$normal_mode_file" ]]; then - ln -sf "$presentation_mode_abs_file" "$destination" - else - ln -sf "$normal_mode_abs_file" "$destination" - fi -} diff --git a/roles/zsh/files/zshrc b/roles/zsh/files/zshrc deleted file mode 100644 index 0124e0a..0000000 --- a/roles/zsh/files/zshrc +++ /dev/null @@ -1,139 +0,0 @@ -# To use this zshrc as your default zshrc file, create a symlink of this file -# in your home folder. Just create a symlink of the zshrc file and it will -# source the other files on it's own. The command usually looks like -# ln -s ~/Personal/dotfiles/zsh/zshrc ~/.zshrc - -# To profile zsh in case of slow startup, uncomment the line below and move the -# second command to the bottom of this file -# zmodload zsh/zprof -# zprof - -export EDITOR="nvim" -export LANG=en_US.UTF-8 - -setopt EXTENDED_HISTORY -setopt HIST_EXPIRE_DUPS_FIRST -setopt HIST_IGNORE_DUPS -setopt HIST_IGNORE_ALL_DUPS -setopt HIST_IGNORE_SPACE -setopt HIST_SAVE_NO_DUPS - -# shellcheck disable=SC2034 -ZSH_THEME="spaceship" - -# shellcheck disable=SC2034 -plugins=( - autoupdate - forgit - git - sudo - thefuck - you-should-use - zsh-autosuggestions - zsh-completions - zsh-syntax-highlighting -) - -# This function will set up two important environment varialbles: -# $FILE_DIR: Absolute path to the .zshrc file -# $DOT_SOURCE: Absolute path where dotfiles repo is cloned -# If the script fails to determine the path of dotfiles, it will print an error -# since a lot of functionalities will start failing (tmux, yabai, skhd, etc) -function _set_dot_source() { - local absolute_file_path - - case $(uname) in - Darwin) - # Get the absolute path of the symlinked zshrc to read the other rc files - absolute_file_path="$(readlink /Users/"$(whoami)"/.zshrc)" - FILE_DIR=${absolute_file_path%??????} - # Path to your oh-my-zsh installation. - ZSH="/Users/$(whoami)/.oh-my-zsh" - source "$FILE_DIR/macosrc" - ;; - Linux) - # Get the absolute path of the symlinked zshrc to read the other rc files - absolute_file_path="$(readlink -f /home/"$(whoami)"/.zshrc)" - FILE_DIR=${absolute_file_path%??????} - # Path to your oh-my-zsh installation. - ZSH="/home/$(whoami)/.oh-my-zsh" - source "$FILE_DIR/linuxrc" - ;; - esac - export ZSH - export FILE_DIR - - current_dir=$FILE_DIR - while [[ "$current_dir" != "/" && "$current_dir" != *"dotfiles" ]]; do - current_dir=$(dirname "$current_dir") - done - - if [[ "$current_dir" == *"dotfiles" ]]; then - export DOT_SOURCE=${current_dir} - else - local message = "FATAL ERROR: Shell was not able to determine $DOT_SOURCE. - This will break other configurations. Check your zshrc configuration and - fix any errors." - fi -} - -_set_dot_source -unfunction _set_dot_source - -autoload -Uz compinit -# zsh-specific code, disable all errors -# shellcheck disable=SC1072,SC1073,SC1036,SC1058 -for dump in ~/.zcompdump(N.mh+24); do - compinit -done -compinit -C -zstyle ':completion:*' menu yes select -# shellcheck enable=SC1072,SC1073,SC1036,SC1058 - -eval "$(zoxide init zsh)" - -FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" - -# don't expand aliases _before_ completion has finished -setopt complete_aliases -bindkey "^Xa" _expand_alias -zstyle ':completion:*' completer _expand_alias _complete _ignored -zstyle ':completion:*' regular true - -# shellcheck disable=SC2034 -DISABLE_MAGIC_FUNCTIONS=true - -# shellcheck source=/dev/null -source "$ZSH/oh-my-zsh.sh" - -# Prevent zsh from showing the system name before each command -prompt_context() { true; } -prompt_aws() { true; } - -# shellcheck source=/dev/null -eval "$(fzf --zsh)" -# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - - -# Homebrew completions. Refer https://docs.brew.sh/Shell-Completion -if type brew &>/dev/null; then - FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH -fi - -# shellcheck source=/dev/null -source "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh" - -# Disable that pesky auto correct -unsetopt correct_all -unsetopt nomatch - -# shellcheck source=/dev/null -source "$FILE_DIR/common_aliasrc" - -# shellcheck source=/dev/null -source "$FILE_DIR/secretsrc" - -eval "$(thefuck --alias)" - -typeset -U path -export PATH diff --git a/zsh/secretsrc b/zsh/secretsrc new file mode 100755 index 0000000..e69de29 From 1548aec2791475a70cdc0c2d26a41fbfdbc0afb0 Mon Sep 17 00:00:00 2001 From: anujc4 Date: Fri, 21 Feb 2025 00:25:09 +0000 Subject: [PATCH 2/5] ignore secretsrc --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 88c549b..1f2ce3c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ macos_wm/skhd/sip_skhdrc roles/zsh/files/secretsrc + +zsh/secretsrc From 515f45ed42b763f6e6357b6f86a4185124d9e321 Mon Sep 17 00:00:00 2001 From: anujc4 Date: Fri, 21 Feb 2025 00:26:00 +0000 Subject: [PATCH 3/5] add dotbot --- .gitmodules | 4 ++++ dotbot | 1 + 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 dotbot diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1af14d0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "dotbot"] + path = dotbot + url = https://github.com/anishathalye/dotbot + ignore = dirty diff --git a/dotbot b/dotbot new file mode 160000 index 0000000..686db86 --- /dev/null +++ b/dotbot @@ -0,0 +1 @@ +Subproject commit 686db8603ee85ba417e683d27b40dd7d1d53aee0 From d1eb1bdffd885f739a656b4513b886663b632635 Mon Sep 17 00:00:00 2001 From: anujc4 Date: Fri, 21 Feb 2025 01:40:32 +0000 Subject: [PATCH 4/5] migrate configs --- Brewfile | 21 + .../files => alacritty}/alacritty_mac.toml | 2 +- .../alacritty_mac_base.toml | 0 .../alacritty_mac_presentation_mode.toml | 0 defaults | 74 --- install | 15 + install.conf.yaml | 138 +++++ internal/helper.sh | 11 + macos_optimzations | 77 +++ roles/alacritty/files/alacritty_linux.yml | 482 ------------------ roles/tmux/tasks/main.yml | 35 -- roles/zsh/tasks/main.yml | 56 -- {roles/tmux/files => tmux}/tmux.conf | 2 +- .../tmux/files => tmux}/unused_mappings.conf | 0 zsh/common_aliasrc | 140 +++++ zsh/linuxrc | 6 + zsh/macosrc | 188 +++++++ zsh/zshrc | 140 +++++ 18 files changed, 738 insertions(+), 649 deletions(-) create mode 100644 Brewfile rename {roles/alacritty/files => alacritty}/alacritty_mac.toml (60%) rename {roles/alacritty/files => alacritty}/alacritty_mac_base.toml (100%) rename {roles/alacritty/files => alacritty}/alacritty_mac_presentation_mode.toml (100%) delete mode 100644 defaults create mode 100755 install create mode 100644 install.conf.yaml create mode 100755 internal/helper.sh create mode 100755 macos_optimzations delete mode 100644 roles/alacritty/files/alacritty_linux.yml delete mode 100644 roles/tmux/tasks/main.yml delete mode 100644 roles/zsh/tasks/main.yml rename {roles/tmux/files => tmux}/tmux.conf (98%) rename {roles/tmux/files => tmux}/unused_mappings.conf (100%) create mode 100644 zsh/common_aliasrc create mode 100644 zsh/linuxrc create mode 100644 zsh/macosrc create mode 100644 zsh/zshrc diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..41c413d --- /dev/null +++ b/Brewfile @@ -0,0 +1,21 @@ +brew "asdf" +brew "yt-dlp" + +cask "1password-cli" +cask "1password" +cask "alacritty" +cask "brave-browser" +cask "caffeine" +cask "contexts" +cask "docker" +cask "firefox" +cask "forklift" +cask "maccy" +cask "monitorcontrol" +cask "plex" +cask "private-internet-access" +cask "raycast" +cask "stats" +cask "visual-studio-code" +cask "vlc" +cask "whatsapp" diff --git a/roles/alacritty/files/alacritty_mac.toml b/alacritty/alacritty_mac.toml similarity index 60% rename from roles/alacritty/files/alacritty_mac.toml rename to alacritty/alacritty_mac.toml index 107b751..335f78b 100644 --- a/roles/alacritty/files/alacritty_mac.toml +++ b/alacritty/alacritty_mac.toml @@ -1,6 +1,6 @@ [general] import = [ - "~/Personal/dotfiles/roles/alacritty/files/alacritty_mac_base.toml", + "~/Personal/dotfiles/alacritty/alacritty_mac_base.toml", "~/.config/alacritty/themes/themes/gruvbox_dark.toml", ] diff --git a/roles/alacritty/files/alacritty_mac_base.toml b/alacritty/alacritty_mac_base.toml similarity index 100% rename from roles/alacritty/files/alacritty_mac_base.toml rename to alacritty/alacritty_mac_base.toml diff --git a/roles/alacritty/files/alacritty_mac_presentation_mode.toml b/alacritty/alacritty_mac_presentation_mode.toml similarity index 100% rename from roles/alacritty/files/alacritty_mac_presentation_mode.toml rename to alacritty/alacritty_mac_presentation_mode.toml diff --git a/defaults b/defaults deleted file mode 100644 index 6c4adf1..0000000 --- a/defaults +++ /dev/null @@ -1,74 +0,0 @@ -############# Disable animations when switching spaces ######################### -# defaults write com.apple.dock expose-animation-duration -int 0; killall Dock -# defaults delete com.apple.dock expose-animation-duration; killall Dock - -################################################################################# - -# Don't reorder Spaces based on most recent use -defaults write com.apple.dock "mru-spaces" -bool "false" && killall Dock - -# Autohide the Dock when the mouse is out -# defaults write com.apple.dock "autohide" -bool "true" && killall Dock - -# Disable Bouncing dock icons -defaults write com.apple.dock no-bouncing -bool True - -# Disable the "Are you sure you want to open this application?" dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false - -# Finder: show path bar -defaults write com.apple.finder ShowPathbar -bool true - -# When performing a search, search the current folder by default -defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" - -# Keep folders on top when sorting by name -defaults write com.apple.finder _FXSortFoldersFirst -bool true - -# Speed up Mission Control animations -defaults write com.apple.dock expose-animation-duration -float 0.1 - -# Don't automatically rearrange Spaces based on most recent use -defaults write com.apple.dock mru-spaces -bool false - -# Privacy: don't send search queries to Apple -defaults write com.apple.Safari UniversalSearchEnabled -bool false - -defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true -defaults write com.apple.spaces spans-displays -bool false -defaults write com.apple.dock autohide -bool true -defaults write com.apple.dock "mru-spaces" -bool "false" -defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false -defaults write com.apple.LaunchServices LSQuarantine -bool false -defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false -defaults write NSGlobalDomain KeyRepeat -int 1 -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false -defaults write NSGlobalDomain AppleShowAllExtensions -bool true -defaults write NSGlobalDomain _HIHideMenuBar -bool true -defaults write NSGlobalDomain AppleHighlightColor -string "0.65098 0.85490 0.58431" -defaults write NSGlobalDomain AppleAccentColor -int 1 -defaults write com.apple.screencapture location -string "$HOME/Desktop" -defaults write com.apple.screencapture disable-shadow -bool true -defaults write com.apple.screencapture type -string "png" - -defaults write com.apple.finder DisableAllAnimations -bool true -defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false -defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false -defaults write com.apple.finder ShowMountedServersOnDesktop -bool false -defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false -defaults write com.apple.Finder AppleShowAllFiles -bool true -defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" -defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false -defaults write com.apple.finder _FXShowPosixPathInTitle -bool true -defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" -defaults write com.apple.finder ShowStatusBar -bool false -defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES -defaults write com.apple.Safari AutoOpenSafeDownloads -bool false -defaults write com.apple.Safari IncludeDevelopMenu -bool true -defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true -defaults write NSGlobalDomain WebKitDeveloperExtras -bool true -defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false - -# allows key-repeat in VS Code -defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false diff --git a/install b/install new file mode 100755 index 0000000..5a7e72c --- /dev/null +++ b/install @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +CONFIG="install.conf.yaml" +DOTBOT_DIR="dotbot" + +DOTBOT_BIN="bin/dotbot" +BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "${BASEDIR}" +git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive +git submodule update --init --recursive "${DOTBOT_DIR}" + +"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" diff --git a/install.conf.yaml b/install.conf.yaml new file mode 100644 index 0000000..435917a --- /dev/null +++ b/install.conf.yaml @@ -0,0 +1,138 @@ +- defaults: + link: + relink: true + +- clean: ["~"] + +- create: + - ~/.config/alacritty/themes + +- link: + ~/.zshrc: + path: zsh/zshrc + force: true + ~/.config/.tmux.conf: + path: tmux/tmux.conf + create: true + ~/.config/alacritty/alacritty.toml: + path: alacritty/alacritty_mac.toml + create: true + ~/.config/common_wm/: + path: macos_wm/common + ~/.config/sketchybar/: + path: macos_wm/sketchybar + ~/.config/borders/: + path: macos_wm/borders + ~/.config/yabai/: + path: macos_wm/yabai + ~/.config/skhd/: + path: macos_wm/skhd + +- shell: + - [git submodule update --init --recursive, Installing submodules] + + - # Homebrew + command: | + if [[ $OSTYPE == darwin* ]] && ! which brew &>/dev/null; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + description: Checking Homebrew installation + quiet: true + + - # Oh My Zsh + command: | + if [[ ! -d ~/.oh-my-zsh ]]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + fi + description: Checking Oh My Zsh + quiet: true + + - # omz plugins + command: | + source internal/helper.sh + + git clone https://github.com/changyuheng/zsh-interactive-cd.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/zsh-interactive-cd" + git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/autoupdate" + git clone https://github.com/Aloxaf/fzf-tab "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fzf-tab" + git clone https://github.com/MichaelAquilina/zsh-you-should-use.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use" + git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" + git clone https://github.com/zsh-users/zsh-completions "${ZSH_CUSTOM:=$HOME/.oh-my-zsh/custom}/plugins/zsh-completions" + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" + git clone https://github.com/wfxr/forgit.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/forgit" + git clone https://github.com/spaceship-prompt/spaceship-prompt.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/spaceship-prompt" --depth=1 + + ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme" + + is_installed zoxide || brew install zoxide fzf thefuck + is_installed fzf || brew install fzf + is_installed thefuck || brew install thefuck + description: Installing Oh My Zsh plugins + quiet: true + + - # Tmux + command: | + source internal/helper.sh + is_installed tmux || brew install tmux + description: Installing Tmux + quiet: true + + - # Tmux plugins + command: | + if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + # Install TPM plugins. + # TPM requires running tmux server, as soon as `tmux start-server` does not work + # create dump __noop session in detached mode, and kill it when plugins are installed + tmux new -d -s __noop >/dev/null 2>&1 || true + tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins" + "$HOME"/.tmux/plugins/tpm/bin/install_plugins || true + tmux kill-session -t __noop >/dev/null 2>&1 || true + fi + quiet: true + + - # Alacritty + command: brew install --cask alacritty + description: Installing Alacritty + quiet: true + + - # Alacritty themes + command: git clone https://github.com/alacritty/alacritty-theme "$HOME/.config/alacritty/themes" >/dev/null 2>&1 || true + description: Installing Alacritty themes + quiet: true + + - # Font + command: brew install --cask font-hack-nerd-font + description: Installing Hack Nerd Font + quiet: true + + - # MacOS Window Management + command: | + brew tap koekeishiya/formulae + brew install yabai skhd jq + + brew tap FelixKratz/formulae + brew install sketchybar borders + brew services start sketchybar + curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.4/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf + brew install --cask sf-symbols + description: Installing Yabai + quiet: true + + - # Post-yabai install + command: | + macos_wm/post_yabai_installation.sh + description: Configuring Yabai + quiet: true + + - # MacOS Optimizations + command: | + macos_optimizations + description: Configuring MacOS + quiet: true + + # Commented out because it takes too long. Only run this on a fresh install. + # - # Brew + # command: brew bundle --file=Brewfile + # description: Installing Brew packages + # quiet: true + # stdout: true diff --git a/internal/helper.sh b/internal/helper.sh new file mode 100755 index 0000000..5683061 --- /dev/null +++ b/internal/helper.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +function is_installed() { + local program=$1 + + if command -v "$program" &>/dev/null; then + return 0 + else + return 1 + fi +} diff --git a/macos_optimzations b/macos_optimzations new file mode 100755 index 0000000..ab93525 --- /dev/null +++ b/macos_optimzations @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +set -x + +# Disable animations when switching spaces +defaults write com.apple.dock expose-animation-duration -int 0 + +# Don't reorder Spaces based on most recent use +defaults write com.apple.dock "mru-spaces" -bool "false" + +# Disable Bouncing dock icons +defaults write com.apple.dock no-bouncing -bool True + +# Disable the "Are you sure you want to open this application?" dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false + +# Finder: show path bar +defaults write com.apple.finder ShowPathbar -bool true + +# When performing a search, search the current folder by default +defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" + +# Keep folders on top when sorting by name +defaults write com.apple.finder _FXSortFoldersFirst -bool true + +# Speed up Mission Control animations +defaults write com.apple.dock expose-animation-duration -float 0.1 + +# Don't automatically rearrange Spaces based on most recent use +defaults write com.apple.dock mru-spaces -bool false + +# Prevent .DS_Store files from being created on network volumes +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + +# Do not span Spaces across multiple displays +defaults write com.apple.spaces spans-displays -bool false + +# Disable window animations +defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false + +# Set a fast keyboard repeat rate +defaults write NSGlobalDomain KeyRepeat -int 1 + +# Disable automatic spelling correction +defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + +# Show all file extensions +defaults write NSGlobalDomain AppleShowAllExtensions -bool true + +# Disable shadow in screenshots +defaults write com.apple.screencapture disable-shadow -bool true + +# Disable all Finder animations +defaults write com.apple.finder DisableAllAnimations -bool true + +# Do not show mounted servers on the desktop +defaults write com.apple.finder ShowMountedServersOnDesktop -bool false + +# Do not show removable media on the desktop +defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false + +# Disable the warning when changing a file extension +defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false + +# Show the full POSIX path in the Finder title bar +defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + +# Use list view in all Finder windows by default +defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" + +# Do not show the status bar in Finder +defaults write com.apple.finder ShowStatusBar -bool false + +# allows key-repeat in VS Code +defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false + +killall Dock diff --git a/roles/alacritty/files/alacritty_linux.yml b/roles/alacritty/files/alacritty_linux.yml deleted file mode 100644 index ff13d35..0000000 --- a/roles/alacritty/files/alacritty_linux.yml +++ /dev/null @@ -1,482 +0,0 @@ -# Configuration for Alacritty, the GPU enhanced terminal emulator. - -# Any items in the `env` entry below will be added as -# environment variables. Some entries may override variables -# set by alacritty itself. -env: - # TERM variable - # - # This value is used to set the `$TERM` environment variable for - # each instance of Alacritty. If it is not present, alacritty will - # check the local terminfo database and use `alacritty` if it is - # available, otherwise `xterm-256color` is used. - TERM: xterm-256color - -window: - dimensions: - columns: 0 - lines: 0 - - # Blank space added around the window in pixels. This padding is scaled - # by DPI and the specified value is always added at both opposing sides. - padding: - x: 5 - y: 0 - - # Allow terminal applications to change Alacritty's window title. - dynamic_title: true - - # Spread additional padding evenly around the terminal content. - dynamic_padding: false - - # Window decorations - # Values for `decorations`: - # - full: Borders and title bar - # - none: Neither borders nor title bar - decorations: full - - startup_mode: Windowed - - # Window title - #title: Alacritty - # Window class (Linux only): - class: Alacritty - -scrolling: - # Maximum number of lines in the scrollback buffer. - # Specifying '0' will disable scrolling. - history: 10000 - - # Number of lines the viewport will move for every line scrolled when - # scrollback is enabled (history > 0). - multiplier: 3 - -# Font configuration (changes require restart) -font: - # Normal (roman) font face - normal: - family: Hack Nerd Font - style: Regular - - # Bold font face - bold: - family: Hack Nerd Font - style: Bold - - # Italic font face - italic: - family: Hack Nerd Font - style: Italic - - # Point size - size: 12.0 - - # Offset is the extra space around each character. `offset.y` can be thought of - # as modifying the line spacing, and `offset.x` as modifying the letter spacing. - offset: - x: 0 - y: 0 - - # Glyph offset determines the locations of the glyphs within their cells with - # the default being at the bottom. Increasing `x` moves the glyph to the right, - # increasing `y` moves the glyph upwards. - glyph_offset: - x: 0 - y: 0 - - use_thin_strokes: false - -# If `true`, bold text is drawn using the bright color variants. -draw_bold_text_with_bright_colors: true - -#################### BEGIN COLOR SCHEME #################### - -# Colors (Gruvbox dark) -colors: - primary: - background: &gruvbox_dark_bg '#282828' - foreground: '#fbf1c7' - bright_foreground: '#f9f5d7' - dim_foreground: '#f2e5bc' - cursor: - text: CellBackground - cursor: CellForeground - vi_mode_cursor: - text: CellBackground - cursor: CellForeground - selection: - text: CellBackground - background: CellForeground - bright: - black: '#928374' - red: '#fb4934' - green: '#b8bb26' - yellow: '#fabd2f' - blue: '#83a598' - magenta: '#d3869b' - cyan: '#8ec07c' - white: '#ebdbb2' - normal: - black: *gruvbox_dark_bg - red: '#cc241d' - green: '#98971a' - yellow: '#d79921' - blue: '#458588' - magenta: '#b16286' - cyan: '#689d6a' - white: '#a89984' - dim: - black: '#32302f' - red: '#9d0006' - green: '#79740e' - yellow: '#b57614' - blue: '#076678' - magenta: '#8f3f71' - cyan: '#427b58' - white: '#928374' - -#################### END COLOR SCHEME #################### - -background_opacity: 1.0 - -# Mouse bindings -# -# Available fields: -# - mouse -# - action -# - mods (optional) -# -# Values for `mouse`: -# - Middle -# - Left -# - Right -# - Numeric identifier such as `5` -# -# All available `mods` and `action` values are documented in the key binding -# section. -mouse_bindings: - - { mouse: Middle, action: PasteSelection } - -mouse: - double_click: { threshold: 300 } - triple_click: { threshold: 300 } - hide_when_typing: false - - url: - # URL launcher - # - # This program is executed when clicking on a text which is recognized as a URL. - # The URL is always added to the command as the last parameter. - # - # When set to `None`, URL launching will be disabled completely. - # - # Default: - # - (macOS) open - # - (Linux) xdg-open - # - (Windows) explorer - launcher: - program: xdg-open - # args: [] - # URL modifiers - # - # These are the modifiers that need to be held down for opening URLs when clicking - # on them. The available modifiers are documented in the key binding section. - modifiers: None - -selection: - semantic_escape_chars: ",│`|:\"' ()[]{}<>" - - # When set to `true`, selected text will be copied to the primary clipboard. - save_to_clipboard: false - -cursor: - style: Block - - # If this is `true`, the cursor will be rendered as a hollow box when the - # window is not focused. - unfocused_hollow: true - -# Live config reload (changes require restart) -live_config_reload: true - -# Shell -# -# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`. -# Entries in `shell.args` are passed unmodified as arguments to the shell. -# -# Default: -# - (macOS) /bin/bash --login -# - (Linux) user login shell -# - (Windows) powershell -#shell: -# program: /bin/bash -# args: -# - --login -# Startup directory -# -# Directory the shell is started in. If this is unset, or `None`, the working -# directory of the parent process will be used. -working_directory: None - -# Windows 10 ConPTY backend (Windows only) -# -# This will enable better color support and may resolve other issues, -# however this API and its implementation is still young and so is -# disabled by default, as stability may not be as good as the winpty -# backend. -# -# Alacritty will fall back to the WinPTY automatically if the ConPTY -# backend cannot be initialized. -enable_experimental_conpty_backend: false - -# Send ESC (\x1b) before characters when alt is pressed. -alt_send_esc: true - -debug: - # Display the time it takes to redraw each frame. - render_timer: false - - # Keep the log file after quitting Alacritty. - persistent_logging: false - - # Log level - # - # Values for `log_level`: - # - None - # - Error - # - Warn - # - Info - # - Debug - # - Trace - log_level: Warn - - # Print all received window events. - print_events: false - - # Record all characters and escape sequences as test data. - ref_test: false - -# Key bindings -# -# Key bindings are specified as a list of objects. Each binding will specify a -# key and modifiers required to trigger it, terminal modes where the binding is -# applicable, and what should be done when the key binding fires. It can either -# send a byte sequence to the running application (`chars`), execute a -# predefined action (`action`) or fork and execute a specified command plus -# arguments (`command`). -# -# Bindings are always filled by default, but will be replaced when a new binding -# with the same triggers is defined. To unset a default binding, it can be -# mapped to the `None` action. -# -# Example: -# `- { key: V, mods: Control|Shift, action: Paste }` -# -# Available fields: -# - key -# - mods (optional) -# - chars | action | command (exactly one required) -# - mode (optional) -# -# Values for `key`: -# - `A` -> `Z` -# - `F1` -> `F12` -# - `Key1` -> `Key0` -# -# A full list with available key codes can be found here: -# https://docs.rs/glutin/*/glutin/enum.VirtualKeyCode.html#variants -# -# Instead of using the name of the keys, the `key` field also supports using -# the scancode of the desired key. Scancodes have to be specified as a -# decimal number. -# This command will allow you to display the hex scancodes for certain keys: -# `showkey --scancodes` -# -# Values for `mods`: -# - Command -# - Control -# - Option -# - Super -# - Shift -# - Alt -# -# Multiple `mods` can be combined using `|` like this: `mods: Control|Shift`. -# Whitespace and capitalization is relevant and must match the example. -# -# Values for `chars`: -# The `chars` field writes the specified string to the terminal. This makes -# it possible to pass escape sequences. -# To find escape codes for bindings like `PageUp` ("\x1b[5~"), you can run -# the command `showkey -a` outside of tmux. -# Note that applications use terminfo to map escape sequences back to -# keys. It is therefore required to update the terminfo when -# changing an escape sequence. -# -# Values for `action`: -# - Paste -# - PasteSelection -# - Copy -# - IncreaseFontSize -# - DecreaseFontSize -# - ResetFontSize -# - ScrollPageUp -# - ScrollPageDown -# - ScrollLineUp -# - ScrollLineDown -# - ScrollToTop -# - ScrollToBottom -# - ClearHistory -# - Hide -# - Quit -# - ClearLogNotice -# - SpawnNewInstance -# - ToggleFullscreen -# - None -# -# Values for `action` (macOS only): -# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space -# -# Values for `command`: -# The `command` field must be a map containing a `program` string and -# an `args` array of command line parameter strings. -# -# Example: -# `command: { program: "alacritty", args: ["-e", "vttest"] }` -# -# Values for `mode`: -# - ~AppCursor -# - AppCursor -# - ~AppKeypad -# - AppKeypad -key_bindings: - # (Windows/Linux only) - - { key: V, mods: Control|Shift, action: Paste } - - { key: C, mods: Control|Shift, action: Copy } - #- { key: Insert, mods: Shift, action: PasteSelection } - - { key: Key0, mods: Control, action: ResetFontSize } - - { key: Equals, mods: Control, action: IncreaseFontSize } - - { key: Add, mods: Control, action: IncreaseFontSize } - - { key: Subtract, mods: Control, action: DecreaseFontSize } - - { key: Minus, mods: Control, action: DecreaseFontSize } - - - { key: Paste, action: Paste } - - { key: Copy, action: Copy } - - { key: L, mods: Control, action: ClearLogNotice } - - { key: L, mods: Control, chars: "\f" } - - { key: Home, mods: Alt, chars: "\e[1;3H" } - - { key: Home, chars: "\eOH", mode: AppCursor } - - { key: Home, chars: "\e[H", mode: ~AppCursor } - - { key: End, mods: Alt, chars: "\e[1;3F" } - - { key: End, chars: "\eOF", mode: AppCursor } - - { key: End, chars: "\e[F", mode: ~AppCursor } - - { - key: PageUp, - mods: Shift, - action: ScrollPageUp, - mode: ~Alt - } - - { key: PageUp, mods: Shift, chars: "\e[5;2~", mode: Alt } - - { key: PageUp, mods: Control, chars: "\e[5;5~" } - - { key: PageUp, mods: Alt, chars: "\e[5;3~" } - - { key: PageUp, chars: "\e[5~" } - - { - key: PageDown, - mods: Shift, - action: ScrollPageDown, - mode: ~Alt - } - - { - key: PageDown, - mods: Shift, - chars: "\e[6;2~", - mode: Alt - } - - { key: PageDown, mods: Control, chars: "\e[6;5~" } - - { key: PageDown, mods: Alt, chars: "\e[6;3~" } - - { key: PageDown, chars: "\e[6~" } - - { key: Tab, mods: Shift, chars: "\e[Z" } - - { key: Back, chars: "" } - - { key: Back, mods: Alt, chars: "\e" } - - { key: Insert, chars: "\e[2~" } - - { key: Delete, chars: "\e[3~" } - - { key: Left, mods: Shift, chars: "\e[1;2D" } - - { key: Left, mods: Control, chars: "\e[1;5D" } - - { key: Left, mods: Alt, chars: "\e[1;3D" } - - { key: Left, chars: "\e[D", mode: ~AppCursor } - - { key: Left, chars: "\eOD", mode: AppCursor } - - { key: Right, mods: Shift, chars: "\e[1;2C" } - - { key: Right, mods: Control, chars: "\e[1;5C" } - - { key: Right, mods: Alt, chars: "\e[1;3C" } - - { key: Right, chars: "\e[C", mode: ~AppCursor } - - { key: Right, chars: "\eOC", mode: AppCursor } - - { key: Up, mods: Shift, chars: "\e[1;2A" } - - { key: Up, mods: Control, chars: "\e[1;5A" } - - { key: Up, mods: Alt, chars: "\e[1;3A" } - - { key: Up, chars: "\e[A", mode: ~AppCursor } - - { key: Up, chars: "\eOA", mode: AppCursor } - - { key: Down, mods: Shift, chars: "\e[1;2B" } - - { key: Down, mods: Control, chars: "\e[1;5B" } - - { key: Down, mods: Alt, chars: "\e[1;3B" } - - { key: Down, chars: "\e[B", mode: ~AppCursor } - - { key: Down, chars: "\eOB", mode: AppCursor } - - { key: F1, chars: "\eOP" } - - { key: F2, chars: "\eOQ" } - - { key: F3, chars: "\eOR" } - - { key: F4, chars: "\eOS" } - - { key: F5, chars: "\e[15~" } - - { key: F6, chars: "\e[17~" } - - { key: F7, chars: "\e[18~" } - - { key: F8, chars: "\e[19~" } - - { key: F9, chars: "\e[20~" } - - { key: F10, chars: "\e[21~" } - - { key: F11, chars: "\e[23~" } - - { key: F12, chars: "\e[24~" } - - { key: F1, mods: Shift, chars: "\e[1;2P" } - - { key: F2, mods: Shift, chars: "\e[1;2Q" } - - { key: F3, mods: Shift, chars: "\e[1;2R" } - - { key: F4, mods: Shift, chars: "\e[1;2S" } - - { key: F5, mods: Shift, chars: "\e[15;2~" } - - { key: F6, mods: Shift, chars: "\e[17;2~" } - - { key: F7, mods: Shift, chars: "\e[18;2~" } - - { key: F8, mods: Shift, chars: "\e[19;2~" } - - { key: F9, mods: Shift, chars: "\e[20;2~" } - - { key: F10, mods: Shift, chars: "\e[21;2~" } - - { key: F11, mods: Shift, chars: "\e[23;2~" } - - { key: F12, mods: Shift, chars: "\e[24;2~" } - - { key: F1, mods: Control, chars: "\e[1;5P" } - - { key: F2, mods: Control, chars: "\e[1;5Q" } - - { key: F3, mods: Control, chars: "\e[1;5R" } - - { key: F4, mods: Control, chars: "\e[1;5S" } - - { key: F5, mods: Control, chars: "\e[15;5~" } - - { key: F6, mods: Control, chars: "\e[17;5~" } - - { key: F7, mods: Control, chars: "\e[18;5~" } - - { key: F8, mods: Control, chars: "\e[19;5~" } - - { key: F9, mods: Control, chars: "\e[20;5~" } - - { key: F10, mods: Control, chars: "\e[21;5~" } - - { key: F11, mods: Control, chars: "\e[23;5~" } - - { key: F12, mods: Control, chars: "\e[24;5~" } - - { key: F1, mods: Alt, chars: "\e[1;6P" } - - { key: F2, mods: Alt, chars: "\e[1;6Q" } - - { key: F3, mods: Alt, chars: "\e[1;6R" } - - { key: F4, mods: Alt, chars: "\e[1;6S" } - - { key: F5, mods: Alt, chars: "\e[15;6~" } - - { key: F6, mods: Alt, chars: "\e[17;6~" } - - { key: F7, mods: Alt, chars: "\e[18;6~" } - - { key: F8, mods: Alt, chars: "\e[19;6~" } - - { key: F9, mods: Alt, chars: "\e[20;6~" } - - { key: F10, mods: Alt, chars: "\e[21;6~" } - - { key: F11, mods: Alt, chars: "\e[23;6~" } - - { key: F12, mods: Alt, chars: "\e[24;6~" } - - { key: F1, mods: Super, chars: "\e[1;3P" } - - { key: F2, mods: Super, chars: "\e[1;3Q" } - - { key: F3, mods: Super, chars: "\e[1;3R" } - - { key: F4, mods: Super, chars: "\e[1;3S" } - - { key: F5, mods: Super, chars: "\e[15;3~" } - - { key: F6, mods: Super, chars: "\e[17;3~" } - - { key: F7, mods: Super, chars: "\e[18;3~" } - - { key: F8, mods: Super, chars: "\e[19;3~" } - - { key: F9, mods: Super, chars: "\e[20;3~" } - - { key: F10, mods: Super, chars: "\e[21;3~" } - - { key: F11, mods: Super, chars: "\e[23;3~" } - - { key: F12, mods: Super, chars: "\e[24;3~" } - - { key: NumpadEnter, chars: "\n" } diff --git a/roles/tmux/tasks/main.yml b/roles/tmux/tasks/main.yml deleted file mode 100644 index 63066f9..0000000 --- a/roles/tmux/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -# ln -sf ~/Personal/dotfiles/roles/tmux/files/tmux.conf ~/.tmux.conf - -- name: Copy tmux configuration - file: - src: "{{ role_path }}/files/tmux.conf" - dest: "{{ lookup('env','HOME') }}/.tmux.conf" - state: link - force: yes - -- name: Install tmux(Linux) - become: yes - apt: - name: tmux - update_cache: yes - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - -- name: Install tmux(MacOS) - community.general.homebrew: - name: tmux - state: present - when: ansible_distribution == 'MacOSX' - -- name: Install tmux plugins - shell: | - if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm - # Install TPM plugins. - # TPM requires running tmux server, as soon as `tmux start-server` does not work - # create dump __noop session in detached mode, and kill it when plugins are installed - tmux new -d -s __noop >/dev/null 2>&1 || true - tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins" - "$HOME"/.tmux/plugins/tpm/bin/install_plugins || true - tmux kill-session -t __noop >/dev/null 2>&1 || true - fi diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml deleted file mode 100644 index 1f68bb0..0000000 --- a/roles/zsh/tasks/main.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- name: Install dependencies - become: yes - apt: - update_cache: yes - name: - - zsh - - git - -- name: Check if .oh-my-zsh exists - stat: - path: ~/.oh-my-zsh - register: stat_oh_my_zsh_result - -- name: Cloning oh-my-zsh - shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended - when: not stat_oh_my_zsh_result.stat.exists - -- name: Get zsh path - shell: which zsh - register: zsh_path - -# ln -sf ~/Personal/dotfiles/roles/zsh/files/zshrc ~/.zshrc -- name: Copy zshrc file - file: - src: "{{ role_path }}/files/zshrc" - path: "{{ lookup('env','HOME') }}/.zshrc" - state: link - force: yes - -- name: Install oh-my-zsh plugins - shell: | - git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins $ZSH_CUSTOM/plugins/autoupdate &>/dev/null - git clone https://github.com/changyuheng/zsh-interactive-cd.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/zsh-interactive-cd &>/dev/null - git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use &>/dev/null - git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions &>/dev/null - git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions &>/dev/null - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting &>/dev/null - git clone https://github.com/wfxr/forgit.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/forgit &>/dev/null - git clone https://github.com/spaceship-prompt/spaceship-prompt.git "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt" --depth=1 &>/dev/null - ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme" - - exit 0 - -- name: Clone fzf - git: - repo: https://github.com/junegunn/fzf.git - dest: "{{ lookup('env','HOME') }}/.fzf" - depth: 1 - -- name: Install fzf - shell: "{{ lookup('env','HOME') }}/.fzf/install" - -- name: Debug message - debug: - msg: "Please log out and login again to see changed shell" diff --git a/roles/tmux/files/tmux.conf b/tmux/tmux.conf similarity index 98% rename from roles/tmux/files/tmux.conf rename to tmux/tmux.conf index cca872d..3810cfd 100644 --- a/roles/tmux/files/tmux.conf +++ b/tmux/tmux.conf @@ -1,4 +1,4 @@ -source-file "$DOT_SOURCE"/roles/tmux/files/unused_mappings.conf +source-file "$DOT_SOURCE"/tmux/unused_mappings.conf set -g @plugin 'tmux-plugins/tpm' # Tmux Plugin Manager set -g @plugin 'tmux-plugins/tmux-sensible' # Sensible configurations diff --git a/roles/tmux/files/unused_mappings.conf b/tmux/unused_mappings.conf similarity index 100% rename from roles/tmux/files/unused_mappings.conf rename to tmux/unused_mappings.conf diff --git a/zsh/common_aliasrc b/zsh/common_aliasrc new file mode 100644 index 0000000..098b8f8 --- /dev/null +++ b/zsh/common_aliasrc @@ -0,0 +1,140 @@ +#!/bin/bash + +# Common aliases +alias ezsh='code $DOT_SOURCE' +alias rzsh='source ~/.zshrc' +alias rtmux='tmux source ~/.tmux.conf' +alias brewup='brew update; brew upgrade; brew cleanup; brew doctor' +alias f='fuck' + +# General purpose alias +alias tmuxls='tmux list-sessions' +alias tmuxkillall='tmux kill-server' + +print_path() { + echo "$PATH" | tr ':' '\n' +} + +tmuxattach() { + tmux attach-session -t "$1" +} + +tmuxkillsession() { + tmux kill-session -t "$1" +} + +tmuxs() { + tmuxinator start "$1" +} + +tmuxx() { + tmuxinator stop "$1" +} + +# 1Password zsh completions +if command -v op &>/dev/null; then + eval "$(op completion zsh)" +fi + +gitdelete() { + git fetch -p + git branch -r | awk '{print $1}' | grep -E -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d + git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d + git remote prune origin +} + +gitdeletesquashed() { + git checkout -q master && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read -r branch; do + mergeBase=$(git merge-base master "$branch") && + [[ $(git cherry master "$(git commit-tree "$(git rev-parse "$branch^{tree}")" -p "$mergeBase" -m _)") == "-"* ]] && + git branch -D "$branch" + done +} + +# Merges the current branch into the branch specified by the argument +gitmergeinto() { + if [ -z "$1" ]; then + echo "Usage: gitmergeinto " + return 1 + fi + branch=$(current_branch) + echo "Merging $branch into $1" + git checkout "$1" + git fetch + git reset --hard origin/"$1" + git merge "$branch" --no-edit + echo "Merged $branch into $1" +} + +# Squash commits in the current branch into the branch specified by the argument +gitsquashinto() { + if [ -z "$1" ]; then + echo "Usage: gitsquashinto " + return 1 + fi + branch=$(current_branch) + echo "Squashing $branch into $1" + git checkout "$1" + git fetch + git reset --hard origin/"$1" + git merge --squash "$branch" + git commit -m "Merged(squash) $branch into $1" + echo "Squashed $branch into $1" +} + +alias docker='nocorrect docker' +alias dockerkillall='docker stop $(docker ps -a -q)' + +# Open bash in a docker container +dbash() { + docker exec -it "$1" bash +} + +# Copy pwd to system clipboard by ctrl-y +function copypwd { + pwd | pbcopy +} +zle -N copypwd +bindkey '^y' copypwd +bindkey -s '^[R' "rzsh\n" + +function pet_save_previous_command() { + PREV=$(fc -lrn | head -n 1) + sh -c "pet new $(printf %q "$PREV")" +} + +function pet-select() { + # shellcheck disable=SC2034,SC2153 + BUFFER=$(pet search --query "$LBUFFER") + # shellcheck disable=SC2034 + CURSOR=$#BUFFER + zle redisplay +} +zle -N pet-select +stty -ixon +bindkey '^s' pet-select + +# Alias for git-forgit +alias gcoo='git-forgit checkout_branch' + +unalias gcp +alias gcp='git-forgit cherry_pick' + +unalias gd +alias gd='git-forgit diff' + +unalias gss +alias gss='git-forgit stash_show' + +alias gll='git log' + +unalias ga +alias ga='git-forgit add' + +unalias gbd +alias gbd='git-forgit branch_delete' + +# Helper function to pretty print the $PATH +function _path() { + echo "$PATH" | tr ":" "\n" | nl +} diff --git a/zsh/linuxrc b/zsh/linuxrc new file mode 100644 index 0000000..231886d --- /dev/null +++ b/zsh/linuxrc @@ -0,0 +1,6 @@ +#!/bin/bash + +alias open='xdg-open' +alias wifi='nmtui' + +export PATH="$HOME/.local/bin:$PATH" diff --git a/zsh/macosrc b/zsh/macosrc new file mode 100644 index 0000000..7769735 --- /dev/null +++ b/zsh/macosrc @@ -0,0 +1,188 @@ +#!/bin/bash + +function ruby_config_arm() { + # Get installation paths of ruby dependencies + openssl="$(brew --prefix openssl@1.1)" + readline="$(brew --prefix readline)" + libyaml="$(brew --prefix libyaml)" + llvm="$(brew --prefix llvm)" + + export PATH="$openssl/bin:$llvm/bin:$PATH" + + ldflags="-L$(xcrun -show-sdk-path)/usr/lib -L$openssl/lib -L$llvm/lib" + export LDFLAGS=$ldflags + + cppflags="-I$(xcrun -show-sdk-path)/usr/include -I$openssl/include -I$llvm/include -I$llvm/include/c++/v1" + export CPPFLAGS=$cppflags + + export PKG_CONFIG_PATH="$openssl/lib/pkgconfig" + + RUBY_CONFIGURE_OPTS="--with-openssl-dir=$openssl --with-opt-dir=$readline:$libyaml" + export RUBY_CONFIGURE_OPTS +} + +# e.g. Apple M1 Max +if [[ "$(sysctl -n machdep.cpu.brand_string)" =~ M[[:digit:]] ]]; then + if [[ "$(uname -m)" == "arm64" ]]; then + eval "$(/opt/homebrew/bin/brew shellenv)" + ruby_config_arm + # Dir to store manual arm binaries + export PATH="$PATH:$HOME/.local/bin" + else + eval "$(/usr/local/homebrew/bin/brew shellenv)" + # Dir to store manual x86 binaries + export PATH="$PATH:$HOME/.local_x86/bin" + fi +else + # MacOS on Intel + export PATH="$PATH:$HOME/.local/bin" +fi + +# Mac OSX specific application alias. +alias studio='open -a /Applications/Android\ Studio.app' +alias rmine='open -a /Applications/RubyMine.app' +alias c='code .' +alias fl='open -a ForkLift .' +alias tail_yabai='tail -f $HOMEBREW_PREFIX/var/log/yabai/*.log' +alias tail_sketchybar='tail -f $HOMEBREW_PREFIX/var/log/sketchybar/*.log' + +export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" + +FORGIT_INSTALL_DIR="/Users/$(whoami)/.oh-my-zsh/custom/plugins/forgit/bin" +if [ -d "$FORGIT_INSTALL_DIR" ]; then + export PATH="$PATH:$FORGIT_INSTALL_DIR" + export FORGIT_FZF_DEFAULT_OPTS + export FORGIT_INSTALL_DIR +fi + +# shellcheck disable=SC2155 +export ANDROID_SDK_ROOT="/Users/$(whoami)/Library/Android/sdk" +export THOR_MERGE="code -d $1 $2" + +alias bsl='brew services ls' +alias bsr='brew services restart' +alias bss='brew services start' +alias bsx='brew services stop' +alias tf='terraform' +alias gbc="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy" + +export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home + +# Uninstallation command for Corretto https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/macos-install.html +# cd /Library/Java/JavaVirtualMachines/ +# sudo rm -rf amazon-corretto-17.jdk + +path+=/usr/local/bin + +function portscan() { + lsof -i :"$1" +} + +function rsp() { + local spec_file + spec_file="$(echo "$1" | sed 's/^spec\///')" + RACK_SERVICE_TIMEOUT=0 bundle exec rspec ./spec/"$spec_file" +} + +alias wip='git add . && git commit -m "WIP Commit"' + +function wip_unset() { + local msg + msg="$(git log -1 --pretty=%B)" + if [ "$msg" = "WIP Commit" ]; then + git reset HEAD~1 + else + echo "No WIP commit found. Check your git log" + return 1 + fi +} + +alias b='bundle' +alias bi='bundle install' +alias ba='bundle add' +alias bu='bundle update' + +function rails() { + if [ -e "Gemfile" ]; then + bundle exec rails "$@" + else + command rails "$@" + fi +} + +function rspec() { + if [ -e "Gemfile" ]; then + bundle exec rspec "$@" + else + command rspec "$@" + fi +} + +alias migrate='rails db:migrate' +alias rollback='rails db:rollback' +alias migrate_test='bundle exec rails db:migrate RAILS_ENV=test' +alias rollback_test='bundle exec rails db:rollback RAILS_ENV=test' +function db_reset() { + set +x + STATEMENT_TIMEOUT=0 bundle exec rails db:drop + STATEMENT_TIMEOUT=0 bundle exec rails db:create + STATEMENT_TIMEOUT=0 bundle exec rails db:migrate + + STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:drop + STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:create + STATEMENT_TIMEOUT=0 RAILS_ENV="test" bundle exec rails db:migrate +} + +function securekb() { + ioreg -l -w 0 | + perl -nle 'print $1 if /"kCGSSessionSecureInputPID"=(\d+)/' | + uniq | + xargs -I{} ps -p {} -o comm= +} + +if [ -f "$(brew --prefix asdf)/libexec/asdf.sh" ]; then + # shellcheck source=/dev/null + source "$(brew --prefix asdf)/libexec/asdf.sh" + export ASDF_GOLANG_MOD_VERSION_ENABLED=true + + # shellcheck source=/dev/null + . ~/.asdf/plugins/golang/set-env.zsh +fi + +function suyabai() { + local sha256 + sha256=$(shasum -a 256 "$(which yabai)" | awk "{print \$1;}") + if [ -f "/private/etc/sudoers.d/yabai" ]; then + sudo sed -i '' -e 's/sha256:[[:alnum:]]*/sha256:'"${sha256}"'/' /private/etc/sudoers.d/yabai + else + echo "sudoers file does not exist yet. creating one now" + echo "$(whoami) ALL=(root) NOPASSWD: sha256:${sha256} $(which yabai) --load-sa" | sudo tee /private/etc/sudoers.d/yabai + fi +} + +function presentation-mode() { + local normal_mode_file="alacritty_mac.toml" + local presentation_mode_file="alacritty_mac_presentation_mode.toml" + local destination="$HOME/.config/alacritty/alacritty.toml" + + local normal_mode_abs_file + local presentation_mode_abs_file + normal_mode_abs_file="$DOT_SOURCE/roles/alacritty/files/$normal_mode_file" + presentation_mode_abs_file="$DOT_SOURCE/roles/alacritty/files/$presentation_mode_file" + + if [[ ! -f "$normal_mode_abs_file" || ! -f "$presentation_mode_abs_file" ]]; then + echo "alacritty files are not configured. check your dotfiles" + return 1 + fi + + local abs_path + local base_filename + abs_path=$(readlink -f "$HOME/.config/alacritty/alacritty.toml") + base_filename=$(basename "$abs_path") + + if [[ $base_filename == "$normal_mode_file" ]]; then + ln -sf "$presentation_mode_abs_file" "$destination" + else + ln -sf "$normal_mode_abs_file" "$destination" + fi +} diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..2e4522e --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,140 @@ +# To use this zshrc as your default zshrc file, create a symlink of this file +# in your home folder. Just create a symlink of the zshrc file and it will +# source the other files on it's own. The command usually looks like +# ln -s ~/Personal/dotfiles/zsh/zshrc ~/.zshrc + +# To profile zsh in case of slow startup, uncomment the line below and move the +# second command to the bottom of this file +# zmodload zsh/zprof +# zprof + +export EDITOR="nvim" +export LANG=en_US.UTF-8 + +setopt EXTENDED_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_SPACE +setopt HIST_SAVE_NO_DUPS + +# shellcheck disable=SC2034 +ZSH_THEME="spaceship" + +# shellcheck disable=SC2034 +plugins=( + autoupdate + forgit + fzf-tab + git + sudo + thefuck + you-should-use + zsh-autosuggestions + zsh-completions + zsh-syntax-highlighting +) + +# This function will set up two important environment varialbles: +# $FILE_DIR: Absolute path to the .zshrc file +# $DOT_SOURCE: Absolute path where dotfiles repo is cloned +# If the script fails to determine the path of dotfiles, it will print an error +# since a lot of functionalities will start failing (tmux, yabai, skhd, etc) +function _set_dot_source() { + local absolute_file_path + + case $(uname) in + Darwin) + # Get the absolute path of the symlinked zshrc to read the other rc files + absolute_file_path="$(readlink /Users/"$(whoami)"/.zshrc)" + FILE_DIR=${absolute_file_path%??????} + # Path to your oh-my-zsh installation. + ZSH="/Users/$(whoami)/.oh-my-zsh" + source "$FILE_DIR/macosrc" + ;; + Linux) + # Get the absolute path of the symlinked zshrc to read the other rc files + absolute_file_path="$(readlink -f /home/"$(whoami)"/.zshrc)" + FILE_DIR=${absolute_file_path%??????} + # Path to your oh-my-zsh installation. + ZSH="/home/$(whoami)/.oh-my-zsh" + source "$FILE_DIR/linuxrc" + ;; + esac + export ZSH + export FILE_DIR + + current_dir=$FILE_DIR + while [[ "$current_dir" != "/" && "$current_dir" != *"dotfiles" ]]; do + current_dir=$(dirname "$current_dir") + done + + if [[ "$current_dir" == *"dotfiles" ]]; then + export DOT_SOURCE=${current_dir} + else + local message = "FATAL ERROR: Shell was not able to determine $DOT_SOURCE. + This will break other configurations. Check your zshrc configuration and + fix any errors." + fi +} + +_set_dot_source +unfunction _set_dot_source + +autoload -Uz compinit +# zsh-specific code, disable all errors +# shellcheck disable=SC1072,SC1073,SC1036,SC1058 +for dump in ~/.zcompdump(N.mh+24); do + compinit +done +compinit -C +zstyle ':completion:*' menu yes select +# shellcheck enable=SC1072,SC1073,SC1036,SC1058 + +eval "$(zoxide init zsh)" + +FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" + +# don't expand aliases _before_ completion has finished +setopt complete_aliases +bindkey "^Xa" _expand_alias +zstyle ':completion:*' completer _expand_alias _complete _ignored +zstyle ':completion:*' regular true + +# shellcheck disable=SC2034 +DISABLE_MAGIC_FUNCTIONS=true + +# shellcheck source=/dev/null +source "$ZSH/oh-my-zsh.sh" + +# Prevent zsh from showing the system name before each command +prompt_context() { true; } +prompt_aws() { true; } + +# shellcheck source=/dev/null +eval "$(fzf --zsh)" +# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + + +# Homebrew completions. Refer https://docs.brew.sh/Shell-Completion +if type brew &>/dev/null; then + FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH +fi + +# shellcheck source=/dev/null +source "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh" + +# Disable that pesky auto correct +unsetopt correct_all +unsetopt nomatch + +# shellcheck source=/dev/null +source "$FILE_DIR/common_aliasrc" + +# shellcheck source=/dev/null +source "$FILE_DIR/secretsrc" + +eval "$(thefuck --alias)" + +typeset -U path +export PATH From 87306eb6f68e40d23a02a7bc84d8126539ad980b Mon Sep 17 00:00:00 2001 From: anujc4 Date: Sun, 23 Feb 2025 21:48:16 +0000 Subject: [PATCH 5/5] cleanup --- Brewfile | 1 + README.md | 23 +++++++- install.conf.yaml | 2 +- macos_optimzations | 14 +++++ macos_wm/install.sh | 54 ------------------ roles/alacritty/tasks/main.yml | 48 ---------------- roles/alacritty/tasks/theme.yml | 3 - .../gruvbox_palette.png | Bin 8 files changed, 36 insertions(+), 109 deletions(-) delete mode 100755 macos_wm/install.sh delete mode 100644 roles/alacritty/tasks/main.yml delete mode 100644 roles/alacritty/tasks/theme.yml rename gruvbox_palette.png => wallpapers/gruvbox_palette.png (100%) diff --git a/Brewfile b/Brewfile index 41c413d..dacd990 100644 --- a/Brewfile +++ b/Brewfile @@ -1,5 +1,6 @@ brew "asdf" brew "yt-dlp" +brew "jq" cask "1password-cli" cask "1password" diff --git a/README.md b/README.md index 4130c7e..34295a1 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,28 @@ Config files for various applications I use across mac and linux Has configurations for -* [Alacritty](https://github.com/jwilm/alacritty): Terminal emulator written in rust. Mac and Linux have separate configurations. -* [Tmux](https://github.com/tmux/tmux): terminal multiplexer. Probably the best thing in the world -* [Yabai](https://github.com/koekeishiya/yabai): i3 replacement for macOS +* [Alacritty](https://github.com/jwilm/alacritty): Terminal emulator +* [Tmux](https://github.com/tmux/tmux): Terminal multiplexer +* [Yabai](https://github.com/koekeishiya/yabai): i3 replacement for macOS, comes + with configurations for skhd, sketchybar and borders. * [ohmyzsh](https://ohmyz.sh/): framework for managing your Zsh configuration +## Installation + +Dotfiles are bundled using [dotbot](https://github.com/anishathalye/dotbot). + +Update dotbot sub-module if required + +```bash +git submodule update --remote dotbot +``` + +Then run the install command + +```bash +./install +``` + ## License This project is no license. Do whatever the f**k you want to do with it. diff --git a/install.conf.yaml b/install.conf.yaml index 435917a..012e27b 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -113,7 +113,7 @@ brew tap FelixKratz/formulae brew install sketchybar borders brew services start sketchybar - curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.4/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf + curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v2.0.32/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf brew install --cask sf-symbols description: Installing Yabai quiet: true diff --git a/macos_optimzations b/macos_optimzations index ab93525..e3ab668 100755 --- a/macos_optimzations +++ b/macos_optimzations @@ -74,4 +74,18 @@ defaults write com.apple.finder ShowStatusBar -bool false # allows key-repeat in VS Code defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false +# Enable Dock autohide +defaults write com.apple.dock autohide -bool true + + +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 118 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 119 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 120 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 121 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 122 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 123 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 124 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 125 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" +defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 126 "{enabled = 0; value = { parameters = (65535, 49, 1048576); type = standard; }; }" + killall Dock diff --git a/macos_wm/install.sh b/macos_wm/install.sh deleted file mode 100755 index b893642..0000000 --- a/macos_wm/install.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -if ! command -v brew &>/dev/null; then - echo "missing brew. installing it now." - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -fi - -if ! command -v yabai &>/dev/null; then - echo "missing yabai. installing it now." - brew tap koekeishiya/formulae - brew install yabai -fi - -if ! command -v skhd &>/dev/null; then - echo "missing skhd. installing it now." - brew tap koekeishiya/formulae - brew install skhd -fi - -if ! command -v sketchybar &>/dev/null; then - echo "missing sketchybar. installing it now." - brew tap FelixKratz/formulae - brew install sketchybar - brew services start sketchybar - - curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.4/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf - - brew install --cask sf-symbols -fi - -(git clone https://github.com/FelixKratz/SbarLua.git /tmp/SbarLua && cd /tmp/SbarLua/ && make install && rm -rf /tmp/SbarLua/) - -if ! command -v borders &>/dev/null; then - echo "missing borders. installing it now." - brew install borders -fi - -if ! command -v jq &>/dev/null; then - echo "missing jq. installing it now." - brew install jq -fi - -if [[ -z "${DOT_SOURCE}" ]]; then - echo "DOT_SOURCE variable is not available. Have you set up zsh?" - exit 1 -fi - -ln -sf "$DOT_SOURCE/macos_wm/common" "$HOME/.config/common_wm" -ln -sf "$DOT_SOURCE/macos_wm/sketchybar" "$HOME/.config" -ln -sf "$DOT_SOURCE/macos_wm/borders" "$HOME/.config" -ln -sf "$DOT_SOURCE/macos_wm/yabai" "$HOME/.config" -ln -sf "$DOT_SOURCE/macos_wm/skhd" "$HOME/.config" - -echo "done" diff --git a/roles/alacritty/tasks/main.yml b/roles/alacritty/tasks/main.yml deleted file mode 100644 index d12ba7f..0000000 --- a/roles/alacritty/tasks/main.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- name: Install dependencies - become: true - apt: - update_cache: yes - name: - - python-apt - - python3-apt - when: ansible_distribution == 'MacOSX' - -- name: Add repository ppa:mmstick76/alacritty - become: yes - apt_repository: - repo: ppa:mmstick76/alacritty - state: present - when: ansible_distribution == 'MacOSX' - -- name: Install alacritty - become: yes - apt: - name: alacritty - update_cache: yes - force: yes - when: ansible_distribution == 'MacOSX' - -- name: Create config directory - file: - path: "{{ lookup('env','HOME') }}/.config/alacritty" - state: directory - -- name: Copy config file(Linux) - file: - src: "{{ role_path }}/files/alacritty_linux.yml" - dest: "{{ lookup('env','HOME') }}/.config/alacritty/alacritty.yml" - state: link - force: yes - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - -# ln -sf ~/Personal/dotfiles/roles/alacritty/files/alacritty_mac.toml ~/.config/alacritty/alacritty.toml -# mkdir -p ~/.config/alacritty/themes -# git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes -- name: Copy config file(Mac) - file: - src: "{{ role_path }}/files/alacritty_mac.yml" - dest: "{{ lookup('env','HOME') }}/.config/alacritty/alacritty.yml" - state: link - force: yes - when: ansible_distribution == 'MacOSX' diff --git a/roles/alacritty/tasks/theme.yml b/roles/alacritty/tasks/theme.yml deleted file mode 100644 index f5a1a62..0000000 --- a/roles/alacritty/tasks/theme.yml +++ /dev/null @@ -1,3 +0,0 @@ -# Ensure npm/node is installed -# sudo npm i -g alacritty-themes -# https://github.com/rajasegar/alacritty-themes \ No newline at end of file diff --git a/gruvbox_palette.png b/wallpapers/gruvbox_palette.png similarity index 100% rename from gruvbox_palette.png rename to wallpapers/gruvbox_palette.png