Code Monkey home page Code Monkey logo

Comments (13)

maricn avatar maricn commented on June 1, 2024

Hi @MarcelRobitaille, thanks for your interest.. The main difference is I'm reckless and I don't sleep. Where caps2esc uses usleep(...), my code doesn't.

I know it's recommended to have the sleeps, but I found them detrimental and causing typing inconsistencies in some rare cases. Use my code with caution. (I should update the README.md file to announce that) [UPDATE: also worth mentioning - I personally haven't had any issues w/o sleeps at all]

Additionally, iirc, I found that sending [too many] SYN events breaks some big (3+ keys) chords on my machine (sometimes). So, since caps2esc and any other InterceptionTools plugins I know of send them on chording with downstream (caps2esc example), I wrote a single plugin that's able to be context aware like no chaining solution can be. [UPDATE: actually no, I found that sending too many SYN events in my code produces unexpected results, but that was not my reasoning for not choosing caps2esc in the first place.] This is NOT in the spirit of InterceptionTools :( (and I should also put a notice about that in the README.md).

Not sure if I missed something, it's been a while since I wrote any code for this[, and tbh not sure if I was introduced to caps2esc working on libudev and not on xmodmap at that moment]. I plan to rewrite parts of it in more C++-ish way and make it more general and hackable, and to add support for combined CAPS_LOCK + mouse click with the new mux option of InterceptionTools, but I am lazyyyy... I mention that bc in case you wanna hack it, I can reduce the scope of the incoming update and push the C++ refactor asap.

from interception-vimproved.

skrat avatar skrat commented on June 1, 2024

I find your space cadet mode really useful, especially in the shell and in the insert mode. I also find it odd to include functionality already provided by caps2esc.

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

I kind of need the -m 2 of caps2esc on my 60% keyboard. Is there a way to make the the caps part of this plugin optional? I'd love to be able to use space+h/j/k/l...

from interception-vimproved.

maricn avatar maricn commented on June 1, 2024

I kind of need the -m 2 of caps2esc on my 60% keyboard. Is there a way to make the the caps part of this plugin optional? I'd love to be able to use space+h/j/k/l...

@harmtemolder OK, I pushed my WIP branch that is more structured. I want to run it for a day or two before merging to mainline branch to make sure I didn't introduce any bugs, but you may try it out on this branch: https://github.com/maricn/interception-vimproved/tree/ivimp-1-generic-key-definition.

For configuring which keys to be used, check out

InterceptedKeyModifier *caps =
- just add/remove whatever you like.

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

I commented out lines 390, 391 and a couple of the space lines, ran make installand saved this as /etc/interception/udevmon.yaml, replacing the first line with:

- JOB: "intercept -g $DEVNODE | caps2esc -m 2 | /opt/interception/interception-vimproved | uinput -d $DEVNODE"

This gives me both the -m 2 of the official caps2esc and your space cadet, but when typing fast my spaces seem delayed, arriving 1 character too late. How can I debug this?

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

I've now removed the caps2esc bits, only running vimproved, but I keep getting the same behavior: spaces are too late. I'll show you by repeating that a little faster:

I've now removedt he caps2esc bits, onlyr unning vimproved, buti k eepg ettingt he same behavior: spaces are too late. I'lls how youb y repeating that a littlef aster

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

Ran a git restore so that I'm on par with what's on https://github.com/maricn/interception-vimproved/tree/ivimp-1-generic-key-definition. Same thing, so must be something in there, not caused by my changes

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

Now on your master branch instead, ran make install again: samet hing. Please let me know how I can help debug

from interception-vimproved.

maricn avatar maricn commented on June 1, 2024

I commented out lines 390, 391 and a couple of the space lines, ran make installand saved this as /etc/interception/udevmon.yaml, replacing the first line with:

- JOB: "intercept -g $DEVNODE | caps2esc -m 2 | /opt/interception/interception-vimproved | uinput -d $DEVNODE"

This gives me both the -m 2 of the official caps2esc and your space cadet, but when typing fast my spaces seem delayed, arriving 1 character too late. How can I debug this?

OK, that sounds like what I would do.

I haven't really run it in combination with any other interception-tools, just a bit long time ago, but didn't notice any issues. But can't guarantee there's no conflicts.

Regarding debugging, phew, I don't really have a good process, tbh. I should invest into setting up a test framework for this, but as mentioned in the readme, it's just a side-side-project that I happen to drive daily on my machine, but no QA done on other machines.

I've now removedt he caps2esc bits, onlyr unning vimproved, buti k eepg ettingt he same behavior: spaces are too late. I'lls how youb y repeating that a littlef aster

What looks interesting there is: how youb y repeating - youb is spaced from y, so I guess your keypresses didn't go: SPACE.down, B.down, B.up, SPACE.up nor SPACE.down, B.down, SPACE.up, B.up because this would emit a BACKSPACE. Can you play around with that and let me know the sequence that works?

I often do trials like: A.down, S.down, SPACE.down, A.up, F.down, S.up, SPACE.up, F.up and that should emit a pattern something like: aaaaassssfffff(SPACE) or matching a+s+f+\b{1} if you like regex :).

Now on your master branch instead, ran make install again: samet hing. Please let me know how I can help debug

This is strange, I haven't experienced this on master so far... Probably we should emit some extra SYN keys, but not sure where.. If you could let me know exact sequence of up/down character presses that causes unexpected behavior that would help a lot. And thank you for your interest and offering to debug!

from interception-vimproved.

maricn avatar maricn commented on June 1, 2024

@harmtemolder
Also, one unfortunate effect of using a space cadet is that if you emit a sequence: SPACE.down, A.down, SPACE.up, A.up, it will output a because letter keys output on keydown event, while "layer" key such as SPACE in our case mustn't output on keydown event. By [my] definition, it must wait to see if there will be another key pressed that will match a key defined in its layer map.

This causes typing issues while you don't get used to emit very short SPACE keypresses (lifting the spacebar up before pressing down on the next key). I admit it causes slight inconvenience in the start, but I think some form of this issue is present in all implementations of space cadets.

EDIT: There are different design choices that could be taken here, but they all cause some form of a problem. For instance, I went for not using any timers to expire the modifier/layer keys, nor any timers to ignore the letter keypresses after the SPACE.down. I tried both variants, and it actually produced more artifacts than the one that I implemented in the end.

EDIT2: Also, please take a look at Correct synthesization of event sequences at Interception Tools project. As stated previously, I recklessly don't send EV_SYNs and emit timeouts as they produce unexpected results with my space cadet (I had issues with https://github.com/zsugabubus/interception-k2k, so I wrote my own tool). When you provide more info, I'll look into debugging it, but if introducing extra timeouts for your setup to register order of events is the only way, I think it would make things a bit complicated.

from interception-vimproved.

harmtemolder avatar harmtemolder commented on June 1, 2024

Also, one unfortunate effect of using a space cadet is that if you emit a sequence: SPACE.down, A.down, SPACE.up, A.up, it will output a because letter keys output on keydown event, while "layer" key such as SPACE in our case mustn't output on keydown event. By [my] definition, it must wait to see if there will be another key pressed that will match a key defined in its layer map.

This might actually be the case with what I'm seeing: It only happens when I type fast, so could be that the SPACE.up hasn't registered yet when I'm already pressing A.down...

What looks interesting there is: how youb y repeating - youb is spaced from y, so I guess your keypresses didn't go: SPACE.down, B.down, B.up, SPACE.up nor SPACE.down, B.down, SPACE.up, B.up because this would emit a BACKSPACE. Can you play around with that and let me know the sequence that works?

I actually commented out line 336 when I typed that, so no B to backspace, sorry. So let's try that again:

  1. I'm on master
  2. make install
  3. systemctl restart udevmon (set up to only run vimproved, no other Interception Tools)
  4. That took some fingerbending, but: aaaaaassssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssfffffffffffffffffffffffffffffffffff
  5. Wait, after these steps B still doesn't work. Am I missing something and am I still on the ivimp-1-generic-key-definition branch?

from interception-vimproved.

maricn avatar maricn commented on June 1, 2024
5. Wait, after these steps `B` still doesn't work. Am I missing something and am I still on the `ivimp-1-generic-key-definition` branch?

@harmtemolder
Are you sure your make install finished successfully? You might need to shut down (stop) the udevmon service that's using the binary at /opt/interception/ so it can be installed over it.

from interception-vimproved.

maricn avatar maricn commented on June 1, 2024

Closing due to inactivity. Please reopen if the same issue happens again, or create a new issue.

from interception-vimproved.

Related Issues (8)

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.