move HC to scriptrc

This commit is contained in:
doman 2023-11-14 19:11:04 +01:00
parent c22ec9638c
commit 0847a00714
2 changed files with 47 additions and 11 deletions

View file

@ -2,17 +2,53 @@ setupmac() {
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write -g InitialKeyRepeat -int 12
defaults write -g KeyRepeat -int 1
defaults write com.apple.Dock autohide-delay -float 0; killall Dock
defaults write com.apple.Dock autohide-delay -float 0
defaults write -g com.apple.mouse.scaling -integer -1
}
function disable_hot_corners(){
defaults write com.apple.dock "wvous-tl-corner" -int 0
defaults write com.apple.dock "wvous-tr-corner" -int 0
defaults write com.apple.dock "wvous-br-corner" -int 0
}
function enable_hot_corners(){
defaults write com.apple.dock "wvous-tl-corner" -int 2
defaults write com.apple.dock "wvous-tr-corner" -int 3
defaults write com.apple.dock "wvous-br-corner" -int 1
}
check_ssh_add() {
if [[ "$(ssh-add -l)" == "The agent has no identities." ]] ; then
ssh-add ~/.ssh/id_rsa
setupmac
enable_hot_corners
# Restart Dock
killall Dock
fi
}
hc() {
# Make sure to read from a corner that has an active value > 0
has_hot_corners=$(defaults read com.apple.dock "wvous-tl-corner")
# Toggle
if (( $has_hot_corners != 0 ))
then
disable_hot_corners
else
enable_hot_corners
fi
echo "Hot corners are now:"
defaults read com.apple.dock "wvous-tl-corner"
defaults read com.apple.dock "wvous-tr-corner"
defaults read com.apple.dock "wvous-br-corner"
# Restart Dock
killall Dock
}
if [[ "$(uname)" == "Darwin" ]]; then
check_ssh_add

4
.zshrc
View file

@ -198,7 +198,7 @@ bindkey '^l' autosuggest-accept
export FZF_DEFAULT_OPTS="--reverse --bind change:first --bind ctrl-j:down,ctrl-k:up -i --cycle --header-first --border rounded"
# exports - local bin, python, brew
export PATH="$HOME/.local/bin:$HOME/.bin:/Users/$USER/Library/Python/3.9/bin:$HOME/Projects/Personal/scripts:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH="$HOME/.local/bin:$HOME/.bin:/Users/$USER/Library/Python/3.9/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
# mysql client on macos
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
@ -215,7 +215,7 @@ fi
# Load scripts
if [ -d "$HOME/.config/scriptrc" ]; then
for SCRIPTFILE in $HOME/.config/scriptrc/*; do
for SCRIPTFILE in $HOME/.config/scriptrc/*sh; do
source $SCRIPTFILE
done
fi