-
Notifications
You must be signed in to change notification settings - Fork 1
/
Spy-Notify-Linux.py
35 lines (34 loc) · 1.14 KB
/
Spy-Notify-Linux.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
import notify2
from subprocess import check_output, STDOUT, CalledProcessError
import os
os.environ["PBR_VERSION"] = "4.0.2"
from tendo import singleton
me = singleton.SingleInstance()
notify2.init("Spy Notify")
while True:
cmd = "fuser /dev/video0"
try:
usage = check_output(cmd, stderr=STDOUT, shell=True)
returncode = 0
except CalledProcessError as ex:
usage = ex.output
returncode = ex.returncode
if returncode != 1:
raise
if returncode == 0:
img_path = "/opt/Spy Notify/image1.ico"
notify2.Notification("Webcam in Use", message="Your webcam is being used! Is this you?", icon=img_path).show()
use = True
while use == True:
try:
usage = check_output(cmd, stderr=STDOUT, shell=True)
returncode = 0
except CalledProcessError as ex:
usage = ex.output
returncode = ex.returncode
if returncode != 1:
raise
if returncode != 0:
use = False
break