From c5bb3318df841143f6a1844ae9c6464d5f10139a Mon Sep 17 00:00:00 2001 From: Antoine Meausoone <592978+Ameausoone@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:55:37 +0200 Subject: [PATCH] feat(atuin): enable atuin --- .../files/.zshrc.d/core/50_atuin.zsh | 4 ++ roles/mac_dev_playbook/files/osx/.osx | 56 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 roles/mac_dev_playbook/files/.zshrc.d/core/50_atuin.zsh create mode 100755 roles/mac_dev_playbook/files/osx/.osx diff --git a/roles/mac_dev_playbook/files/.zshrc.d/core/50_atuin.zsh b/roles/mac_dev_playbook/files/.zshrc.d/core/50_atuin.zsh new file mode 100755 index 0000000..79e59c9 --- /dev/null +++ b/roles/mac_dev_playbook/files/.zshrc.d/core/50_atuin.zsh @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +# Enable atuin +eval "$(atuin init zsh)" diff --git a/roles/mac_dev_playbook/files/osx/.osx b/roles/mac_dev_playbook/files/osx/.osx new file mode 100755 index 0000000..b473181 --- /dev/null +++ b/roles/mac_dev_playbook/files/osx/.osx @@ -0,0 +1,56 @@ +#!/usr/bin/env zsh + +# Mac OS X configuration +# +# This configuration applies to the latest version of macOS (currently 11.3), +# and sets up preferences and configurations for all the built-in services and +# apps. Third-party app config should be done elsewhere. +# +# Options: +# --no-restart: Don't restart any apps or services after running the script. +# +# If you want to figure out what default needs changing, do the following: +# +# 1. `cd /tmp` +# 2. Store current defaults in file: `defaults read > before` +# 3. Make a change to your system. +# 4. Store new defaults in file: `defaults read > after` +# 5. Diff the files: `diff before after` +# +# @see: http://secrets.blacktree.com/?showapp=com.apple.finder +# @see: https://github.com/herrbischoff/awesome-macos-command-line +# +# @author Antoine Meausoone +# @from Jeff Geerling + +# Warn that some commands will not be run if the script is not run as root. +if [[ $EUID -ne 0 ]]; then + RUN_AS_ROOT=false + printf "Certain commands will not be run without sudo privileges. To run as root, run the same command prepended with 'sudo', for example: $ sudo $0\n\n" | fold -s -w 80 +else + RUN_AS_ROOT=true + # Update existing `sudo` timestamp until `.osx` has finished + while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & +fi + +############################################################################### +# General UI/UX # +############################################################################### + +# Restart automatically if the computer freezes +if [[ "$RUN_AS_ROOT" = true ]]; then + systemsetup -setrestartfreeze on +fi + +############################################################################### +# Screen # +############################################################################### + +# Save screenshots to Downloads folder. +defaults write com.apple.screencapture location -string "${HOME}/Downloads" + +# 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