feat(darwin): update modules

Don't regenerate yabai workspaces
Add more `nix-darwin` options
Add `pinentry-touchid` and `xquartz`
This commit is contained in:
reo101 2023-07-13 14:29:17 +03:00
parent 319817b5c0
commit ae6e5af098
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
3 changed files with 76 additions and 28 deletions

View file

@ -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"]

View file

@ -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
</key>
<string>
$\{1}
''${1}
</string>
<key>
_CFURLStringType

View file

@ -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" \