added old project

This commit is contained in:
TinyAtoms 2020-08-01 19:23:25 -03:00
commit 4b22b13b10
2 changed files with 30 additions and 0 deletions

29
logger.py Normal file
View File

@ -0,0 +1,29 @@
import subprocess
from datetime import datetime
import time
def get_active_window():
return subprocess.run(["xdotool", "getwindowfocus", "getwindowname"], capture_output=True).stdout.decode("utf-8")
def update(title):
with open("logs.txt", "a") as file:
time = datetime.now().timestamp()
newline = '{}, "{}"\n'.format(time, title[:-1])
file.write(newline)
oldwin = get_active_window()
update(oldwin)
while True:
time.sleep(60);
win = get_active_window()
if oldwin != win:
oldwin = win
update(oldwin)
print(oldwin)

1
logs.txt Normal file
View File

@ -0,0 +1 @@