Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shark-k86-mac

Native macOS / Linux control for the Attack Shark K86 mechanical keyboard — RGB lighting, side strips, and the 128×128 TFT screen. No Windows, no VM, no browser.

Attack Shark only ships a Windows app (plus a browser WebHID driver that doesn't work for everyone). This is a small Python tool that talks to the keyboard's vendor HID interface directly, so you can drive it from a terminal on a Mac or Linux box.

Protocol reverse-engineered from the official WebHID driver. See PROTOCOL.md for the byte-level details.

Features

  • 🎨 Solid custom colours on the keys and the side strips
  • 🌈 20+ built-in effects (wave, ripple, snake, breath, meteor, fireworks, …) — including the reactive type-and-ripple effect
  • 🖼️ Send any image (PNG/JPG/…) to the TFT screen
  • 🎞️ Send animated GIFs to the screen
  • 💡 LED master + power-save control (the thing that silently keeps your lights off)
  • 🔎 Read-only device info (firmware version, state)

Supported device

Product Attack Shark K86 (ROYUAN "Gaming Keyboard")
USB VID:PID 0x3151:0x4015
Control interface HID interface 2, usage page 0xffff, usage 0x0002

Other ROYUAN/Attack Shark models may share the framing but are untested.

Install

git clone https://github.com/RaphaelCaputo2/shark-k86-mac.git
cd shark-k86-mac
pip install -r requirements.txt        # hidapi + pillow
# optional: install the `k86` command
pip install -e .

Connect the keyboard by USB cable and set the back switches to Win + USB.

  • Linux: you may need a udev rule to access the device without sudo:
    # /etc/udev/rules.d/99-attackshark-k86.rules
    SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3151", ATTRS{idProduct}=="4015", MODE="0660", TAG+="uaccess"
    
    Then sudo udevadm control --reload && sudo udevadm trigger.
  • macOS: works out of the box.

Usage

# lighting
k86 color purple                 # solid colour on the keys (name or "R,G,B")
k86 color 0,128,255 --bright 4
k86 side blue                    # side strips
k86 both cyan                    # keys + side, same colour
k86 effect ripple --rainbow      # reactive: type and watch it spread 🌊
k86 effect wave --rainbow
k86 effect breath --rgb 255 0 0
k86 show                         # live colour show
k86 leds off                     # / on
k86 info                         # firmware + state (read-only)

# screen (128x128)
k86 image ~/Pictures/logo.png
k86 image logo.png --rotate 90 --flip h
k86 gif ~/Pictures/loop.gif
k86 test                         # 4-colour test pattern

Without pip install -e ., run it as a module: python -m k86.cli color purple.

As a library

from k86 import K86

with K86() as kb:
    kb.leds(on=True)
    kb.set_main_color(255, 0, 255)      # magenta keys
    kb.set_side_color(0, 0, 255)        # blue side strips

from k86 import screen
screen.write_image(screen.load_image("logo.png"))

See examples/ for a live clock on the TFT.

Gotchas

  • Brightness is 0–4. Sending > 4 makes the firmware reject the whole packet.
  • Power-save hides everything. If nothing lights up, the LED-off bit or power-save is set — call k86 leds on (the library does this before every colour command).
  • Custom colour vs rainbow is the option nibble: 7 = your RGB, 8 = rainbow.

Disclaimer

Unofficial and not affiliated with Attack Shark / ROYUAN. Use at your own risk. It only sends the same vendor HID commands the official software does; it does not flash firmware.

Credits

Reverse-engineered and built by @RaphaelCaputo2. Protocol derived from Attack Shark's public WebHID driver (their JavaScript is not redistributed here — only a clean-room description of the wire format).

License

MIT

About

Native macOS/Linux control for the Attack Shark K86 keyboard — RGB, side strips, and 128x128 TFT screen. No Windows/VM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages