aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/afk.py
blob: 2c548885cc28eb9b232e0d9a98566f0caf26cb2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
def IsAFK():
    time_since_last_input = int(os.popen("xprintidle").read())
    if time_since_last_input >= 3000:
        video_playback = os.popen("""pacmd list-sink-inputs  | grep -w state | grep -i 'CORKED'""").read()
        # if playback is not running as well as user is AFK
        if "CORKED" in video_playback:
            return True
        # if playback is running is background as well as user is AFK
        else:
            return False
    else:
        return False