Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Rebinding keys while trackpoint is in use?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Wed Nov 26, 2014 2:26 am    Post subject: Rebinding keys while trackpoint is in use? Reply with quote

// not sure if this is the best forum, so move as needed.

As you may or may not know, it's usually rather easy to disable a notebooks touchpad while textinput is done, so as to not move the cursor/click by accident - usually that is configurable with a custom timeout.

Now I'm wondering, if something similar, but "in reverse" is possible?

Suppose I've got a notebook with a trackpoint (Thinkpads, upper class Toshiba Tecras, ...). Let's say I used the trackpoint in the last 1000 milliseconds, I'd like to use the u,i,j keys as mouse clicks and return them to normal state once a timeout is reached.

Possible and if yes, how or what tools do I need(not running a DE, so some standalone tool would be nice)?
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
SDNick484
Apprentice
Apprentice


Joined: 05 Dec 2005
Posts: 231

PostPosted: Mon Dec 01, 2014 7:40 pm    Post subject: Reply with quote

This is definitely an interesting idea. I don't have a complete solution, but the tools I'd recommend looking at would be:
    1. btnx & btnx-config - a daemon to map keys as mouse input (Note: not in portage, an ebuild is here, but the original developer might not be supporting it)
    2. xev / xmodmap - I believe these come with X windows, should be a low-level way to do the mapping


As for disabling (or rather swapping) for a short duration after the mouse is used, that may be a little trickier. I would imagine you'd need some sort of daemon polling for that although I could very well be wrong. I haven't used btnx myself, but there's a chance it may have that capability. Anyways, good luck, and please do post back if you find a workable solution.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Tue Dec 02, 2014 4:49 pm    Post subject: Reply with quote

Thanks for your input, though I'm a little confused: from what I find googling btnx (original page is down), it seems it's a tool to bind mouse-buttons to key input, while I actually want it the other way around. Didn't have time to try it, yet, though.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
SDNick484
Apprentice
Apprentice


Joined: 05 Dec 2005
Posts: 231

PostPosted: Wed Dec 03, 2014 4:32 am    Post subject: Reply with quote

avx wrote:
Thanks for your input, though I'm a little confused: from what I find googling btnx (original page is down), it seems it's a tool to bind mouse-buttons to key input, while I actually want it the other way around. Didn't have time to try it, yet, though.


I am not a user of btnx, but my understanding is that it's a daemon that sniffs events from the mouse event handler and can send mouse and/or keyboard event based on that. I don't know how flexible it is, but I was thinking you could configure a keyboard event that's a macro to swap the keys to the mouse clicks. I'm not sure if it will work, but probably worth exploring. As for current source, it's now maintained here:
https://github.com/cdobrich/btnx
https://github.com/cdobrich/btnx-config/
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Thu Dec 04, 2014 8:27 am    Post subject: Reply with quote

Just had the idea to leverage `unclutter`, the tiny dameon looking for mouse movement and hiding the cursor when no movement is found for some time.

It's basically ~400 lines of C and looks rather simple, problem is I don't know enough about it to change it to my needs and so far couldn't find a re-implementation in one of my better known languages(also never did much work on the X11 level).
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Thu Dec 04, 2014 2:08 pm    Post subject: Reply with quote

Mh, found that one could run `xinput test-xi2 $ID` (ID as seen by `xinput list`) and it spits out data when the mouse is moved or clicked. That could quite possibly be wrapped up, not sure if that's the easiest or cleanest solution, though.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum