Skip to content

Instantly share code, notes, and snippets.

@viktorklang
Created July 16, 2019 08:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save viktorklang/1a07edc5c13c20bf69f94513fe53e94b to your computer and use it in GitHub Desktop.
Save viktorklang/1a07edc5c13c20bf69f94513fe53e94b to your computer and use it in GitHub Desktop.
Launcher script for Slack on macOS which warns you if you open if while on battery power
#!/usr/bin/env bash
if [[ $(pmset -g ps | head -1) =~ "Battery Power" ]]; then
osascript -e 'display notification "You are starting Slack while running on battery power" with title "Battery Drain Source Detected" subtitle ""'
fi
open /Applications/Slack.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment