cobacdavid / dtv2 Goto Github PK
View Code? Open in Web Editor NEWDrevo Tyrfing V2 key colors management
Drevo Tyrfing V2 key colors management
dtv2/examples/dtv2reader/dtv2reader
Lines 26 to 28 in 0cf9285
Lines 311 to 321 in 0cf9285
this way of mass assigning individual keys is really expensive, since you open and close the device multiple time.
I think an ideal way would be to pass list of keys, and colours, and loop over them and all while opening/closing once, something like
def keySets(self, key_colors):
""" demande l'application d'un changement sur une touche
"""
self.__ouverture_device()
for key, colour in key_colors:
self.__trame_couleur_touche(key, colour)
self.__ecriture_device()
# if self.__ecriture_device() == -1:
# self.dev.close()
# raise Exception('erreur...')
self.dev.close()
note, im ignoring fail writes here (as think it can happen on incorrect key code?).
ofc, key_colors
can be either a list or dict, and the code can be changed accordingly
example of list https://github.com/Zer0xFF/dtv2/blob/working/event_handler.py#L43 (this is just a quick script i put together to auto change the layout based on focused app)
Hi,
so i found this while looking for a way to script customise my keyboard layout and i found that interface index is set incorrect,
perhaps it changed? or perhaps its a windows thing?, for me the correct interface is interfaces[-2]
or interfaces[6]
Hello, I'm trying to assign a "brightness" to the keyboard:
{"kbd": "cyan"}
This will do the job of changing the color, and then:
dtv2change -r
will do the job.
but If I want to assign a brightness there is way to do this in the .dtv2change file?
TIA and regards
Carlo D.
Hello. I own a drevo tryfing 2 but the 105 keys italian version,
I have note d that some keys are no modified, so I have copied the fr configuration, and modified to make an italian version:
This is working
# it locale
if 'it' in locale.setlocale(locale.LC_ALL, ''):
itkeys = {'ù': 0x32,
'<': 0x64}
keys.update(itkeys)
Same problem with all the keypad keys
#
'kpnlk': 0x53, 'kpdiv': 0x54, 'kpmul': 0x55, 'kpsub': 0x56,
'kpadd': 0x57, 'kpent': 0x58, 'kpdot': 0x63,
#
'kp1': 0x59, 'kp2': 0x5A,'kp3': 0x5B,'kp4': 0x5C,'kp5': 0x5D,
'kp6': 0x5E, 'kp7': 0x5F, 'kp8': 0x60, 'kp9': 0x61,
'kp0': 0x62
and in the "key groups", i've added some definition:
'del', 'end', 'p-down']
'kp_digits': ['kp1', 'kp2','kp3','kp4','kp5',
'kp6','kp7', 'kp8', 'kp9', 'kp0' ],
'kp_oper': ['kpnlk', 'kpdiv','kpmul', 'kpsub',
'kpadd', 'kpent','kpdot']
I have this setting in .dtv2change file
{"kbd": "cyan"}
and everything now works
Regards
carlo D.
I'm trying to run it on WSL2.
This command gives me an unexpected error.
$ dtv2change -kbd white
Traceback (most recent call last):
File "/home/user/.local/bin/dtv2change", line 179, in <module>
change.apply_changes()
File "/home/user/.local/bin/dtv2change", line 81, in apply_changes
self.clavier.key_set(self.dico_touches)
File "/home/user/.local/lib/python3.10/site-packages/dtv2/dtv2.py", line 435, in key_set
self.__key_set(id_keys, rgb_colors)
File "/home/user/.local/lib/python3.10/site-packages/dtv2/dtv2.py", line 405, in __key_set
self.__apply_packets(packets)
File "/home/user/.local/lib/python3.10/site-packages/dtv2/dtv2.py", line 275, in __apply_packets
a = self.__write_device()
File "/home/user/.local/lib/python3.10/site-packages/dtv2/dtv2.py", line 207, in __write_device
a = self.dev.write(self.packet)
AttributeError: 'NoneType' object has no attribute 'write'
Maybe it is a good idea to add some categories, maybe "kbdigits" and "kbsymbols" to group numbers and other symbols, on the keypad (for 104 keys keyboards).
'kbnlk' for could be put in another categories, maybe with "tab", "caps", "BACKS" and "ent" like in some keyboard color schemes group functional keys, leaving the alphabetic and number keys of one colors.
as example:
Regards
Carlo D.
Since "all in dtv2
class" change, two keys: compo
and rcrtl
misbehaves with kbd
method.
this simple script
import dtv2
k = dtv2.dtv2()
k.kbd((255, 0, 0))
doesn't lit those two keys in red.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.