From ae6e5af0989941beec806d5f4ff0501c0d419fda Mon Sep 17 00:00:00 2001 From: reo101 Date: Thu, 13 Jul 2023 14:29:17 +0300 Subject: [PATCH] feat(darwin): update modules Don't regenerate yabai workspaces Add more `nix-darwin` options Add `pinentry-touchid` and `xquartz` --- modules/nix-darwin/brew/default.nix | 3 ++ modules/nix-darwin/system/default.nix | 47 ++++++++++++++++++++++- modules/nix-darwin/yabai/yabairc | 54 +++++++++++++-------------- 3 files changed, 76 insertions(+), 28 deletions(-) diff --git a/modules/nix-darwin/brew/default.nix b/modules/nix-darwin/brew/default.nix index 4640226..b85ebad 100644 --- a/modules/nix-darwin/brew/default.nix +++ b/modules/nix-darwin/brew/default.nix @@ -44,11 +44,13 @@ in "homebrew/services" "cmacrae/formulae" "FelixKratz/formulae" + "jorgelbg/tap" ]; brews = [ "libusb" "sketchybar" "switchaudio-osx" + "pinentry-touchid" ]; casks = [ "android-platform-tools" @@ -60,6 +62,7 @@ in "sf-symbols" # "slack" "spotify" + "xquartz" ]; extraConfig = '' # brew "xorpse/formulae/brew", args: ["HEAD"] diff --git a/modules/nix-darwin/system/default.nix b/modules/nix-darwin/system/default.nix index 95a7513..42ed9db 100644 --- a/modules/nix-darwin/system/default.nix +++ b/modules/nix-darwin/system/default.nix @@ -16,7 +16,9 @@ in config = mkIf cfg.enable { + services.activate-system.enable = true; services.nix-daemon.enable = true; + programs.nix-index.enable = true; environment.shells = [ pkgs.zsh ]; @@ -87,6 +89,12 @@ in NSAutomaticWindowAnimationsEnabled = false; }; + CustomUserPreferences = { + "NSGlobalDomain" = { + "AppleSpacesSwitchOnActivate"= 0; + }; + }; + dock = { # Automatically show and hide the dock @@ -115,9 +123,18 @@ in # Finder search in current folder by default FXDefaultSearchScope = "SCcf"; + # Show all extensions + AppleShowAllExtensions = true; + # Disable warning when changing file extension FXEnableExtensionChangeWarning = false; + # Show full paths + ShowPathbar = true; + + # Show POSIX paths in title + _FXShowPosixPathInTitle = true; + # Allow quitting of Finder application QuitMenuItem = true; }; @@ -181,6 +198,31 @@ in defaults write com.apple.dock springboard-hide-duration -float 0 defaults write com.apple.dock springboard-page-duration -float 0 + echo "Disable Hot Corners" + ## wvous-**-corner + ## 0 - Nothing + ## 1 - Disabled + ## 2 - Mission Control + ## 3 - Notifications + ## 4 - Show the desktop + ## 5 - Start screen saver + ## + ## wvous-**-modifier + ## 0 - _ + ## 131072 - Shift+_ + ## 1048576 - Command+_ + ## 524288 - Option+_ + ## 262144 - Control+_ + ## + # Top Left + defaults write com.apple.dock wvous-tl-corner -int 0 + # Top Right + defaults write com.apple.dock wvous-tr-corner -int 0 + # Bottom Left + defaults write com.apple.dock wvous-bl-corner -int 0 + # Bottom Right + defaults write com.apple.dock wvous-br-corner -int 0 + echo "Disable Finder animations" defaults write com.apple.finder DisableAllAnimations -bool true @@ -188,6 +230,9 @@ in defaults write com.apple.Mail DisableSendAnimations -bool true defaults write com.apple.Mail DisableReplyAnimations -bool true + # echo "Disable \"Save in Keychain\" for pinentry-mac" + # defaults write org.gpgtools.common DisableKeychain -bool yes + echo "Define dock icon function" __dock_item() { echo "${ @@ -206,7 +251,7 @@ in _CFURLString - $\{1} + ''${1} _CFURLStringType diff --git a/modules/nix-darwin/yabai/yabairc b/modules/nix-darwin/yabai/yabairc index d8c4d0c..dabaa66 100644 --- a/modules/nix-darwin/yabai/yabairc +++ b/modules/nix-darwin/yabai/yabairc @@ -13,33 +13,33 @@ yabai -m signal --add event=window_destroyed action="sketchybar --trigger window yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse" yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse" -{ - DESIRED_SPACES_PER_DISPLAY=4 - CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')" - - DELTA=0 - while read -r line - do - LAST_SPACE="$(echo "${line##* }")" - LAST_SPACE=$((${LAST_SPACE}+${DELTA})) - EXISTING_SPACE_COUNT="$(echo "${line}" | wc -w)" - MISSING_SPACES=$((${DESIRED_SPACES_PER_DISPLAY} - ${EXISTING_SPACE_COUNT})) - if [ "${MISSING_SPACES}" -gt 0 ]; then - for i in $(seq 1 ${MISSING_SPACES}); do - yabai -m space --create "${LAST_SPACE}" - LAST_SPACE=$((${LAST_SPACE}+1)) - done - elif [ "${MISSING_SPACES}" -lt 0 ]; then - for i in $(seq 1 $((-${MISSING_SPACES}))); do - yabai -m space --destroy "${LAST_SPACE}" - LAST_SPACE=$((${LAST_SPACE}-1)) - done - fi - DELTA=$((${DELTA}+${MISSING_SPACES})) - done <<< "${CURRENT_SPACES}" - - sketchybar --trigger space_change --trigger windows_on_spaces -} +# { +# DESIRED_SPACES_PER_DISPLAY=4 +# CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')" +# +# DELTA=0 +# while read -r line +# do +# LAST_SPACE="$(echo "${line##* }")" +# LAST_SPACE=$((${LAST_SPACE}+${DELTA})) +# EXISTING_SPACE_COUNT="$(echo "${line}" | wc -w)" +# MISSING_SPACES=$((${DESIRED_SPACES_PER_DISPLAY} - ${EXISTING_SPACE_COUNT})) +# if [ "${MISSING_SPACES}" -gt 0 ]; then +# for i in $(seq 1 ${MISSING_SPACES}); do +# yabai -m space --create "${LAST_SPACE}" +# LAST_SPACE=$((${LAST_SPACE}+1)) +# done +# elif [ "${MISSING_SPACES}" -lt 0 ]; then +# for i in $(seq 1 $((-${MISSING_SPACES}))); do +# yabai -m space --destroy "${LAST_SPACE}" +# LAST_SPACE=$((${LAST_SPACE}-1)) +# done +# fi +# DELTA=$((${DELTA}+${MISSING_SPACES})) +# done <<< "${CURRENT_SPACES}" +# +# sketchybar --trigger space_change --trigger windows_on_spaces +# } yabai -m config "external_bar" "all:49:0" \ "window_border" "on" \