Code Monkey home page Code Monkey logo

Comments (4)

KarsMulder avatar KarsMulder commented on June 12, 2024 1

Nothing inherently prevents multiple instances of evsieve from running simultaneously, but the main problem in this scenario is that you want one of the two instances to "grab" the input device to prevent X/Wayland reading events from both the real and virtual device, and this grabbing simultaneously prevents a second instance of evsieve from reading from the same input device as well.

In your specific use case of having different maps, this is best accomplished with toggles and domains. For example, the following script will map c -> ctrl+c, v -> ctrl+v, l -> ctrl+alt+l after the user presses F10 and goes back to directly mimicking the input keyboard after pressing F8:

evsieve --input /dev/input/by-id/keyboard grab \
        --hook key:f8  toggle=:1 \
        --hook key:f10 toggle=:2 \
        --toggle "" @norm_layout @dev_layout \
        --map key:c@dev_layout key:leftctrl key:c \
        --map key:v@dev_layout key:leftctrl key:v \
        --map key:l@dev_layout key:leftctrl key:leftalt key:l \
        --output

This is analogous to the example "Toggle events between two virtual devices" in the README, except instead of using domains to decide whether a given --output arguments accepts given events, they are used to decide whether certain maps apply to given events.


In case somebody else reads this issue: if you absolutely must run two instances of evsieve on the same input device, and you must grab that input device, I think the best solution would be to run a third instance which duplicates that input device to two virtual devices:

evsieve --input /dev/input/by-id/keyboard grab \
        --map "" @out-1 @out-2 \
        --output @out-1 create-link=/dev/input/by-id/virtual-keyboard-1 \
        --output @out-2 create-link=/dev/input/by-id/virtual-keyboard-2

You can then pass /dev/input/by-id/virtual-keyboard-1 to your first instance and /dev/input/by-id/virtual-keyboard-2 to your second instance.

from evsieve.

KarsMulder avatar KarsMulder commented on June 12, 2024 1

I added an example "Change how keys are mapped at runtime" to the README.

from evsieve.

positiveway avatar positiveway commented on June 12, 2024

Thank you so much for the "toggle" example! That is exactly what I was looking for.

from evsieve.

positiveway avatar positiveway commented on June 12, 2024

I think the example with multiple layouts should be added to readme. It would be helpful for many cases.

from evsieve.

Related Issues (20)

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.