Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions WayOSK/KeyboardUtils/KeyboardKey.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ Button {
radius: 5
}

onClicked: {
onPressed: {
if (keyboard.keyboardSocket) {
keyboard.keyboardSocket.connected = true
keyboard.keyboardSocket.write(key)
keyboard.keyboardSocket.write("press " + key)
keyboard.keyboardSocket.flush()
} else {
console.error("Socket is not connected")
}
}
onReleased: {
if (keyboard.keyboardSocket) {
keyboard.keyboardSocket.connected = true
keyboard.keyboardSocket.write("release " + key)
keyboard.keyboardSocket.flush()
} else {
console.error("Socket is not connected")
Expand Down
17 changes: 12 additions & 5 deletions WayOSK/keyboard_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ def listen_for_keys(self):
while True:
conn, _ = self.server.accept()
with conn:
data = conn.recv(1024).decode("utf-8")
data = conn.recv(1024).decode("utf-8").split()
if not data:
continue

try:
wk.click(data)
except Exception as e:
print(f"Error sending key: {e}")
if len(data) == 2:
if data[0] == "press":
try:
wk.press(data[1])
except Exception as e:
print(f"Error pressing key: {e}")
elif data[0] == "release":
try:
wk.release(data[1])
except Exception as e:
print(f"Error releasing key: {e}")

def cleanup(self):
if self.server:
Expand Down