Skip to main content

Some important notes

This python module handles key coloring of the Drevo Tyrfing v2 keyboard, especially for linux users ; nevertheless it should work under other platforms.

Requirements

dtv2 needs hidapi library: pip3 install hidapi and colour library: pip3 install colour. These dependances are notified in the Pypi setup file, so that if you install via pip command, you have nothing to do.

You may need to install libhidapi-hidraw dynamic library on your system. For debian users: $ sudo apt install libhidapi-hidraw0

Note python hidapi library may confict with python hid library, you may need to uninstall hid library.

Installation

  1. Copy the 99-drevo-tyrfing.rules in the /etc/udev/rules.d/ directory to grant user with permissions for to send/write informations to the keyboard. Restart or # udevadm trigger.

  2. pip3 install dtv2

Usage

With friendly scripts

dtv2change

Live change and eventually store.

$ ./bin/dtv2change -h
usage: dtv2change [-h] [-V] [-r] [-n] [-a] [-kbd KEYBOARD] [-cat CATEGORY [CATEGORY ...]] [-key KEY [KEY ...]]

Change Drevo tyrfing keys colors

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         display version (last modif. date)
  -r, --read            read and apply saved config
  -n, --new             replace or create config file
  -a, --append          change config with args and store changes
  -kbd KEYBOARD, --keyboard KEYBOARD
                        svg_color_name or hex coloror [rgb|hsl]=(.25,1,.5)
  -cat CATEGORY [CATEGORY ...], --category CATEGORY [CATEGORY ...]
                        category_name svg_color_name or hex coloror [rgb|hsl]=(.25,1,.5)
  -key KEY [KEY ...], --key KEY [KEY ...]
                        key_name svg_color_name or hex coloror [rgb|hsl]=(.25,1,.5)

dtv2rdr

Read config JSON files and apply changes.

$ dtv2reader -h
usage: dtv2reader [-h] [-V] filename

Change Drevo tyrfing keys colors

positional arguments:
  filename       config_file_name (json)

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  display version (last modif. date)
  

As a module

import dtv2

my_kbd = dtv2.dtv2()

# mem_effect: the more you type the more color change
my_kbd.mem_effect((0, 0, 255), color2=(255, 0, 0), brightness=100)

# radar: rays turn around central key (direction: 0 or 1)
my_kbd.radar((0, 0, 255), color2=(255, 0, 0), brightness=100, speed=100, direction=0)

# static: simple static color or if rainbow=True alternate rainbow colors
my_kbd.static((0, 0, 255), brightness=100, speed=100, rainbow=False)

# breath: breath effect
my_kbd.breath((0, 0, 255), brightness=100, speed=100)

# stream: stream effect (direction = 'n' or 's' or 'e' or 'w')
my_kbd.stream((0, 0, 255), color2=(255, 0, 0), brightness=100, speed=100, direction='e', rainbow=False)

# category: change color of a whole category ('letters', 'digits', 'arrows', 'function', 'mod', 'edition')
my_kbd.category('arrows', (255, 0, 0))

# key_set: list of keys and list of colors
my_kbd.key_set( ['esc', 'space'], [(255, 0, 0), (0, 255, 0)] )
my_kbd.key_set( {'esc': (255, 0, 0), 'space': (0, 255, 0)} )
my_kbd.key_set( [('esc', (255, 0, 0)), ('space',(0, 255, 0)] )
my_kbd.key_set( (('esc', (255, 0, 0)), ('space',(0, 255, 0)) )


# key: simple key color change
my_kbd.key('esc', (255, 0, 0))

For the moment rainbow in static mode can be tricky and affect other effects.

Using simple key or category modes enter personal mode so exit all others. It can be boring to affect each key of the keyboard to the same color so there's this special method in personal mode to change all the keyboard color (and then you can change categories colors and finally some individual keys): kbd

my_kbd.kbd((255, 0, 0))
my_kbd.category('letters', (0, 0, 255))
my_kbd.key('space', (0, 0, 255))

Recap

If you need a monocolor keyboard: static or kbd.

If you want some effects: mem_effect, radar, static (with rainbow) breath or stream.

If you want to personalize categories or some keys: kbd, category key_set and key.

An example usage is provided in the examples directory. It uses colour package to allow human color names instead of hex triplets!

Examples

In the examples section, you'll find a README file to use dtv2change and dtv2reader scripts.

First steps and thanks

I did my first steps in this project with a prefix from:

https://github.com/dennisblokland/DrevoTyrfing

I followed Flozz's tutorial (on a mouse)

So: I used wireshark to find other command prefixes.

USB hid tables (for missing french key codes)

Zer0xFF proposed some changes making individual key color assignments really usable.

onekk added 104-keys keyboard compatibility, support of italian version and other useful things on key categories.

And now?

  1. Fix bugs

  2. Add functionalities

  3. ...

License

CC-BY-NC-SA

Metadata

Release files for dtv2 0.4.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dtv2 0.4.8
File Size Uploaded Provenance
dtv2-0.4.8.tar.gz 13.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dtv2 0.4.8
File Interpreter ABI Platform
dtv2-0.4.8-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / dtv2-0.4.8.tar.gz

Download URL dtv2-0.4.8.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec4657b98579efcfb2a95d939da954bbf07acd3bee94059c5a3125f24f293a95
BLAKE2b-256 checksum
How to use checksums
2df575832a8d444621d968ae8618882ab75ca7182b17de0e114414feb91d33f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release files / dtv2-0.4.8-py3-none-any.whl

Download URL dtv2-0.4.8-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2fba543b08e4fb8da32be94f393aa76b1564bee0c04c4ee708002cc07022a96
BLAKE2b-256 checksum
How to use checksums
d469d2406471ef70fb40469078ee4a2eeefe5a00c2d8dbf45c21515633866efa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Security for dtv2 0.4.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page