Skip to content

Instantly share code, notes, and snippets.

@rwese
Created October 28, 2019 08:26
Show Gist options
  • Save rwese/3eb6b3a393fa4fa1cf2e4b43ed72181e to your computer and use it in GitHub Desktop.
Save rwese/3eb6b3a393fa4fa1cf2e4b43ed72181e to your computer and use it in GitHub Desktop.
Restart MS Teams with "disable-gpu" to reduce battery consumption.
#!/bin/bash
# Created 2019-04, Author: René Weselowski <rene.weselowski@gmail.com>
#
# This script is entended as an macos automator 'application' run at startup
# to kill the MSTeams process and restart it wiith '--disable-gpu'
#
# Usage:
# Create a new automator task "Run Shell Script"
# Shell: /bin/bash
# Put it into your login/startup items
#
pkill Teams; sleep 1
# wait for msteams to shutdown
while [ `(pgrep -a Teams| wc -l)` -gt '1' ]; do sleep 1; pkill Teams; done
# to start a process fully in background automator needs some special care, so nohup + & and disowning it.
nohup /Applications/Microsoft\ Teams.app/Contents/MacOS/Teams --disable-gpu > /dev/null 2>&1 &
disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment