My feedback

  1. 116 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    28 comments  ·  Public » Mac  ·  Flag idea as inappropriate…  ·  Admin →
    An error occurred while saving the comment
    Leon commented  · 

    If you're familiar with terminal (cron) you can add this into cron to run every X minutes (or if you prefer, you can create a launchd config for it, but I chose to easier cron option).

    Add this to cron (e.g. to run every 10 mins between 8am and 6pm):
    */10 8-18 * * * /usr/bin/osascript ~/path/to/microsoft-teams-windows.scpt

    And then add this (using Script Editor) into a script which you save as ~/path/to/microsoft-teams-windows.scpt (apologies for the bad formatting, but that's this commenting system, it removes all leading whitespace. See attached screenshot for a pretty version of it):

    tell application "System Events"
    repeat with theProcess in processes
    if not background only of theProcess then
    tell theProcess
    if name is "Teams" then
    repeat with x from 1 to (count of windows)
    if (name of window x) is equal to "Microsoft Teams Notification" then
    display alert "Teams has the hidden window!" message "Do you want to restart Teams?" as critical buttons {"Restart it!", "Ignore"} default button "Ignore" giving up after 5
    if button returned of result = "Restart it!" then
    tell application "Microsoft Teams"
    delay 5
    end tell
    # Exit the repeat (cycling through Teams' windows)
    exit repeat
    end if
    end if
    end repeat
    # Now also exit the top-level repeat, as we're done with the process we were interested in
    exit repeat
    end if
    end tell
    end if
    end repeat
    end tell

    And finally, you'll have to grant Terminal (and possibly cron) the rights to control your computer, in Settings.app -> Security & Privacy -> Privacy (tab) -> Accessibility

    Hope this helps. It has helped me retain my sanity, because I, too, hate this hidden window!

Feedback and Knowledge Base