-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.py
More file actions
58 lines (41 loc) · 1.26 KB
/
Copy pathcore.py
File metadata and controls
58 lines (41 loc) · 1.26 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import time
import subprocess
import sys
# --- CONFIGURATION ---
TARGET_DISPLAY = ":2"
def setup_display():
os.environ["DISPLAY"] = TARGET_DISPLAY
print(f"[Core] Target Display set to {TARGET_DISPLAY}")
# --- HELPER FUNCTIONS ---
def hold_key(key, duration):
subprocess.run(["xdotool", "keydown", key])
time.sleep(duration)
subprocess.run(["xdotool", "keyup", key])
time.sleep(0.1)
def press_key(key):
subprocess.run(["xdotool", "key", key])
time.sleep(0.1)
def hold_dual_keys(key1, key2, duration):
subprocess.run(["xdotool", "keydown", key1])
subprocess.run(["xdotool", "keydown", key2])
time.sleep(duration)
subprocess.run(["xdotool", "keyup", key2])
subprocess.run(["xdotool", "keyup", key1])
time.sleep(0.1)
def mouse_down():
subprocess.run(["xdotool", "mousedown", "1"])
def mouse_up():
subprocess.run(["xdotool", "mouseup", "1"])
def reset_character():
print(" -> [Core] Resetting Character...")
press_key("Escape")
time.sleep(0.5)
press_key("R")
time.sleep(0.5)
press_key("Return")
time.sleep(5)
def emergency_cleanup():
print("\n[Core] Emergency Stop! Releasing all keys...")
os.system("xdotool keyup w a s d space 1")
os.system("xdotool mouseup 1")