added old project
This commit is contained in:
commit
4b22b13b10
29
logger.py
Normal file
29
logger.py
Normal 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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user