Code Monkey home page Code Monkey logo

evscript's Introduction

evscript's People

Contributors

valpackett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

evscript's Issues

Multiple keys remapings - How to contribute

Hi, I would like to help with the feature to allow multiple keys remappings like <super>c to <ctrl>c or <alt>Left to <ctrl>Left, those are impossible to remap under Wayland with xkb. Do you think this is possible with evscript and what is the approach for this?

thread 'main' panicked at 'ioctl: Sys(EINVAL)'

Hi! Not sure if I'm doing something wrong here, as I'm not too versed in ioctl in general.

I built evscript and installed it using the instructions in the README in this repo, but running it seems to give me a panic. I'm using the stock xcape-like config that was provided in the README as well.

% cat ~/better_xcape.dyon 
//! [events]
//! keys = ['ESC', 'LEFTSHIFT', '9', '0']
fn main() ~ evdevs, uinput {
    should_esc := false
    should_lshift := false
    should_rshift := false
    loop {
        evts := next_events(evdevs)
        for i len(evts) {
            evt := evts[i]
            xcape(mut should_esc, evt, KEY_CAPSLOCK(), [KEY_ESC()])
            xcape(mut should_lshift, evt, KEY_LEFTSHIFT(), [KEY_LEFTSHIFT(), KEY_9()])
            xcape(mut should_rshift, evt, KEY_RIGHTSHIFT(), [KEY_LEFTSHIFT(), KEY_0()])
        }
    }
}


% RUST_BACKTRACE=1 evscript -f ~/better_xcape.dyon -d /dev/input/event3
thread 'main' panicked at 'ioctl: Sys(EINVAL)', src/libcore/result.rs:916:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: __libc_start_main
  17: <unknown>

Would love to contribute but I'm not sure where to start trying to diagnose this. I see that EINVAL means that one of the parameters to the ioctl function was invalid but I'm not sure where to go from there.

Possible security improvements

Although I see you've done an impressive job containing this program, I think it's possible to do even better, at least, on Linux. Instead of setuid root, perhaps setgid input for handling /dev/input/*? As for /dev/uinput, I'm not sure - this article adds a new group uinput as well as udev rules, but I don't think you can setgid a program for multiple groups, correct? I don't think assigning /dev/uinput to group input would be the best choice - isn't it for reading from input devices, and not writing?

Any thoughts?

example not like xcape

Hi,

Just ran the example, but I can't really get it to work, if I tap caps it does indeed send escape, but it also lights up and then works as a caps lock key. If I use it on left_ctrl it doesn't work. Should it work like xcape ? (havn't used it in a while, before i was using caps2esc on linux).

Remap helper(?)

Thanks for your solution, the xcape functionality works like a charm.

I am generally not too much into uinput in general, but would it be completely infeasible to implement an ability to remap keys?

Despite not being a rust nor dyon expert, I can kinda get a sense for conditionally emiting key presses and release. But is it infeasible to intercept uinput and modify it? (required for remapping)

Cargo.Lock invalid?

I wanted to package evscript for NixOS, but it seems as cargo vendor failes with:

error: failed to sync

Caused by:
  found duplicate version of package `libc v0.2.34` vendored from two sources:

	source 1: https://github.com/rust-lang/libc#7c1297c9
	source 2: registry https://github.com/rust-lang/crates.io-index

Unfortunately, I'm no Rust user myself, and so I wondered whether you could maybe update the Cargo.Lock for me, please? NixOS requires a valid Cargo.Lock as otherwise it could not guarantee the required reproducibility of a build.

doesnt compile with openssl 1.1.1

sfackler/rust-openssl#987

stCarolas ~/evscript
% cargo build --release

   Compiling openssl v0.9.24                                                                                                                      
   Compiling serde_urlencoded v0.4.3                                                                                                              
   Compiling hyper v0.10.13                                                                                                                       
   Compiling num v0.1.42                                                                                                                          
error: failed to run custom build command for `openssl v0.9.24`                                                                                   
process didn't exit successfully: `/home/stCarolas/evscript/target/release/build/openssl-06a9c873cac216a9/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/stCarolas/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed                                                                                                                               
                                                                                                                                                  
(101) stCarolas ~/evscript
% openssl version
OpenSSL 1.1.1 FIPS  11 Sep 2018

openssl-devel is also installed

Error running?

Hi.
I just discovered this project and it sounds extremely promising.
However, I really can't make it run.
I copied the example in the README in a file named "test".
This is what it outputs
❯ evscript -f test -d /dev/input/event/1 thread 'main' panicked at 'evdev open(): Sys(ENOENT)', src/libcore/result.rs:1165:5 note: run with RUST_BACKTRACE=1environment variable to display a backtrace.

If I try with using RUST_BACKTRACE=full

❯ export RUST_BACKTRACE=full
❯ evscript -f test -d /dev/input/event/1 thread 'main' panicked at 'evdev open(): Sys(ENOENT)', src/libcore/result.rs:1165:5 stack backtrace: 0: 0x55e84acbccb4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4c5e39dd6bf38933 1: 0x55e84acd9b5c - core::fmt::write::h94b22f3cbda6422c 2: 0x55e84acbaa97 - std::io::Write::write_fmt::he7e02466cb3dc860 3: 0x55e84acbf1de - std::panicking::default_hook::{{closure}}::h077f2d0f0f4550db 4: 0x55e84acbeed1 - std::panicking::default_hook::hcc1ceebfaf9d0a58 5: 0x55e84acbf8db - std::panicking::rust_panic_with_hook::h328d8e7ed959397b 6: 0x55e84acbf47e - std::panicking::continue_panic_fmt::h745b12464b662c8f 7: 0x55e84acbf366 - rust_begin_unwind 8: 0x55e84acd5b8e - core::panicking::panic_fmt::hdb91b8826feb6fc9 9: 0x55e84acd5c87 - core::result::unwrap_failed::haba3c6d5a6de1991 10: 0x55e84aaf6678 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h55f5e3626a98043f 11: 0x55e84aafb546 - evscript::main::h56bd2ac18487527c 12: 0x55e84ab04863 - std::rt::lang_start::{{closure}}::h869c81dbafb8a017 13: 0x55e84acbf303 - std::panicking::try::do_call::h81508b6a18a6e157 14: 0x55e84acc1dea - __rust_maybe_catch_panic 15: 0x55e84acbfdbd - std::rt::lang_start_internal::hfccf8c6e859ea61a 16: 0x55e84aaffdb2 - main 17: 0x7f7aac4e0153 - __libc_start_main 18: 0x55e84aad70ae - _start 19: 0x0 - <unknown>

I am on wayland, precisely sway. Don't really know what I should do. Can you help me? Thanks

The main example doesn't work

Doing everything using documentation I have this error:

Ξ ~/evscript git:(master) ▶ evscript -f ev.dyon -d /dev/input/event19

--- ERROR ---
In ev.dyon:

Type mismatch (#200):
Expected [], found {}
9,19: for i len(evts) {
9,19: ^

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.