Coder Social home page Coder Social logo

dtv2's People

Contributors

cobacdavid avatar onekk avatar zer0xff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zer0xff onekk

dtv2's Issues

example mass assigning single keys

if 'key' in dico:
for k, v in dico['key'].items():
kbd.key(k, colour.COLOR_NAME_TO_RGB[v])

dtv2/dtv2/dtv2.py

Lines 311 to 321 in 0cf9285

def key(self, id_key, couleur_RGB):
"""Individual key color assignment
"""
self.__ouverture_device()
self.__trame_couleur_touche(id_key, couleur_RGB)
if self.__ecriture_device() == -1:
self.dev.close()
raise Exception('erreur...')
self.dev.close()

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)

incorrect interface index

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]

drevo tryfing 2 italian 105 key - some keys are not changing color

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.

Does not work on WSL2

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'

add categories

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:

  • white keys for letters and numbers,
  • a color functions keys,
  • another color for "modifiers" "shift, ctrl, caps lock, tab, backspace, widnows keys and fn, plus esc"
  • another color for arrows and movement "arrows, pg up, pg dwn, home, end" (ins and del maybe another color?)

Regards

Carlo D.

kbd method seems buggy

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.