0

In Microsoft Teams, the status changes to "away" after a while being inactive.

Is there any way in Python to keep it active all the time?

Tomerikoo
  • 15,737
  • 15
  • 35
  • 52
Devil
  • 511
  • 6
  • 6

2 Answers2

2

one way worked for me on windows

this will keep your windows awake and prevent it from locking/hibernating

#Devil
import ctypes
import sys

#use this to reset the status
def display_reset():
    ctypes.windll.kernel32.SetThreadExecutionState(0x80000000)
    sys.exit(0)

def display_on():
    print("Always On")
    ctypes.windll.kernel32.SetThreadExecutionState(0x80000002)

display_on()
Devil
  • 511
  • 6
  • 6
0

This works for me in Fedora. Just send the main Teams process a SIGUSR1 before the status changes. The script will continue in the background.

#!/bin/bash

signal() {
  while sleep 60 ; do
    kill ${1} ${2} || exit 0
  done
}

PID=$(pgrep -f 'teams.*disable-setuid-sandbox')

[ -z "${PID}" ] && {
  echo "${0}: Teams process not found" >&2
  exit 1
}

(signal -SIGUSR1 ${PID}&)&