diff --git a/.gitignore b/.gitignore index 2906f4d..e5d378a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -git/gitconfig.symlink -secrets +group_vars/all.yaml diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..1da4684 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +inventory = inventory.ini diff --git a/brew.sh b/brew.sh deleted file mode 100644 index 39593fe..0000000 --- a/brew.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -packages=( - fish - git - wget -) - -apps=( - 1password - google-chrome - slack - visual-studio-code -) - -# Install homebrew -if ! [ -x "$(command -v brew)" ]; then - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -fi; - -# Install Packages -for p in "${packages[@]}" -do - if ! brew list -1 | grep -q "^${p}\$"; then - brew install $p; - fi -done - -# Install Applications -for a in "${apps[@]}" -do - if ! brew cask list -1 | grep -q "^${a}\$"; then - brew cask install $a; - fi -done - -# Setup fish shell -if ! grep -q 'fish' /etc/shells; then - echo /usr/local/bin/fish >>/etc/shells; #add to list of shells -fi; -if ! grep 'fish' $SHELL; then - chsh -s /usr/local/bin/fish; #fish default -fi; - -# Cleanup -brew cleanup diff --git a/.vimrc b/files/.vimrc similarity index 100% rename from .vimrc rename to files/.vimrc diff --git a/fish/config.fish b/files/fish/config.fish similarity index 100% rename from fish/config.fish rename to files/fish/config.fish diff --git a/fish/functions/__bass.py b/files/fish/functions/__bass.py similarity index 100% rename from fish/functions/__bass.py rename to files/fish/functions/__bass.py diff --git a/fish/functions/bass.fish b/files/fish/functions/bass.fish similarity index 100% rename from fish/functions/bass.fish rename to files/fish/functions/bass.fish diff --git a/fish/functions/dotfiles.fish b/files/fish/functions/dotfiles.fish similarity index 100% rename from fish/functions/dotfiles.fish rename to files/fish/functions/dotfiles.fish diff --git a/fish/functions/fish_prompt.fish b/files/fish/functions/fish_prompt.fish similarity index 100% rename from fish/functions/fish_prompt.fish rename to files/fish/functions/fish_prompt.fish diff --git a/fish/functions/int.fish b/files/fish/functions/int.fish similarity index 100% rename from fish/functions/int.fish rename to files/fish/functions/int.fish diff --git a/fish/functions/nvm.fish b/files/fish/functions/nvm.fish similarity index 100% rename from fish/functions/nvm.fish rename to files/fish/functions/nvm.fish diff --git a/fish/functions/wttr.fish b/files/fish/functions/wttr.fish similarity index 100% rename from fish/functions/wttr.fish rename to files/fish/functions/wttr.fish diff --git a/git/.gitconfig b/files/git/.gitconfig similarity index 100% rename from git/.gitconfig rename to files/git/.gitconfig diff --git a/git/.gitignore b/files/git/.gitignore similarity index 100% rename from git/.gitignore rename to files/git/.gitignore diff --git a/vscode/keybindings.json b/files/vscode/keybindings.json similarity index 100% rename from vscode/keybindings.json rename to files/vscode/keybindings.json diff --git a/vscode/settings.json b/files/vscode/settings.json similarity index 100% rename from vscode/settings.json rename to files/vscode/settings.json diff --git a/group_vars/all.yaml.dist b/group_vars/all.yaml.dist new file mode 100644 index 0000000..1530f55 --- /dev/null +++ b/group_vars/all.yaml.dist @@ -0,0 +1,3 @@ +--- +git_name: foo +git_email: foo@example.com diff --git a/install b/install deleted file mode 100755 index d2b0b26..0000000 --- a/install +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -DOTFILES=$(pwd) - -# Remove last login from prompt -touch ~/.hushlogin - -# Set OSX Defaults -source osx.sh - -# Install Homebrew Packages -source brew.sh - -# Configure git config & ignore -git config --global include.path $DOTFILES/git/.gitconfig -git config --global core.excludesfile $DOTFILES/git/.gitignore - -# Run secrets -./secrets - -# Setup Symlinks -ln -svf $DOTFILES/.vimrc ~ -ln -svf $DOTFILES/.gemrc ~ - -mkdir -pv ~/.config/fish -ln -svf $DOTFILES/fish/config.fish $DOTFILES/fish/functions ~/.config/fish - -# Install Vim Theme -git clone git@github.com:gosukiwi/vim-atom-dark.git ~/.vim - -# setup VS Code -source vscode.sh diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..c1a345d --- /dev/null +++ b/inventory.ini @@ -0,0 +1 @@ +localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3 diff --git a/nvm.sh b/nvm.sh deleted file mode 100644 index 6123f72..0000000 --- a/nvm.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Install the latest lts -nvm install --lts --latest-npm - -# Always default to the latest available node -nvm alias default node diff --git a/osx.sh b/osx.sh deleted file mode 100644 index 9f48936..0000000 --- a/osx.sh +++ /dev/null @@ -1,295 +0,0 @@ -#!/usr/bin/env bash - -# Close any open System Preferences panes, to prevent them from overriding -# settings we’re about to change -osascript -e 'tell application "System Preferences" to quit' - -# Ask for the administrator password upfront -sudo -v - -# Keep-alive: update existing `sudo` time stamp until `.macos` has finished -while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & - - - -############################################################################### -# General UI/UX # -############################################################################### - -# Set sidebar icon size to medium -defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 - -# Expand save panel by default -defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true - -# Expand print panel by default -defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true - -# Disable Resume system-wide -defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false - -# Disable automatic capitalization as it’s annoying when typing code -defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false - -# Disable smart dashes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false - -# Disable automatic period substitution as it’s annoying when typing code -defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false - -# Disable smart quotes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false - -# Disable auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false - -############################################################################### -# Trackpad, mouse, keyboard, Bluetooth accessories, and input # -############################################################################### - -# Trackpad: enable tap to click for this user and for the login screen -defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true -defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 -defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 - -# Trackpad: map bottom right corner to right-click -defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 0 -defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true - -# Enable full keyboard access for all controls -# (e.g. enable Tab in modal dialogs) -defaults write NSGlobalDomain AppleKeyboardUIMode -int 2 - -# Set a blazingly fast keyboard repeat rate -defaults write NSGlobalDomain KeyRepeat -int 2 -defaults write NSGlobalDomain InitialKeyRepeat -int 15 - -# Set language and text formats -# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with -# `Inches`, `en_GB` with `en_US`, and `true` with `false`. -defaults write NSGlobalDomain AppleLanguages -array "en" -defaults write NSGlobalDomain AppleLocale -string "en_GB" -defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" -defaults write NSGlobalDomain AppleMetricUnits -bool true - -# Set the timezone; see `sudo systemsetup -listtimezones` for other values -sudo systemsetup -settimezone "Europe/London" > /dev/null - -############################################################################### -# Screen # -############################################################################### - -# Save screenshots to the desktop -defaults write com.apple.screencapture location -string "${HOME}/Desktop" - -# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) -defaults write com.apple.screencapture type -string "png" - -# Disable shadow in screenshots -defaults write com.apple.screencapture disable-shadow -bool true - -############################################################################### -# Finder # -############################################################################### - -# Finder: show all filename extensions -defaults write NSGlobalDomain AppleShowAllExtensions -bool true - -# Finder: hide status bar -defaults write com.apple.finder ShowStatusBar -bool false - -# Finder: hide path bar -defaults write com.apple.finder ShowPathbar -bool false - -# Keep folders on top when sorting by name -defaults write com.apple.finder _FXSortFoldersFirst -bool true - -# When performing a search, search the current folder by default -defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" - -# Disable the warning when changing a file extension -defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false - -# Avoid creating .DS_Store files on network or USB volumes -defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true -defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true - -# Use list view in all Finder windows by default -# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv` -defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" - -# Show the ~/Library folder -chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library - -# Show the /Volumes folder -sudo chflags nohidden /Volumes - -# Expand the following File Info panes: -# “General”, “Open with”, and “Sharing & Permissions” -# defaults write com.apple.finder FXInfoPanesExpanded -dict \ -# General -bool true \ -# OpenWith -bool true \ -# Privileges -bool true - -############################################################################### -# Dock, Dashboard, and hot corners # -############################################################################### - -# Enable highlight hover effect for the grid view of a stack (Dock) -defaults write com.apple.dock mouse-over-hilite-stack -bool true - -# Set the icon size of Dock items to 36 pixels -defaults write com.apple.dock tilesize -int 36 - -# Set to left -defaults write com.apple.dock orientation -string "left" - -# Change minimize/maximize window effect -defaults write com.apple.dock mineffect -string "scale" - -# Minimize windows into their application’s icon -defaults write com.apple.dock minimize-to-application -bool false - -# Enable spring loading for all Dock items -defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true - -# Show indicator lights for open applications in the Dock -defaults write com.apple.dock show-process-indicators -bool true - -# Wipe all (default) app icons from the Dock -# This is only really useful when setting up a new Mac, or if you don’t use -# the Dock to launch apps. -defaults write com.apple.dock persistent-apps -array - -# Show only open applications in the Dock -defaults write com.apple.dock static-only -bool true - -# Don’t animate opening applications from the Dock -defaults write com.apple.dock launchanim -bool false - -# Group windows by application in Mission Control -# (i.e. use the old Exposé behavior instead) -defaults write com.apple.dock expose-group-by-app -bool true - -# Disable Dashboard -defaults write com.apple.dashboard mcx-disabled -bool true - -# Don’t show Dashboard as a Space -defaults write com.apple.dock dashboard-in-overlay -bool true - -# Don’t automatically rearrange Spaces based on most recent use -defaults write com.apple.dock mru-spaces -bool false - -# Remove the auto-hiding Dock delay -defaults write com.apple.dock autohide-delay -float 0 - -# Automatically hide and show the Dock -defaults write com.apple.dock autohide -bool true - -# Make Dock icons of hidden applications translucent -defaults write com.apple.dock showhidden -bool true - -# Don’t show recent applications in Dock -defaults write com.apple.dock show-recents -bool false - -# Disable the Launchpad gesture (pinch with thumb and three fingers) -defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 - -############################################################################### -# Safari & WebKit # -############################################################################### - -# Privacy: don’t send search queries to Apple -defaults write com.apple.Safari UniversalSearchEnabled -bool false -defaults write com.apple.Safari SuppressSearchSuggestions -bool true - -# Press Tab to highlight each item on a web page -defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true - -# Show the full URL in the address bar (note: this still hides the scheme) -defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true - -# Set Safari’s home page to `about:blank` for faster loading -defaults write com.apple.Safari HomePage -string "about:blank" - -# Prevent Safari from opening ‘safe’ files automatically after downloading -defaults write com.apple.Safari AutoOpenSafeDownloads -bool false - -# Allow hitting the Backspace key to go to the previous page in history -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true - -# Hide Safari’s bookmarks bar by default -defaults write com.apple.Safari ShowFavoritesBar -bool false - -# Hide Safari’s sidebar in Top Sites -defaults write com.apple.Safari ShowSidebarInTopSites -bool false - -# Disable Safari’s thumbnail cache for History and Top Sites -defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 - -# Enable Safari’s debug menu -defaults write com.apple.Safari IncludeInternalDebugMenu -bool true - -# Make Safari’s search banners default to Contains instead of Starts With -defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false - -# Remove useless icons from Safari’s bookmarks bar -defaults write com.apple.Safari ProxiesInBookmarksBar "()" - -# Enable the Develop menu and the Web Inspector in Safari -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 - -# Add a context menu item for showing the Web Inspector in web views -defaults write NSGlobalDomain WebKitDeveloperExtras -bool true - -# Enable continuous spellchecking -defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true -# Disable auto-correct -defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false - -# Warn about fraudulent websites -defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true - -# Disable Java -defaults write com.apple.Safari WebKitJavaEnabled -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false - -# Block pop-up windows -defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false - -# Enable “Do Not Track” -defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true - -# Update extensions automatically -defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true - -############################################################################### -# Kill affected applications # -############################################################################### - -for app in "Activity Monitor" \ - "Address Book" \ - "Calendar" \ - "cfprefsd" \ - "Contacts" \ - "Dock" \ - "Finder" \ - "Google Chrome Canary" \ - "Google Chrome" \ - "Mail" \ - "Messages" \ - "Opera" \ - "Photos" \ - "Safari" \ - "Spectacle" \ - "SystemUIServer" \ - "Terminal" \ - "iCal"; do - killall "${app}" &> /dev/null -done -echo "Done. Note that some of these changes require a logout/restart to take effect." diff --git a/playbook.yaml b/playbook.yaml new file mode 100644 index 0000000..6e9f30b --- /dev/null +++ b/playbook.yaml @@ -0,0 +1,100 @@ +- hosts: localhost + roles: + # - osx + tasks: + - name: Ensure hushlogin file exists + ansible.builtin.file: + path: "~/.hushlogin" + modification_time: preserve + access_time: preserve + state: touch + + - name: Install vim theme + ansible.builtin.git: + repo: "git@github.com:gosukiwi/vim-atom-dark.git" + dest: "{{ ansible_env.HOME }}/.vim" + depth: 1 + single_branch: true + + - name: Install Homebrew + ansible.builtin.shell: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' + args: + creates: "/opt/homebrew/bin/brew" + + - name: Install packages + ansible.builtin.shell: "/opt/homebrew/bin/brew install {{ item }}" + args: + creates: "/opt/homebrew/bin/{{ item }}" + loop: + - fish + - git + - wget + + - name: Install apps + ansible.builtin.shell: "/opt/homebrew/bin/brew install {{ item.brew }}" + args: + creates: "/Applications/{{ item.app }}" + loop: + - { brew: "1password", app: "1Password.app" } + - { brew: "visual-studio-code", app: "Visual Studio Code.app" } + + - name: Ensure /usr/bin/fish is in /etc/shells + # become: yes + ansible.builtin.lineinfile: + path: /etc/shells + line: /opt/homebrew/bin/fish + state: present + create: yes + + - name: Ensure the shell is set to fish + # become: yes + ansible.builtin.user: + name: "{{ ansible_user_id }}" + shell: /opt/homebrew/bin/fish + + - name: Install git config + ansible.builtin.template: + src: ./templates/.gitconfig.j2 + dest: "{{ ansible_env.HOME }}/.gitconfig" + + - name: Install VS Code extensions + ansible.builtin.command: "code --install-extension {{ item }}" + args: + creates: "{{ ansible_env.HOME }}/.vscode/extensions/{{ item }}-*" + loop: + - angular.ng-template # angular + - antfu.theme-vitesse # main theme + - bierner.speech # speech to text + - davidanson.vscode-markdownlint # markdown linting + - dbaeumer.vscode-eslint # eslint + - deque-systems.vscode-axe-linter # axe linting + - editorconfig.editorconfig # editor config + - esbenp.prettier-vscode # prettier + - evondev.indent-rainbow-palettes # 🌈 + - github.vscode-pull-request-github # github prs + - gruntfuggly.todo-tree # todo + - markis.code-coverage # coverage + - oderwat.indent-rainbow # 🌈 + - streetsidesoftware.code-spell-checker # spell checking + - tinkertrain.theme-panda # panda theme + - tonybaloney.vscode-pets # 🐶 Thanks Amy! + - vscodevim.vim # VIM + - yzhang.markdown-all-in-one # markdown + + - name: Create symbolic links + ansible.builtin.file: + src: "{{ playbook_dir }}/files/{{ item.src }}" + dest: "{{ ansible_env.HOME }}/{{ item.dest }}" + state: link + loop: + - { src: ".vimrc", dest: ".vimrc" } + - { src: "fish/config.fish", dest: ".config/fish/config.fish" } + - { src: "fish/functions", dest: ".config/fish/functions" } + - { + src: "vscode/settings.json", + dest: "Library/Application\ Support/Code/User/settings.json", + } + - { + src: "vscode/keybindings.json", + dest: "Library/Application\ Support/Code/User/keybindings.json", + } diff --git a/roles/osx/tasks/dock.yaml b/roles/osx/tasks/dock.yaml new file mode 100644 index 0000000..7d63e41 --- /dev/null +++ b/roles/osx/tasks/dock.yaml @@ -0,0 +1,151 @@ +- name: Enable highlight hover effect for the grid view of a stack (Dock) + community.general.osx_defaults: + domain: com.apple.dock + key: mouse-over-hilite-stack + type: bool + value: true + state: present + +- name: Set the icon size of Dock items to 36 pixels + community.general.osx_defaults: + domain: com.apple.dock + key: tilesize + type: int + value: 36 + state: present + +- name: Set to left + community.general.osx_defaults: + domain: com.apple.dock + key: orientation + type: string + value: "left" + state: present + +- name: Change minimize/maximize window effect + community.general.osx_defaults: + domain: com.apple.dock + key: mineffect + type: string + value: "scale" + state: present + +- name: Minimize windows into their application’s icon + community.general.osx_defaults: + domain: com.apple.dock + key: minimize-to-application + type: bool + value: false + state: present + +- name: Enable spring loading for all Dock items + community.general.osx_defaults: + domain: com.apple.dock + key: enable-spring-load-actions-on-all-items + type: bool + value: true + state: present + +- name: Show indicator lights for open applications in the Dock + community.general.osx_defaults: + domain: com.apple.dock + key: show-process-indicators + type: bool + value: true + state: present + +- name: Wipe all (default) app icons from the Dock + community.general.osx_defaults: + domain: com.apple.dock + key: persistent-apps + type: array + value: [] + state: present + +- name: Show only open applications in the Dock + community.general.osx_defaults: + domain: com.apple.dock + key: static-only + type: bool + value: true + state: present + +- name: Don’t animate opening applications from the Dock + community.general.osx_defaults: + domain: com.apple.dock + key: launchanim + type: bool + value: false + state: present + +- name: Group windows by application in Mission Control + community.general.osx_defaults: + domain: com.apple.dock + key: expose-group-by-app + type: bool + value: true + state: present + +- name: Disable Dashboard + community.general.osx_defaults: + domain: com.apple.dashboard + key: mcx-disabled + type: bool + value: true + state: present + +- name: Don’t show Dashboard as a Space + community.general.osx_defaults: + domain: com.apple.dock + key: dashboard-in-overlay + type: bool + value: true + state: present + +- name: Don’t automatically rearrange Spaces based on most recent use + community.general.osx_defaults: + domain: com.apple.dock + key: mru-spaces + type: bool + value: false + state: present + +- name: Remove the auto-hiding Dock delay + community.general.osx_defaults: + domain: com.apple.dock + key: autohide-delay + type: float + value: 0 + state: present + +- name: Automatically hide and show the Dock + community.general.osx_defaults: + domain: com.apple.dock + key: autohide + type: bool + value: true + state: present + +- name: Make Dock icons of hidden applications translucent + community.general.osx_defaults: + domain: com.apple.dock + key: showhidden + type: bool + value: true + state: present + +- name: Don’t show recent applications in Dock + community.general.osx_defaults: + domain: com.apple.dock + key: show-recents + type: bool + value: false + state: present + +- name: Disable the Launchpad gesture + community.general.osx_defaults: + domain: com.apple.dock + key: showLaunchpadGestureEnabled + type: int + value: 0 + state: present diff --git a/roles/osx/tasks/finder.yaml b/roles/osx/tasks/finder.yaml new file mode 100644 index 0000000..3e285f7 --- /dev/null +++ b/roles/osx/tasks/finder.yaml @@ -0,0 +1,77 @@ +- name: Finder - show all filename extensions + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleShowAllExtensions + type: bool + value: true + state: present + +- name: Finder - hide status bar + community.general.osx_defaults: + domain: com.apple.finder + key: ShowStatusBar + type: bool + value: false + state: present + +- name: Finder - hide path bar + community.general.osx_defaults: + domain: com.apple.finder + key: ShowPathbar + type: bool + value: false + state: present + +- name: Keep folders on top when sorting by name + community.general.osx_defaults: + domain: com.apple.finder + key: _FXSortFoldersFirst + type: bool + value: true + state: present + +- name: When performing a search, search the current folder by default + community.general.osx_defaults: + domain: com.apple.finder + key: FXDefaultSearchScope + type: string + value: "SCcf" + state: present + +- name: Disable the warning when changing a file extension + community.general.osx_defaults: + domain: com.apple.finder + key: FXEnableExtensionChangeWarning + type: bool + value: false + state: present + +- name: Avoid creating .DS_Store files on network volumes + community.general.osx_defaults: + domain: com.apple.desktopservices + key: DSDontWriteNetworkStores + type: bool + value: true + state: present + +- name: Avoid creating .DS_Store files on USB volumes + community.general.osx_defaults: + domain: com.apple.desktopservices + key: DSDontWriteUSBStores + type: bool + value: true + state: present + +- name: Use list view in all Finder windows by default + community.general.osx_defaults: + domain: com.apple.finder + key: FXPreferredViewStyle + type: string + value: "Nlsv" + state: present + +- name: Show the ~/Library folder + ansible.builtin.shell: chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library + +- name: Show the /Volumes folder + ansible.builtin.shell: sudo chflags nohidden /Volumes diff --git a/roles/osx/tasks/input.yaml b/roles/osx/tasks/input.yaml new file mode 100644 index 0000000..430fa3f --- /dev/null +++ b/roles/osx/tasks/input.yaml @@ -0,0 +1,102 @@ +- name: Trackpad - enable tap to click for this user + community.general.osx_defaults: + domain: com.apple.driver.AppleBluetoothMultitouch.trackpad + key: Clicking + type: bool + value: true + state: present + +- name: Trackpad - enable tap to click for login screen + community.general.osx_defaults: + domain: NSGlobalDomain + key: com.apple.mouse.tapBehavior + type: int + value: 1 + state: present + +- name: Trackpad - map bottom right corner to right-click (corner) + community.general.osx_defaults: + domain: com.apple.driver.AppleBluetoothMultitouch.trackpad + key: TrackpadCornerSecondaryClick + type: int + value: 0 + state: present + +- name: Trackpad - map bottom right corner to right-click (click) + community.general.osx_defaults: + domain: com.apple.driver.AppleBluetoothMultitouch.trackpad + key: TrackpadRightClick + type: bool + value: true + state: present + +- name: Enable full keyboard access for all controls + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleKeyboardUIMode + type: int + value: 2 + state: present + +- name: Set a blazingly fast keyboard repeat rate (KeyRepeat) + community.general.osx_defaults: + domain: NSGlobalDomain + key: KeyRepeat + type: int + value: 2 + state: present + +- name: Set a blazingly fast keyboard repeat rate (InitialKeyRepeat) + community.general.osx_defaults: + domain: NSGlobalDomain + key: InitialKeyRepeat + type: int + value: 15 + state: present + +- name: Set language and text formats (Languages) + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleLanguages + type: array + value: + - "en" + state: present + +- name: Set language and text formats (Locale) + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleLocale + type: string + value: "en_GB" + state: present + +- name: Set language and text formats (MeasurementUnits) + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleMeasurementUnits + type: string + value: "Centimeters" + state: present + +- name: Set language and text formats (MetricUnits) + community.general.osx_defaults: + domain: NSGlobalDomain + key: AppleMetricUnits + type: bool + value: true + state: present + +- name: Get current system timezone + ansible.builtin.command: sudo systemsetup -gettimezone + become: yes + register: current_timezone_output + +- name: Debug timezone output (optional, for verification) + ansible.builtin.debug: + msg: "Current timezone is: {{ current_timezone_output.stdout }}" + +- name: Set the timezone + ansible.builtin.command: systemsetup -settimezone "Europe/London" + become: yes + when: "'Europe/London' not in current_timezone_output.stdout" diff --git a/roles/osx/tasks/main.yaml b/roles/osx/tasks/main.yaml new file mode 100644 index 0000000..9fcd02d --- /dev/null +++ b/roles/osx/tasks/main.yaml @@ -0,0 +1,77 @@ +- name: Set sidebar icon size to medium + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSTableViewDefaultSizeMode + type: int + value: 2 + state: present + +- name: Expand save panel by default + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSNavPanelExpandedStateForSaveMode + type: bool + value: true + state: present + +- name: Expand print panel by default + community.general.osx_defaults: + domain: NSGlobalDomain + key: PMPrintingExpandedStateForPrint + type: bool + value: true + state: present + +- name: Disable Resume system-wide + community.general.osx_defaults: + domain: com.apple.systempreferences + key: NSQuitAlwaysKeepsWindows + type: bool + value: false + state: present + +- name: Disable automatic capitalization as it’s annoying when typing code + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSAutomaticCapitalizationEnabled + type: bool + value: false + state: present + +- name: Disable smart dashes as they’re annoying when typing code + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSAutomaticDashSubstitutionEnabled + type: bool + value: false + state: present + +- name: Disable automatic period substitution as it’s annoying when typing code + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSAutomaticPeriodSubstitutionEnabled + type: bool + value: false + state: present + +- name: Disable smart quotes as they’re annoying when typing code + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSAutomaticQuoteSubstitutionEnabled + type: bool + value: false + state: present + +- name: Disable auto-correct + community.general.osx_defaults: + domain: NSGlobalDomain + key: NSAutomaticSpellingCorrectionEnabled + type: bool + value: false + state: present + +- import_tasks: input.yaml +- import_tasks: screen.yaml +- import_tasks: finder.yaml +- import_tasks: dock.yaml +- import_tasks: safari.yaml diff --git a/roles/osx/tasks/safari.yaml b/roles/osx/tasks/safari.yaml new file mode 100644 index 0000000..dc1b4e2 --- /dev/null +++ b/roles/osx/tasks/safari.yaml @@ -0,0 +1,215 @@ +- name: Privacy - don’t send search queries to Apple (UniversalSearch) + community.general.osx_defaults: + domain: com.apple.Safari + key: UniversalSearchEnabled + type: bool + value: false + state: present + +- name: Privacy - don’t send search queries to Apple (SuppressSearch) + community.general.osx_defaults: + domain: com.apple.Safari + key: SuppressSearchSuggestions + type: bool + value: true + state: present + +- name: Press Tab to highlight each item on a web page (WebKitTabToLinks) + community.general.osx_defaults: + domain: com.apple.Safari + key: WebKitTabToLinksPreferenceKey + type: bool + value: true + state: present + +- name: Press Tab to highlight each item on a web page (ContentPageGroupIdentifier) + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks + type: bool + value: true + state: present + +- name: Show the full URL in the address bar + community.general.osx_defaults: + domain: com.apple.Safari + key: ShowFullURLInSmartSearchField + type: bool + value: true + state: present + +- name: Set Safari’s home page to 'about:blank' + community.general.osx_defaults: + domain: com.apple.Safari + key: HomePage + type: string + value: "about:blank" + state: present + +- name: Prevent Safari from opening 'safe' files automatically + community.general.osx_defaults: + domain: com.apple.Safari + key: AutoOpenSafeDownloads + type: bool + value: false + state: present + +- name: Allow hitting the Backspace key to go to the previous page + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled + type: bool + value: true + state: present + +- name: Hide Safari’s bookmarks bar by default + community.general.osx_defaults: + domain: com.apple.Safari + key: ShowFavoritesBar + type: bool + value: false + state: present + +- name: Hide Safari’s sidebar in Top Sites + community.general.osx_defaults: + domain: com.apple.Safari + key: ShowSidebarInTopSites + type: bool + value: false + state: present + +- name: Disable Safari’s thumbnail cache + community.general.osx_defaults: + domain: com.apple.Safari + key: DebugSnapshotsUpdatePolicy + type: int + value: 2 + state: present + +- name: Enable Safari’s debug menu + community.general.osx_defaults: + domain: com.apple.Safari + key: IncludeInternalDebugMenu + type: bool + value: true + state: present + +- name: Make Safari’s search banners default to Contains + community.general.osx_defaults: + domain: com.apple.Safari + key: FindOnPageMatchesWordStartsOnly + type: bool + value: false + state: present + +- name: Enable the Develop menu and the Web Inspector in Safari (Develop) + community.general.osx_defaults: + domain: com.apple.Safari + key: IncludeDevelopMenu + type: bool + value: true + state: present + +- name: Enable the Develop menu and the Web Inspector in Safari (WebKitDeveloperExtras) + community.general.osx_defaults: + domain: com.apple.Safari + key: WebKitDeveloperExtrasEnabledPreferenceKey + type: bool + value: true + state: present + +- name: Enable the Develop menu and the Web Inspector in Safari (WebKit2DeveloperExtras) + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled + type: bool + value: true + state: present + +- name: Add a context menu item for showing the Web Inspector + community.general.osx_defaults: + domain: NSGlobalDomain + key: WebKitDeveloperExtras + type: bool + value: true + state: present + +- name: Enable continuous spellchecking + community.general.osx_defaults: + domain: com.apple.Safari + key: WebContinuousSpellCheckingEnabled + type: bool + value: true + state: present + +- name: Disable auto-correct + community.general.osx_defaults: + domain: com.apple.Safari + key: WebAutomaticSpellingCorrectionEnabled + type: bool + value: false + state: present + +- name: Warn about fraudulent websites + community.general.osx_defaults: + domain: com.apple.Safari + key: WarnAboutFraudulentWebsites + type: bool + value: true + state: present + +- name: Disable Java (WebKitJavaEnabled) + community.general.osx_defaults: + domain: com.apple.Safari + key: WebKitJavaEnabled + type: bool + value: false + state: present + +- name: Disable Java (WebKit2JavaEnabled) + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled + type: bool + value: false + state: present + +- name: Disable Java (WebKit2JavaEnabledForLocalFiles) + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles + type: bool + value: false + state: present + +- name: Block pop-up windows (WebKitJavaScriptCanOpenWindowsAutomatically) + community.general.osx_defaults: + domain: com.apple.Safari + key: WebKitJavaScriptCanOpenWindowsAutomatically + type: bool + value: false + state: present + +- name: Block pop-up windows (WebKit2JavaScriptCanOpenWindowsAutomatically) + community.general.osx_defaults: + domain: com.apple.Safari + key: com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically + type: bool + value: false + state: present + +- name: Enable “Do Not Track” + community.general.osx_defaults: + domain: com.apple.Safari + key: SendDoNotTrackHTTPHeader + type: bool + value: true + state: present + +- name: Update extensions automatically + community.general.osx_defaults: + domain: com.apple.Safari + key: InstallExtensionUpdatesAutomatically + type: bool + value: true + state: present diff --git a/roles/osx/tasks/screen.yaml b/roles/osx/tasks/screen.yaml new file mode 100644 index 0000000..f682206 --- /dev/null +++ b/roles/osx/tasks/screen.yaml @@ -0,0 +1,23 @@ +- name: Save screenshots to the desktop + community.general.osx_defaults: + domain: com.apple.screencapture + key: location + type: string + value: "{{ ansible_user_dir }}/Desktop" + state: present + +- name: Save screenshots in PNG format + community.general.osx_defaults: + domain: com.apple.screencapture + key: type + type: string + value: "png" + state: present + +- name: Disable shadow in screenshots + community.general.osx_defaults: + domain: com.apple.screencapture + key: disable-shadow + type: bool + value: true + state: present diff --git a/secrets.dist b/secrets.dist deleted file mode 100755 index a55c9aa..0000000 --- a/secrets.dist +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env fish - -# git config --global user.name "" -# git config --global user.email "" diff --git a/templates/.gitconfig.j2 b/templates/.gitconfig.j2 new file mode 100644 index 0000000..7382dcd --- /dev/null +++ b/templates/.gitconfig.j2 @@ -0,0 +1,11 @@ +[include] + path = {{ ansible_env.HOME}}/.dotfiles/git/.gitconfig +[core] + excludesfile = {{ ansible_env.HOME}}/.dotfiles/git/.gitignore +[safe] + directory = /opt/homebrew +[user] + name = {{ git_name }} + email = {{ git_email }} +[gpg "ssh"] + program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" diff --git a/update b/update deleted file mode 100755 index 1675974..0000000 --- a/update +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env fish - -# This command serves as a useful way of updating your machine -# periodically. It performs the most common package manager updates -# however it is not designed to install new packages. For that it -# is still best to run the install command - -# Upgrade all homebrew packages (doesn't upgrade casks) -brew upgrade - -# Upgrade brew casks (even if they auto update) -brew upgrade --cask --greedy - -brew cleanup - -# Finally update fish completions -fish_update_completions diff --git a/vscode.sh b/vscode.sh deleted file mode 100644 index b98a5ac..0000000 --- a/vscode.sh +++ /dev/null @@ -1,23 +0,0 @@ -code --install-extension angular.ng-template # angular -code --install-extension antfu.theme-vitesse # main theme -code --install-extension bierner.speech # speech to text -code --install-extension davidanson.vscode-markdownlint # markdown linting -code --install-extension dbaeumer.vscode-eslint # eslint -code --install-extension deque-systems.vscode-axe-linter # axe linting -code --install-extension editorconfig.editorconfig # editor config -code --install-extension esbenp.prettier-vscode # prettier -code --install-extension evondev.indent-rainbow-palettes # 🌈 -code --install-extension github.vscode-pull-request-github # github prs -code --install-extension gruntfuggly.todo-tree # todo -code --install-extension markis.code-coverage # coverage -code --install-extension oderwat.indent-rainbow # 🌈 -code --install-extension streetsidesoftware.code-spell-checker # spell checking -code --install-extension tinkertrain.theme-panda # panda theme -code --install-extension tonybaloney.vscode-pets # 🐶 Thanks Amy! -code --install-extension vscodevim.vim # VIM -code --install-extension yzhang.markdown-all-in-one # markdown -code --install-extension znck.vue # vue highlight - -# VS Code Config -ln -vsf $DOTFILES/vscode/settings.json ~/Library/Application\ Support/Code/User/ -ln -vsf $DOTFILES/vscode/keybindings.json ~/Library/Application\ Support/Code/User/