diff --git a/README.md b/README.md index 8100693..a603ae0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ sdk install java 8.0.202-zulu ### Install dependencies (apps, fonts, ...) with Brew `brew bundle` +#### Enable Sleepwatcher +`brew services start sleepwatcher` +`/usr/local/sbin/sleepwatcher --resume ~/.scripts/resume.sh` + ### Install Oh My Zsh ``` sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" diff --git a/dot_scripts/connectmouse.applescript b/dot_scripts/connectmouse.applescript new file mode 100644 index 0000000..0323409 --- /dev/null +++ b/dot_scripts/connectmouse.applescript @@ -0,0 +1,23 @@ +activate application "SystemUIServer" +tell application "System Events" + tell process "SystemUIServer" + -- Working CONNECT Script. Goes through the following: + -- Clicks on Bluetooth Menu (OSX Top Menu Bar) + -- => Clicks on device Item + -- => Clicks on Connect Item + set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth") + tell btMenu + click + tell (menu item "Souris de Morgan" of menu 1) + click + if exists menu item "Connecter" of menu 1 then + click menu item "Connecter" of menu 1 + return "Connecting..." + else + key code 53 -- Close main BT drop down if Connect wasn't present + return "Connect menu was not found, are you already connected?" + end if + end tell + end tell + end tell +end tell diff --git a/dot_scripts/resume.sh b/dot_scripts/resume.sh new file mode 100755 index 0000000..5200662 --- /dev/null +++ b/dot_scripts/resume.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +scriptfile=./connectmouse.applescript +parentdir=$(dirname -- "$0") +osascript "${parentdir}/${scriptfile}" + diff --git a/dot_zshrc b/dot_zshrc index 320db17..e585898 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -94,11 +94,14 @@ source $ZSH/oh-my-zsh.sh . ~/.zsh_functions . ~/.scripts/bootstrap.sh +eval "$(fasd --init auto)" +unlink "$HOME/Library/Application Support/Code/User/settings.json" +ln -s "$HOME/.config/Code/User/settings.json" "$HOME/Library/Application Support/Code/User/settings.json" +#cm apply + #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! https://github.com/sdkman/sdkman-cli/issues/613 export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" sdk use java 8.0.202-zulu -eval "$(fasd --init auto)" -unlink "$HOME/Library/Application Support/Code/User/settings.json" -ln -s "$HOME/.config/Code/User/settings.json" "$HOME/Library/Application Support/Code/User/settings.json" -cm apply + +sh ~/.scripts/resume.sh