Score:0

Program mouse's drag and drop to a keyboard key

bq flag

I'm trying to program with xbindkeys and xdotool one of my keyboard keys (key 1, the one that types 1 and !) to act like a mouse's left button, so that I can click, drag and drop, and so on. The following code did the trick:

# inside ~/.xbindkeysrc
"xdotool mousedown 1"
    1
"xdotool mouseup 1"
    1 + Release

The only problem is that, during holding the 1 key down and dragging the mouse, the release command activates even without releasing the key. So while I'm dragging something, it's dropped midway unintentionally. Is there a workaround this problem? Or is it that my keyboard key is faulty?

Edit

I was trying to suppress these false key releases by programming the 1 key to do something like this when pressed:

state = True
while state; do
    if [button released]; then
        add to counter or calculate time between last release
    if [count or time exceed limit]; then
        state = False
    fi
done

But I found a solution to my problem, with xmodmap's command:

xmodmap -e "keycode 10 = Pointer_Button1

I can click, select and drag. I am happy enough with this solution and quit on trying to implement the code above.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.