commit 4b22b13b104d4bf9854f1c4d09fbafef864e73e5 Author: TinyAtoms Date: Sat Aug 1 19:23:25 2020 -0300 added old project diff --git a/logger.py b/logger.py new file mode 100644 index 0000000..0c46397 --- /dev/null +++ b/logger.py @@ -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) + + + + + + diff --git a/logs.txt b/logs.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/logs.txt @@ -0,0 +1 @@ +