Python Key Logge
from pynput.keyboard import Key, Listener
import time
import subprocess
count = 0
limit = 3000
def send_notification():
title = "Break Time"
message = f"You've typed {limit} keystrokes. It's time to take a break!"
voice_message = message
subprocess.run(['osascript', '-e', f'display notification "{message}" with title "{title}"'])
subprocess.run(['say', voice_message])
def on_press(key):
global count
count += 1
print(f"Key limit ({count}/{limit})")
if count >= limit:
print("--------------------------------------------------------------------------------")
print("Sending notification...")
print("--------------------------------------------------------------------------------")
send_notification()
count = 0
with Listener(on_press=on_press) as listener:
listener.join()