Skip to content

Commit

Permalink
Update commenting, theme, packages
Browse files Browse the repository at this point in the history
  • Loading branch information
trystendsmyth committed Nov 11, 2021
1 parent 0b41e31 commit 1b2305e
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 56 deletions.
10 changes: 10 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ tap "homebrew/cask-versions"
# GNU coreutils instead of outdated mac os defaults
brew "coreutils"
brew "moreutils"
# newer version of bash
brew "bash"
brew "bash-completion"
# newer version of zsh
brew "zsh"
brew "zsh-completions"

brew "bradp/vv/vv" || true
brew "curl" || true
brew "diff-so-fancy" || true
brew "direnv" || true
brew "dockutil" || true
brew "duti"
brew "git" || true
brew "gnupg" || true
brew "htop" || true
brew "httpie" || true
brew "irssi" || true
brew "m-cli" || true
brew "mas" || true
brew "nmap" || true
brew "openssl" || true
brew "pinentry-mac" || true
Expand All @@ -41,6 +49,7 @@ brew "z" || true
##### casks #####
cask "adium" || true
cask "alfred" || true
cask "brave-browser" || true
cask "cheatsheet" || true
cask "cyberduck" || true
cask "dash" || true
Expand All @@ -65,6 +74,7 @@ cask "ngrok" || true
cask "numi" || true
cask "plex-media-player" || true
cask "postman" || true
cask "qlvideo" || true
cask "sequel-pro" || true
cask "slack" || true
cask "spotify" || true
Expand Down
129 changes: 77 additions & 52 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DOTFILES_DIR := ${HOME}/.dotfiles
DOTFILES_DIR := $(HOME)/.dotfiles
UNAME := $(shell uname -s)
BREW_CHECK := type brew >/dev/null 2>/dev/null || $(MAKE) brew

ifeq ($(UNAME), Darwin)
OS := macos
Expand All @@ -8,7 +9,6 @@ else ifeq ($(UNAME), Linux)
endif

.PHONY: \
all \
bash \
brew \
defaults \
Expand All @@ -21,26 +21,31 @@ endif
vsc \
zsh

all: install

install: $(OS)

linux: \
# TBD

macos: \
brew \
bash \
zsh \
node \
vsc \
stow \
defaults \
~/.ssh/config

brew: \
/usr/local/bin/brew
# upgrade and clean all installed packages
install: $(OS) ## Default install all by OS.

help:
@echo 'Usage:'
@echo ' make <target>'
@echo
@echo 'Targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0m%-10s\033[0m %s\n", $$1, $$2}'

linux: ## TBD (Manually install everything for Linux.)

macos: ## Manually install everything for MacOS.
@echo 'Installing for MacOS...'
$(MAKE) brew
$(MAKE) bash
$(MAKE) zsh
$(MAKE) node
$(MAKE) vsc
$(MAKE) stow
$(MAKE) defaults
[ -d $(HOME)/.ssh/config ] || mkdir -p $(HOME)/.ssh/config
softwareupdate -d -a

brew: /usr/local/bin/brew ## Install brew and all applications.
@echo 'Updating all brew packages...'
brew update --verbose
brew upgrade --verbose
brew cleanup -s
Expand All @@ -50,38 +55,34 @@ brew: \
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
brew analytics off

bash: brew
# newer version of bash
brew install bash
brew install bash-completion

bash: ## Install an updated Bash shell.
$(BREW_CHECK)
@echo 'Updating bash...'
stow bash --restow

# change shell to homebrew bash
echo "/usr/local/bin/bash" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/bash

zsh: brew
# newer version of zsh
brew install zsh
brew install zsh-completions

zsh: ## Install an updated Zsh shell and theming.
$(BREW_CHECK)
@echo 'Updating zsh / refreshing themes...'
@rm -rf ~/.oh-my-zsh
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" </dev/null
@rm ~/.zshrc

git clone https://github.com/bhilburn/powerlevel9k.git "${HOME}/.oh-my-zsh/custom/themes/powerlevel9k"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "${HOME}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
git clone https://github.com/romkatv/powerlevel10k.git "$(HOME)/.oh-my-zsh/custom/themes/powerlevel10k"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$(HOME)/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "$(HOME)/.oh-my-zsh/custom/plugins/zsh-autosuggestions"

stow zsh --restow

# change shell to homebrew zsh
echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/zsh

node: \
~/.nvm
node: ~/.nvm ## Install NVM and Node.
@echo 'Updating NVM and Node...'
# latest stable version of node
. ~/.nvm/nvm.sh && nvm install stable

Expand All @@ -93,7 +94,9 @@ node: \
git clone https://github.com/creationix/nvm.git ~/.nvm
cd ~/.nvm && git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`

vsc: brew
vsc: ## Install all VSCode extensions.
$(BREW_CHECK)
@echo 'Install VSCode extensions'
# Equivalent of VS [gui] Command Palette "Shell command: Install 'code' command in PATH"
ln -sf /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code

Expand All @@ -118,10 +121,12 @@ vsc: brew
code --install-extension kleber-swf.unity-code-snippets
code --install-extension yclepticStudios.unity-snippets

hosts:
hosts: ## Optionally set hosts file.
@echo 'Set hosts file...'
sudo wget https://someonewhocares.org/hosts/hosts -P /etc/

stow:
stow: ## Set all home file references.
@echo 'Restowing home files...'
[ -d $(HOME)/bin ] || mkdir -p $(HOME)/bin
[ -d $(HOME)/.gnupg ] || mkdir -p $(HOME)/.gnupg
[ -d $(HOME)/.ssh ] || mkdir -p $(HOME)/.ssh
Expand All @@ -134,11 +139,12 @@ stow:
stow .ssh -t $(HOME)/.ssh --restow
stow tmux --restow

defaults: \
default-Apps \
defaults-Dock \
defaults-Finder \
defaults-NSGlobalDomain
defaults: ## Set OS defaults.
$(MAKE) default-Apps
$(MAKE) defaults-Dock
$(MAKE) defaults-Finder
$(MAKE) defaults-NSGlobalDomain

# Show remaining battery time as percentage
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
# Enable AirDrop over Ethernet and on unsupported Macs running Lion
Expand All @@ -157,7 +163,7 @@ defaults: \
defaults write com.apple.BezelServices kDimTime -int 300

# Save screenshots to the desktop
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
defaults write com.apple.screencapture location -string "$(HOME)/Desktop"
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
Expand Down Expand Up @@ -193,13 +199,15 @@ defaults: \
# Kill affected applications
@for app in Dock Safari Finder Photos SystemUIServer; do killall "$$app" >/dev/null 2>&1; done

default-Apps: brew
default-Apps:
$(BREW_CHECK)
# default IINA (media files)
@while read -r ext; do \
duti -s com.colliderli.iina "$ext" all; \
done <"${DOTFILES_DIR}/.duti/iina.txt"

defaults-Dock:
$(BREW_CHECK)
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Make Dock icons of hidden applications translucent
Expand All @@ -217,11 +225,28 @@ defaults-Dock:
# Bottom left screen corner → Start screen saver
defaults write com.apple.dock wvous-bl-corner -int 5
defaults write com.apple.dock wvous-bl-modifier -int 0
# clean up right side (persistent)
-defaults delete com.apple.dock persistent-others
# and add these folders
defaults write com.apple.dock persistent-others -array-add "$$(echo '{"tile-type": "directory-tile", "tile-data": {"displayas": 0, "file-type":2, "showas":1, "file-label":"Applications", "file-data":{"_CFURLString":"file:///Applications/","_CFURLStringType":15}}}' | plutil -convert xml1 - -o -)";
defaults write com.apple.dock persistent-others -array-add "$$(echo '{"tile-type": "directory-tile", "tile-data": {"displayas": 0, "file-type":2, "showas":1, "file-label":"Downloads", "file-data":{"_CFURLString":"file:///Users/tristan/Downloads/","_CFURLStringType":15}}}' | plutil -convert xml1 - -o -)";
# Don't show recent applications in the Dock
defaults write com.apple.dock show-recents -bool false
defaults write com.apple.dock recent-apps -array

dockutil --no-restart --remove all

dockutil --no-restart --add "/Applications/Safari.app"
dockutil --no-restart --add "/Applications/Google Chrome.app"
dockutil --no-restart --add "/Applications/Brave Browser.app"
dockutil --no-restart --add "/Applications/Firefox Developer Edition.app.app"
dockutil --no-restart --add "/Applications/Evernote.app"
dockutil --no-restart --add "/Applications/Notes.app"
dockutil --no-restart --add "/Applications/Messages.app"
dockutil --no-restart --add "/Applications/Facetime.app"
dockutil --no-restart --add "/Applications/VirtualBox.app"
dockutil --no-restart --add "/Applications/Visual Studio Code.app"
dockutil --no-restart --add "/Applications/Kitty.app"
dockutil --no-restart --add "/Applications/ExpressVPN.app"
dockutil --no-restart --add "/Applications/System Preferences.app"

dockutil --no-restart --add "/Applications" --section others --sort name --view grid
dockutil --no-restart --add "$(HOME)/Downloads" --section others --view list

defaults-Finder:
# Automatically open a new Finder window when a volume is mounted
Expand Down
9 changes: 5 additions & 4 deletions zsh/.zsh_theme
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export ZSH=~/.oh-my-zsh

POWERLEVEL9K_MODE='awesome-fontconfig'
ZSH_THEME="powerlevel9k/powerlevel9k"
ZSH_THEME="powerlevel10k/powerlevel10k"

source $ZSH/oh-my-zsh.sh

Expand Down Expand Up @@ -47,11 +47,12 @@ POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_STATUS_CROSS=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="╭"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="╰\uF460\uF460\uF460 "
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="╭─"
POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX="├─"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="╰─\uF460\uF460\uF460"

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon root_indicator context dir_writable dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time background_jobs status time ssh)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time background_jobs status nvm time ssh)

POWERLEVEL9K_VCS_CLEAN_BACKGROUND="$COLOR_GREEN"
POWERLEVEL9K_VCS_CLEAN_FOREGROUND="$DEFAULT_BACKGROUND"
Expand Down
5 changes: 5 additions & 0 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# set paths
export PATH="$PATH:$HOME/bin:/usr/local/git/bin:/usr/local/bin:/usr/local/:/usr/local/sbin"

Expand Down

0 comments on commit 1b2305e

Please sign in to comment.