From 1c95039847a954cd7a7bb796a8ae4bd68a3a2334 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:02:23 -0500 Subject: [PATCH] new macbook requirements --- bin/weather_cached | 2 +- fish.configlink/conf.d/nix-env.fish | 138 --------------------------- fish.configlink/config.fish | 2 - fish.configlink/functions/abbrs.fish | 2 - homebrew/Caskfile | 26 ++--- homebrew/core.Brewfile | 1 + homebrew/fun.Brewfile | 10 +- homebrew/learning.Brewfile | 18 ++-- homebrew/utils.Brewfile | 5 +- nvim.configlink/init.lua | 8 +- scripts/configure_macos | 33 +++++++ 11 files changed, 71 insertions(+), 174 deletions(-) delete mode 100644 fish.configlink/conf.d/nix-env.fish diff --git a/bin/weather_cached b/bin/weather_cached index 639a79e..d6cd923 100755 --- a/bin/weather_cached +++ b/bin/weather_cached @@ -1,6 +1,6 @@ #!/bin/sh -CACHE_FILE="$HOME/.tmux/.weather_cache" +CACHE_FILE="$HOME/.cache/.weather_cache" CACHE_TIME="$(stat -f %m "$CACHE_FILE")" NOW_TIME=$(date +%s) TIME_PASSED=$((NOW_TIME-CACHE_TIME)) diff --git a/fish.configlink/conf.d/nix-env.fish b/fish.configlink/conf.d/nix-env.fish deleted file mode 100644 index 9b9826e..0000000 --- a/fish.configlink/conf.d/nix-env.fish +++ /dev/null @@ -1,138 +0,0 @@ -# Setup Nix - -# We need to distinguish between single-user and multi-user installs. -# This is difficult because there's no official way to do this. -# We could look for the presence of /nix/var/nix/daemon-socket/socket but this will fail if the -# daemon hasn't started yet. /nix/var/nix/daemon-socket will exist if the daemon has ever run, but -# I don't think there's any protection against accidentally running `nix-daemon` as a user. -# We also can't just look for /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh because -# older single-user installs used the default profile instead of a per-user profile. -# We can still check for it first, because all multi-user installs should have it, and so if it's -# not present that's a pretty big indicator that this is a single-user install. If it does exist, -# we still need to verify the install type. To that end we'll look for a root owner and sticky bit -# on /nix/store. Multi-user installs set both, single-user installs don't. It's certainly possible -# someone could do a single-user install as root and then manually set the sticky bit but that -# would be extremely unusual. - -set -l nix_profile_path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh -set -l single_user_profile_path ~/.nix-profile/etc/profile.d/nix.sh -if test -e $nix_profile_path - # The path exists. Double-check that this is a multi-user install. - # We can't just check for ~/.nix-profile/… because this may be a single-user install running as - # the wrong user. - - # stat is not portable. Splitting the output of ls -nd is reliable on most platforms. - set -l owner (string split -n ' ' (ls -nd /nix/store 2>/dev/null))[3] - if not test -k /nix/store -a $owner -eq 0 - # /nix/store is either not owned by root or not sticky. Assume single-user. - set nix_profile_path $single_user_profile_path - end -else - # The path doesn't exist. Assume single-user - set nix_profile_path $single_user_profile_path -end - -if test -e $nix_profile_path - # Source the nix setup script - # We're going to run the regular Nix profile under bash and then print out a few variables - for line in (env -u BASH_ENV bash -c '. "$0"; for name in PATH "${!NIX_@}"; do printf "%s=%s\0" "$name" "${!name}"; done' $nix_profile_path | string split0) - set -xg (string split -m 1 = $line) - end - - # Insert Nix's fish share directories into fish's special variables. - # nixpkgs-installed fish tries to set these up already if NIX_PROFILES is defined, which won't - # be the case when sourcing $__fish_data_dir/share/config.fish normally, but might be for a - # recursive invocation. To guard against that, we'll only insert paths that don't already exit. - # Furthermore, for the vendor_conf.d sourcing, we'll use the pre-existing presence of a path in - # $fish_function_path to determine whether we want to source the relevant vendor_conf.d folder. - - # To start, let's locally define NIX_PROFILES if it doesn't already exist. - set -al NIX_PROFILES - if test (count $NIX_PROFILES) -eq 0 - set -a NIX_PROFILES $HOME/.nix-profile - end - # Replicate the logic from nixpkgs version of $__fish_data_dir/__fish_build_paths.fish. - set -l __nix_profile_paths (string split ' ' -- $NIX_PROFILES)[-1..1] - set -l __extra_completionsdir \ - $__nix_profile_paths/etc/fish/completions \ - $__nix_profile_paths/share/fish/vendor_completions.d - set -l __extra_functionsdir \ - $__nix_profile_paths/etc/fish/functions \ - $__nix_profile_paths/share/fish/vendor_functions.d - set -l __extra_confdir \ - $__nix_profile_paths/etc/fish/conf.d \ - $__nix_profile_paths/share/fish/vendor_conf.d \ - - ### Configure fish_function_path ### - # Remove any of our extra paths that may already exist. - # Record the equivalent __extra_confdir path for any function path that exists. - set -l existing_conf_paths - for path in $__extra_functionsdir - if set -l idx (contains --index -- $path $fish_function_path) - set -e fish_function_path[$idx] - set -a existing_conf_paths $__extra_confdir[(contains --index -- $path $__extra_functionsdir)] - end - end - # Insert the paths before $__fish_data_dir. - if set -l idx (contains --index -- $__fish_data_dir/functions $fish_function_path) - # Fish has no way to simply insert into the middle of an array. - set -l new_path $fish_function_path[1..$idx] - set -e new_path[$idx] - set -a new_path $__extra_functionsdir - set fish_function_path $new_path $fish_function_path[$idx..-1] - else - set -a fish_function_path $__extra_functionsdir - end - - ### Configure fish_complete_path ### - # Remove any of our extra paths that may already exist. - for path in $__extra_completionsdir - if set -l idx (contains --index -- $path $fish_complete_path) - set -e fish_complete_path[$idx] - end - end - # Insert the paths before $__fish_data_dir. - if set -l idx (contains --index -- $__fish_data_dir/completions $fish_complete_path) - set -l new_path $fish_complete_path[1..$idx] - set -e new_path[$idx] - set -a new_path $__extra_completionsdir - set fish_complete_path $new_path $fish_complete_path[$idx..-1] - else - set -a fish_complete_path $__extra_completionsdir - end - - ### Source conf directories ### - # The built-in directories were already sourced during shell initialization. - # Any __extra_confdir that came from $__fish_data_dir/__fish_build_paths.fish was also sourced. - # As explained above, we're using the presence of pre-existing paths in $fish_function_path as a - # signal that the corresponding conf dir has also already been sourced. - # In order to simulate this, we'll run through the same algorithm as found in - # $__fish_data_dir/config.fish except we'll avoid sourcing the file if it comes from an - # already-sourced location. - # Caveats: - # * Files will be sourced in a different order than we'd ideally do (because we're coming in - # after the fact to source them). - # * If there are existing extra conf paths, files in them may have been sourced that should have - # been suppressed by paths we're inserting in front. - # * Similarly any files in $__fish_data_dir/vendor_conf.d that should have been suppressed won't - # have been. - set -l sourcelist - for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish - # We know these paths were sourced already. Just record them. - set -l basename (string replace -r '^.*/' '' -- $file) - contains -- $basename $sourcelist - or set -a sourcelist $basename - end - for root in $__extra_confdir - for file in $root/*.fish - set -l basename (string replace -r '^.*/' '' -- $file) - contains -- $basename $sourcelist - and continue - set -a sourcelist $basename - contains -- $root $existing_conf_paths - and continue # this is a pre-existing path, it will have been sourced already - [ -f $file -a -r $file ] - and source $file - end - end -end diff --git a/fish.configlink/config.fish b/fish.configlink/config.fish index 0830a37..529e662 100644 --- a/fish.configlink/config.fish +++ b/fish.configlink/config.fish @@ -36,8 +36,6 @@ if status --is-interactive set -g FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND" set -g FZF_DEFAULT_OPTS '-m --height 50% --border' - source $DOTS/fish.configlink/conf.d/nix-env.fish - # Use `starship` prompt starship init fish | source diff --git a/fish.configlink/functions/abbrs.fish b/fish.configlink/functions/abbrs.fish index 07dc025..1bc52fb 100644 --- a/fish.configlink/functions/abbrs.fish +++ b/fish.configlink/functions/abbrs.fish @@ -79,8 +79,6 @@ function abbrs --description 'All abbreviations' abbr -a j 'just' # Fun CLI Tools - abbr goo 'googler' - abbr gooj 'googler -j' abbr weather 'curl wttr.in/$WEATHER_CITY' abbr moon 'curl wttr.in/Moon' diff --git a/homebrew/Caskfile b/homebrew/Caskfile index a613f1b..296621b 100644 --- a/homebrew/Caskfile +++ b/homebrew/Caskfile @@ -3,37 +3,37 @@ tap "homebrew/cask" # Core Applications cask "alacritty" # Terminal cask "firefox" # Browser -cask "slack" # Chat -cask "zoomus" # Video conference +#cask "slack" # Chat +#cask "zoomus" # Video conference cask "1password" # Passwords cask "dropbox" # File sync -cask "docker" # Containers +#cask "docker" # Containers # Helpful Applications cask "obsidian" # Notes -cask "github-desktop" # Git GUI -cask "drawio" # Diagrams +#cask "github-desktop" # Git GUI +#cask "drawio" # Diagrams # Auxiliary Tools cask "scroll-reverser" # Mouse vs. trackpad cask "meetingbar" # Scheduling cask "gitify" # GitHub notifications -cask "basictex" # Small LaTeX distribution +#cask "basictex" # Small LaTeX distribution cask "hammerspoon" # Fonts tap "homebrew/cask-fonts" -cask "font-fira-mono-for-powerline" +#cask "font-fira-mono-for-powerline" cask "font-fira-mono-nerd-font" # Personal -cask "authy" # Authentication +#cask "authy" # Authentication cask "keybase" # Encryption cask "discord" # Chat -cask "steam" # Games -cask "epic-games" # Games -cask "calibre" # E-Books -cask "signal" # Messaging +#cask "steam" # Games +#cask "epic-games" # Games +#cask "calibre" # E-Books +#cask "signal" # Messaging # Maybe -cask "jira-client" # Project Management +#cask "jira-client" # Project Management diff --git a/homebrew/core.Brewfile b/homebrew/core.Brewfile index 25ff0ca..02426db 100644 --- a/homebrew/core.Brewfile +++ b/homebrew/core.Brewfile @@ -13,3 +13,4 @@ brew "exa" # Better ls brew "bat" # Better cat brew "fzf" # Fuzzy finder brew "tealdeer" # Mini man page +brew "direnv" # Environment variables diff --git a/homebrew/fun.Brewfile b/homebrew/fun.Brewfile index 25fd0fa..3eb1154 100644 --- a/homebrew/fun.Brewfile +++ b/homebrew/fun.Brewfile @@ -1,8 +1,8 @@ # Fun / Unnecessary Packages -tap "nmasur/repo" -tap "tarkah/tickrs" +#tap "nmasur/repo" +#tap "tarkah/tickrs" -brew "ffmpeg" # Convert videos -brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee -brew "tarkah/tickrs/tickrs" # Interactive stock tickers +#brew "ffmpeg" # Convert videos +#brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee +#brew "tarkah/tickrs/tickrs" # Interactive stock tickers diff --git a/homebrew/learning.Brewfile b/homebrew/learning.Brewfile index d59acdf..b950a3d 100644 --- a/homebrew/learning.Brewfile +++ b/homebrew/learning.Brewfile @@ -4,14 +4,14 @@ tap "superfly/tap" tap "nmasur/repo" tap "cjbassi/ytop" -brew "superfly/tap/flyctl" # Fly.io CLI -brew "ghc" # Haskell -brew "xsv" # CSV manipulation -brew "gron" # JSON grep -brew "nushell" # Data manipulation shell -brew "tectonic" # Minimal LaTeX compiler +#brew "superfly/tap/flyctl" # Fly.io CLI +#brew "ghc" # Haskell +#brew "xsv" # CSV manipulation +#brew "gron" # JSON grep +#brew "nushell" # Data manipulation shell +#brew "tectonic" # Minimal LaTeX compiler brew "noti" # Create system notifications -brew "b2-tools" # BackBlaze B2 storage -brew "cjbassi/ytop/ytop" # Fancy system performance -brew "nmasur/repo/update-ssh-config" # Update .ssh/config +#brew "b2-tools" # BackBlaze B2 storage +#brew "cjbassi/ytop/ytop" # Fancy system performance +#brew "nmasur/repo/update-ssh-config" # Update .ssh/config brew "awslogs" # View AWS log streams diff --git a/homebrew/utils.Brewfile b/homebrew/utils.Brewfile index 2a19cb3..6b72851 100644 --- a/homebrew/utils.Brewfile +++ b/homebrew/utils.Brewfile @@ -1,5 +1,7 @@ # Utility Packages +tap "saulpw/vd" + brew "jq" # JSON manipulation brew "dos2unix" # File conversion brew "tree" # Display directory trees @@ -12,8 +14,7 @@ brew "gpg" # Encryption brew "qrencode" # Make a QR code brew "mpv" # Video player brew "youtube-dl" # Download YouTube videos -brew "googler" # Search Google brew "gh" # GitHub commands brew "pandoc" # Document converter -brew "visidata" # Spreadsheet manipulation +brew "saulpw/vd/visidata" # Spreadsheet manipulation brew "mdp" # Terminal slideshows diff --git a/nvim.configlink/init.lua b/nvim.configlink/init.lua index e1b87fe..5ceb04c 100644 --- a/nvim.configlink/init.lua +++ b/nvim.configlink/init.lua @@ -37,7 +37,12 @@ require('packer').startup(function(use) use 'airblade/vim-rooter' --- Change directory to git route -- Colorscheme - use 'morhetz/gruvbox' + use { + 'morhetz/gruvbox', + config = function() + vim.cmd[[colorscheme gruvbox]] + end + } -- Git next to line numbers use { @@ -336,7 +341,6 @@ end) -- =========================================================================== vim.o.termguicolors = true --- Set to truecolor -vim.cmd[[colorscheme gruvbox]] --- Installed with a plugin vim.o.hidden = true --- Don't unload buffers when leaving them vim.wo.number = true --- Show line numbers vim.wo.relativenumber = true --- Relative numbers instead of absolute diff --git a/scripts/configure_macos b/scripts/configure_macos index 11f268b..293b07f 100755 --- a/scripts/configure_macos +++ b/scripts/configure_macos @@ -6,6 +6,9 @@ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 echo "Automatically show and hide the dock" defaults write com.apple.dock autohide -bool true +echo "Automatically show and hide the menu bar" +defaults write NSGlobalDomain _HIHideMenuBar -bool true + echo "Make Dock icons of hidden applications translucent" defaults write com.apple.dock showhidden -bool true @@ -111,6 +114,36 @@ echo "Set dock size" defaults write com.apple.dock largesize -int 48 defaults write com.apple.dock tilesize -int 44 +echo "Choose and order dock icons" +__dock_item() { + printf '%s%s%s%s%s' \ + 'tile-datafile-data' \ + '_CFURLString' \ + "$1" \ + '_CFURLStringType0' \ + '' +} + +defaults write com.apple.dock persistent-apps -array \ + "$(__dock_item /Applications/1Password\ 7.app)" \ + "$(__dock_item /Applications/Microsoft\ Outlook.app)" \ + "$(__dock_item /Applications/Slack.app)" \ + "$(__dock_item /System/Applications/Calendar.app)" \ + "$(__dock_item /Applications/Firefox.app)" \ + "$(__dock_item /System/Applications/Messages.app)" \ + "$(__dock_item /System/Applications/Mail.app)" \ + "$(__dock_item /Applications/Mimestream.app)" \ + "$(__dock_item /Applications/zoom.us.app)" \ + "$(__dock_item /Applications/Obsidian.app)" \ + "$(__dock_item /Applications/Alacritty.app)" \ + "$(__dock_item /System/Applications/System\ Preferences.app)" + +echo "No recent items in dock" +defaults write com.apple.dock show-recents -bool FALSE + +echo "Switch to dark mode" +defaults write "Apple Global Domain" "AppleInterfaceStyle" "Dark" + echo "Turn on Scroll Reverser" open /Applications/Scroll\ Reverser.app osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/Scroll Reverser.app", hidden:false}'