Skip to content

Instantly share code, notes, and snippets.

@Clivern
Forked from viktorklang/SlackLauncher.sh
Created July 16, 2019 08:51
Show Gist options
  • Save Clivern/3f6d6b93847ecff802ce23e9256b106d to your computer and use it in GitHub Desktop.
Save Clivern/3f6d6b93847ecff802ce23e9256b106d 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