Skip to content

Instantly share code, notes, and snippets.

@Glutnix
Last active September 15, 2025 08:37
Show Gist options
  • Save Glutnix/d23331e91de2b4141633bec28cd58eae to your computer and use it in GitHub Desktop.
Save Glutnix/d23331e91de2b4141633bec28cd58eae to your computer and use it in GitHub Desktop.
# Kanata config for my Razer Tartarus v2
# ~/.config/systemd/user/kanata.service
[Unit]
Description=Kanata keyboard remapper
Documentation=https://github.com/jtroo/kanata
[Service]
# Environment=PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin
# Uncomment the 4 lines beneath this to increase process priority
# of Kanata in case you encounter lagginess when resource constrained.
# WARNING: doing so will require the service to run as an elevated user such as root.
# Implementing least privilege access is an exercise left to the reader.
#
# CPUSchedulingPolicy=rr
# CPUSchedulingPriority=99
# IOSchedulingClass=realtime
# Nice=-20
Type=simple
ExecStart=%h/.local/bin/kanata --port 15817 --cfg %h/.config/kanata/config.kbd
Restart=no
[Install]
WantedBy=default.target
(defcfg
danger-enable-cmd yes ;; in order to control the Tartarus' lights
linux-dev-names-include (
"Razer Razer Tartarus V2"
)
process-unmapped-keys no
)
(defsrc
1 2 3 4 5 mwu lalt
tab q w e r mmid up
caps a s d f mwd left down right
lsft z x c spc
)
(deflayer default
1 2 3 4 5 mwu @l-lay
tab q w e r mmid up
caps a s d f mwd left down right
lsft z x c spc
)
(deflayer layers
@l-def @l-csp _ _ lrld _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
_ _ _ _ _
)
(deflayer csp
esc @dsel @oper @lass bspc @cl-mwu @l-lay
lsft @wand @marq @erase @blend _ @zoomin
lalt @redo @undo @pen @brush @cl-mwd , @zoomou .
lctl @sx-c @sx-x @l-vec spc
)
(deflayer vector-tools
_ _ _ _ del _ _
tab _ _ @vctrl @vconn _ _
@ledred @ledgrn @ledblu @vsimpl @vrdlw _ _ _ _
_ _ _ @l-vec _
)
(deflayer blank
_ _ _ _ _ _ @l-lay
_ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
_ _ _ _ _
)
(defalias
switch-color x
switch-transparency c
vector-control-point n
vector-simplify s
vector-connect \
vector-redraw-line-width a
ledred (cmd .local/bin/tartarus-leds 1 0 0)
ledyel (cmd .local/bin/tartarus-leds 1 1 0)
ledgrn (cmd .local/bin/tartarus-leds 0 1 0)
ledblu (cmd .local/bin/tartarus-leds 0 0 1)
ledall (cmd .local/bin/tartarus-leds 1 1 1)
ledoff (cmd .local/bin/tartarus-leds 0 0 0 off)
)
(defvirtualkeys
lvec (layer-while-held vector-tools)
lred (cmd .local/bin/tartarus-leds 1 0 0 red)
llay (cmd .local/bin/tartarus-leds 1 1 1 off)
lcsp (cmd .local/bin/tartarus-leds 0 0 1 off)
loff (cmd .local/bin/tartarus-leds 0 0 0 off)
)
(defalias
;; layers
l-def (multi
@ledyel
(layer-switch default)
)
l-lay (multi
lalt
(on-press tap-vkey llay)
(on-release tap-vkey loff)
(layer-while-held layers)
)
l-csp (multi
@l-lay
(layer-switch csp)
(on-press tap-vkey lcsp)
)
l-vec (multi
(on-press tap-vkey lred)
(on-release tap-vkey lcsp)
(layer-while-held vector-tools)
)
;; shortcuts
undo C-z
redo C-y
copy C-c
paste C-v
zoomin C-+
zoomou C--
sx-c @switch-color
sx-x @switch-transparency
vctrl @vector-control-point
vsimpl @vector-simplify
vrdlw @vector-redraw-line-width
vconn @vector-connect
blend j
brush b
dsel C-d ;; deselect
erase e
lass l ;; lasso
marq m ;; rectangle selection
oper o ;; operation
pen p ;; pen/pencil
vect v ;; vector tool
wand w ;; magic wand / auto-select
cl-mwu (switch
((or lctl spc)) @zoomin break
() ] break
)
cl-mwd (switch
((or lctl spc)) @zoomou break
() [ break
)
)
#!/usr/bin/env python3
# ~/.local/.bin/tartarus-leds
#
# requires OpenRazer to be installed (both the daemon and the Python 3 library), https://openrazer.github.io
# `sudo apt install openrazer-meta` should do fine.
import sys
from time import sleep
from PIL.ImageColor import getrgb
from openrazer.client import DeviceManager
from openrazer.client.constants import REACTIVE_500MS
from openrazer.client.devices.keyboard import RazerKeyboard
def main() -> None:
args = sys.argv[1:]
a = DeviceManager()
if a.devices.count == 0:
sys.exit("No devices found");
d = a.devices[0]
if not isinstance(d, RazerKeyboard):
sys.exit("No devices found");
print(d.name)
d.profile_led_red = (args[0] == "1")
d.profile_led_green = (args[1] == "1")
d.profile_led_blue = (args[2] == "1")
if d.fx and len(args) > 3:
color = args[3]
if (color == "off"):
color = "black"
print(color)
r = d.fx.static(*getrgb(color))
# r = d.fx.reactive(*getrgb(color), time=1)
# r = d.fx.starlight_single(*getrgb(color), time=100)
if not r:
sys.exit("couldn't do effect")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment