Comments (11)
/dev/input/event/1
doesn't sound like a file that should exist. It should be /dev/input/event1
!
from evscript.
Thanks a lot for the fast reply.
Oh god, don't know how I mistyped that.. Thanks a lot.
But now, always with the same file, i get an error:
❯ evscript -f .evscript_temp.dyon -d /dev/input/event4
--- ERROR ---
In `.evscript_temp.dyon`: Type mismatch (#200): Expected `[]`, found `{}` 9,19: for i len(evts) { 9,19: ^
from evscript.
Well that's an error from dyon interpreting your file. Have you tried the code from the readme?
from evscript.
Yeah, it the exact copy and paste.
Here is it's content..
//! [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()]) } } }
Also, as we are here.. I have a little question. I see from the examples that if I want to map a key to a sequence of action I can just do something like
xcape(mut should_lshift, evt, KEY_LEFTSHIFT(), [KEY_LEFTSHIFT(), KEY_9()])
But is it also true the other way around, like this?
xcape(mut should_esc, evt, [KEY_CAPSLOCK(), KEY_N()], [KEY_H()])
Because I am using Colemak, and as I am used to vim binds, I would like to place the fingers in the same position for moving just with a remap. Precisely keeping pressed CAPS and pressing the keys that should correspond to the movement using QWERTY.
from evscript.
Oh, hi! I had the same problem, Expected [], found {} 9,19: for i len(evts)
. It seems that the iteration syntax in the readme is not correct. I think you can fix it by changing for i len(evts) { ... }
to for i { ... }
as explained in Inferring range by indexing. I know it looks weird to write a for loop without declaring the range to iterate over. It seems that Dyon can see that i
is used as an index into evts
, and infers that it should iterate over every index of evts
.
from evscript.
Uh, thanks also to you for the fast reply.
It now runs without any "ERROR".
But still doesn't do what the example script should do.
Precisely.. If I press "left shift", it writes an open round bracket "(". The "right shift" writes a closed round bracket ")". And when pressing the "caps".. Yeah it act as and "ESC", but it also switch case, so it act as both. Don't know what is going on. If you can help me that would be great.
Back to my previous question, the syntax I used to associate two keys to one doesn't work. I get this error:
❯ evscript -f .evscript_layout.dyon -d /dev/input/event4
--- ERROR --- In `.evscript_layout.dyon`:
Type mismatch (#200): Expected `f64`, found `[]` 9,40: xcape(mut should_esc, evt, [KEY_ESC(), KEY_N()], [KEY_H()]) 9,40:
Hope there is a way to make also it working
from evscript.
as explained in Inferring range by indexing
But the first loop there says for i len(list)
. This has always worked, at least with the version of dyon that's saved in Cargo.lock
here. You didn't cargo update
by any chance?
when pressing the "caps".. Yeah it act as and "ESC", but it also switch case, so it act as both
This is intended for use with the ctrl:nocaps
xkb option, i.e. when you press on its own, it's Esc, and when you hold, it's Ctrl.
Hope there is a way to make also it working
Yes: write your own logic instead of my xcape
.
Also, if you remap Caps Lock to Ctrl, these keys would just be normal Ctrl-Something that you can handle in vim.
from evscript.
Thanks again for the reply.
Later I'll check the cargo version.
Could you elaborate on what I should do to map two combined keys to one? I don't know how I should modify the codeline that I wrote before.
This is the variable declaration
should_esc := false
and this the "xcape inside the for loop"
xcape(mut should_esc, evt, [KEY_ESC(), KEY_N()], [KEY_H()])
What do you mean by "write your own logic"?
from evscript.
I mean xcape
is not special magic, it's a function I wrote to do what it does, you can't use it for this purpose, instead you have to study how it works in stdlib.dyon
and write your own function that does what you want.
from evscript.
Oh now I see what you mean.
The problem is that I completely don't know Rust.
So I really can't make it.
If you have some spare time and will to implement this, I think it would be helpful to more than just me.
Thanks anyway for the help!
from evscript.
(FYI, stdlib.dyon
is written Dyon, not Rust.)
from evscript.
Related Issues (12)
- Cargo.Lock invalid? HOT 2
- Multiple keys remapings - How to contribute HOT 4
- Possible security improvements HOT 2
- Add Hyper_L, Hyper_R and Mode_switch keys to the stdlib HOT 4
- rusty-sandbox moved to crates.io HOT 2
- example not like xcape HOT 3
- [request] add a SpaceFN function to your stdlib.dyon? HOT 3
- thread 'main' panicked at 'ioctl: Sys(EINVAL)' HOT 12
- doesnt compile with openssl 1.1.1 HOT 2
- Remap helper(?) HOT 3
- The main example doesn't work HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evscript.