Skip to content

Instantly share code, notes, and snippets.

@richardgill
Last active March 3, 2017 14:10
Show Gist options
  • Save richardgill/59dd67cf8be62956bdde5b3e8188e545 to your computer and use it in GitHub Desktop.
Save richardgill/59dd67cf8be62956bdde5b3e8188e545 to your computer and use it in GitHub Desktop.
HeyFocus Do Not Disturb Slack
# Get slack tokens from here: https://api.slack.com/custom-integrations/legacy-tokens
# You need: npm install -g dja/node-slack-dnd-cli
# You need: mkdir -p ~/Applications/NCutil && curl https://raw.githubusercontent.com/jacobsalmela/NCutil/master/NCutil.py -o ~/Applications/NCutil/NCutil.py && chmod u+x ~/Applications/NCutil/NCutil.py
# On Focus
export PATH=$PATH:/usr/local/bin:/Users/username/.nvm/versions/node/v7.6.0/bin/
SLACK_TOKEN="x" slack -o true -d 1000
SLACK_TOKEN="x" slack -o true -d 1000
SLACK_TOKEN="x" slack -o true -d 1000
# Kill apps HeyFocus won't kill
pkill -9 "WhatsApp"
pkill -9 "Skype"
# Minimize Slack
/usr/bin/osascript -e 'tell application "System Events" to click (first button of (every window of (application process "Slack")) whose role description is "minimize button")'
# Switch off slack badge in dock
~/Applications/NCutil/NCutil.py --badge-app-icon false com.tinyspeck.slackmacgap
# On Unfocus
export PATH=$PATH:/usr/local/bin:/Users/richard/.nvm/versions/node/v7.6.0/bin/
source ~/.bash_profile
open /Applications/WhatsApp.app/
open /Applications/Skype.app/
open /Applications/ScreenHero.app/
SLACK_TOKEN="x" slack -o false
SLACK_TOKEN="x" slack -o false
SLACK_TOKEN="x" slack -o false
# Unminimize Slack
osascript -e 'tell app "Slack"' -e 'reopen' -e 'activate' -e'end tell'
# Switch on slack badge in dock
~/Applications/NCutil/NCutil.py --badge-app-icon true com.tinyspeck.slackmacgap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment