3

If so, how? I'm using Raspbian Stretch. I looked in the Openbox config manager and keyboard and mouse configuration. I would like to move the pointer without a mouse using the arrow keys.

5

This command lets you control the mouse with the numpad, so not exactly what you asked for, but with this you do not need to install anything or edit any files:

setxkbmap -option keypad:pointerkeys 

Press CTRL + SHIFT + NUMLOCK to activate.

From: http://en.linuxreviews.org/HOWTO_use_the_numeric_keyboard_keys_as_mouse_in_XOrg

2

I Don't really know whats your intent if you want to start a program or something you can use key shortcuts

  • [Ctrl] [Esc] - Will bring up the start menu where you can select and
  • [Alt] [F2] - Will start a run command box.
  • [ESC] to exit
  • [Alt] [F4] -Terminate running application(s) beginning with most recent.
  • [Ctrl] [Alt] [Delete] - Bring up task manager

Or you can use the xwit library

 sudo apt-get install xwit xdotool

Now Ctrl+Alt+Keypad buttons moves the cursor.

Or you can use this script by editing this file

~/.config/openbox/lxde-rc.xml

and placing the following into the <keyboard> tag:

<!-- Controlando o MOUSE via LXDE com XWIT -->
  <!-- Keybinding for MOUSE CONTROL RIGHT DOWN-->
  <keybind key="C-A-KP_3">
   <action name="Execute">
         <command>xwit -root -rwarp 5 5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL RIGHT UP-->
  <keybind key="C-A-KP_9">
   <action name="Execute">
         <command>xwit -root -rwarp 5 -5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL LEFT DOWN-->
  <keybind key="C-A-KP_1">
   <action name="Execute">
         <command>xwit -root -rwarp -5 5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL LEFT UP-->
  <keybind key="C-A-KP_7">
   <action name="Execute">
         <command>xwit -root -rwarp -5 -5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL LEFT-->
  <keybind key="C-A-KP_4">
   <action name="Execute">
         <command>xwit -root -rwarp -5 0</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL RIGHT-->
  <keybind key="C-A-KP_6">
   <action name="Execute">
         <command>xwit -root -rwarp 5 0</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL UP-->
  <keybind key="C-A-KP_8">
   <action name="Execute">
         <command>xwit -root -rwarp 0 -5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL DOWN-->

  <keybind key="C-A-KP_2">
   <action name="Execute">
            <command>xwit -root -rwarp 0 5</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL DOWN FAST-->

  <keybind key="S-C-A-KP_2">
   <action name="Execute">
            <command>xwit -root -rwarp 0 25</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL RIGHT CLICK-->
  <keybind key="C-A-KP_0">
   <action name="Execute">
         <command>xdotool click 3</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL MIDLE CLICK-->
  <keybind key="C-A-KP_Decimal">
   <action name="Execute">
         <command>xdotool click 2</command>
   </action>
  </keybind>

  <!-- Keybinding for MOUSE CONTROL LEFT CLICK-->
  <keybind key="C-A-KP_Enter">
   <action name="Execute">
         <command>xdotool click 1</command>
   </action>
  </keybind>

  <!-- CONROLE DO MOUSE COMUM -->

For the changes to take effect, run

openbox --reconfigure

I hope that's helpful

  • Ah thanks. I will use the keyboard shortcuts. Have a nice day! – Sjors123 Feb 24 '18 at 10:00
0

I know this is a bit old but I am sure this will help somebody. None of the other two posts helped me, at least without modification.

My system is a Rasbian Buster on a Raspberry Pi 4 using an English US keyboard.

So I am using a modification of Tarek's answer. The issue with that answer is that the file that needed edited was not correct. I also thought that I was having issues with the key maps but that turned out to not be the case. Since I had already changed the keys to work without NumLock on I went ahead and left that but also included all the same commands with NumLock so it works both ways.

You will still have to install xwit ad xdotoll.

sudo apt install xwit xdotool

Instead of ~/.config/openbox/lxde-rc.xml I needed to edit ~/.config/openbox/lxde-pi-rc.xml

nano ~/.config/openbox/lxde-pi-rc.xml

If this file does not exist you can copy it from here /etc/xdg/openbox/lxde-pi-rc.xml using this command:

cp /etc/xdg/openbox/lxde-pi-rc.xml ~/.config/openbox/

You may also need to make the ~/.config/openbox directory first using:

mkdir ~/.config/openbox

The following is the XML which you would insert into that file to control the mouse. This will go between <keyboard> and </keyboard>. Preferably at the very end or beginning so its easy to find and definitely not interfering with any other <> </> that is already there. The modifications I made compared to the one posted by Tarek are:

  • I added key maps to use without numlock on.
  • I rearranged the movements to one that made more sense to me.
  • I added a fast version of each movement for while holding shift as recommended by the original author.
  • Last but not least I re-added the original author's credit comment to the end.
 <!-- Control Mouse using Keyboard via XWIT and XDOTOLL -->

   <!-- MOUSE CLICKS WITHOUT NUMLOCK -->

      <!-- Keybinding for MOUSE CONTROL RIGHT CLICK-->
      <keybind key="C-A-KP_Enter">
       <action name="Execute">
             <command>xdotool click 3</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL MIDDLE CLICK-->
      <keybind key="C-A-KP_Delete">
       <action name="Execute">
             <command>xdotool click 2</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT CLICK-->
      <keybind key="C-A-KP_Insert">
       <action name="Execute">
             <command>xdotool click 1</command>
       </action>
      </keybind>

   <!-- MOUSE MOVEMENTS WITHOUT NUMLOCK -->

      <!-- Keybinding for MOUSE CONTROL UP-->
      <keybind key="C-A-KP_Up">
       <action name="Execute">
             <command>xwit -root -rwarp 0 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL DOWN-->

      <keybind key="C-A-KP_Down">
       <action name="Execute">
                <command>xwit -root -rwarp 0 5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT-->
      <keybind key="C-A-KP_Left">
       <action name="Execute">
             <command>xwit -root -rwarp -5 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT UP-->
      <keybind key="C-A-KP_Home">
       <action name="Execute">
             <command>xwit -root -rwarp -5 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT DOWN-->
      <keybind key="C-A-KP_End">
       <action name="Execute">
             <command>xwit -root -rwarp -5 5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT-->
      <keybind key="C-A-KP_Right">
       <action name="Execute">
             <command>xwit -root -rwarp 5 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT UP-->
      <keybind key="C-A-KP_Prior">
       <action name="Execute">
             <command>xwit -root -rwarp 5 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT DOWN-->
      <keybind key="C-A-KP_Next">
       <action name="Execute">
             <command>xwit -root -rwarp 5 5</command>
       </action>
      </keybind>


   <!-- FAST MOUSE MOVEMENTS WITHOUT NUMLOCK -->

      <!-- Keybinding for MOUSE CONTROL UP FAST-->
      <keybind key="S-C-A-KP_Up">
       <action name="Execute">
             <command>xwit -root -rwarp 0 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL DOWN FAST-->

      <keybind key="S-C-A-KP_Down">
       <action name="Execute">
                <command>xwit -root -rwarp 0 25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT FAST-->
      <keybind key="S-C-A-KP_Left">
       <action name="Execute">
             <command>xwit -root -rwarp -25 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT UP FAST-->
      <keybind key="S-C-A-KP_Home">
       <action name="Execute">
             <command>xwit -root -rwarp -25 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT DOWN FAST-->
      <keybind key="S-C-A-KP_End">
       <action name="Execute">
             <command>xwit -root -rwarp -25 25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT FAST-->
      <keybind key="S-C-A-KP_Right">
       <action name="Execute">
             <command>xwit -root -rwarp 25 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT UP FAST-->
      <keybind key="S-C-A-KP_Prior">
       <action name="Execute">
             <command>xwit -root -rwarp 25 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT DOWN FAST-->
      <keybind key="S-C-A-KP_Next">
       <action name="Execute">
             <command>xwit -root -rwarp 25 25</command>
       </action>
      </keybind>


      <!-- MOUSE CLICKS WITH NUMLOCK ON -->

      <!-- Keybinding for MOUSE CONTROL RIGHT CLICK-->
      <keybind key="C-A-KP_Enter">
       <action name="Execute">
             <command>xdotool click 3</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL MIDDLE CLICK-->
      <keybind key="C-A-KP_Decimal">
       <action name="Execute">
             <command>xdotool click 2</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT CLICK-->
      <keybind key="C-A-KP_0">
       <action name="Execute">
             <command>xdotool click 1</command>
       </action>
      </keybind>

   <!-- MOUSE MOVEMENTS WITH NUMLOCK ON -->

      <!-- Keybinding for MOUSE CONTROL UP-->
      <keybind key="C-A-KP_8">
       <action name="Execute">
             <command>xwit -root -rwarp 0 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL DOWN-->

      <keybind key="C-A-KP_2">
       <action name="Execute">
                <command>xwit -root -rwarp 0 5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT-->
      <keybind key="C-A-KP_4">
       <action name="Execute">
             <command>xwit -root -rwarp -5 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT UP-->
      <keybind key="C-A-KP_7">
       <action name="Execute">
             <command>xwit -root -rwarp -5 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT DOWN-->
      <keybind key="C-A-KP_1">
       <action name="Execute">
             <command>xwit -root -rwarp -5 5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT-->
      <keybind key="C-A-KP_6">
       <action name="Execute">
             <command>xwit -root -rwarp 5 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT UP-->
      <keybind key="C-A-KP_9">
       <action name="Execute">
             <command>xwit -root -rwarp 5 -5</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT DOWN-->
      <keybind key="C-A-KP_3">
       <action name="Execute">
             <command>xwit -root -rwarp 5 5</command>
       </action>
      </keybind>


   <!-- Fast Mouse Movements -->

      <!-- Keybinding for MOUSE CONTROL UP FAST-->
      <keybind key="S-C-A-KP_8">
       <action name="Execute">
             <command>xwit -root -rwarp 0 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL DOWN FAST-->

      <keybind key="S-C-A-KP_2">
       <action name="Execute">
                <command>xwit -root -rwarp 0 25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT FAST-->
      <keybind key="S-C-A-KP_4">
       <action name="Execute">
             <command>xwit -root -rwarp -25 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT UP FAST-->
      <keybind key="S-C-A-KP_7">
       <action name="Execute">
             <command>xwit -root -rwarp -25 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL LEFT DOWN FAST-->
      <keybind key="S-C-A-KP_1">
       <action name="Execute">
             <command>xwit -root -rwarp -25 25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT FAST-->
      <keybind key="S-C-A-KP_6">
       <action name="Execute">
             <command>xwit -root -rwarp 25 0</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT UP FAST-->
      <keybind key="S-C-A-KP_9">
       <action name="Execute">
             <command>xwit -root -rwarp 25 -25</command>
       </action>
      </keybind>

      <!-- Keybinding for MOUSE CONTROL RIGHT DOWN FAST-->
      <keybind key="S-C-A-KP_3">
       <action name="Execute">
             <command>xwit -root -rwarp 25 25</command>
       </action>
      </keybind>

    <!--
          Adriano H. Hedler - LXDE Translation to Portuguese-BR Helper
          Accessibility Option on LXDE
          Brasil - Paraná - Curitiba
          Site: www.templosite.com 
    -->

 <!-- End Control Mouse using Keyboard -->

*Note: I put Mouse Right Click in both with and without numlock sections even though KP_Enter is the same for both so that you can copy one whole section if you don't want to use both.

Once you have made this file you will need to either reboot or execute:

openbox --reconfigure

A couple other notes. You can change the speed of the scrolling by changing the values in the xwit command notice the difference between MOUSE UP and MOUSE UP FAST

MOUSE UP:      xwit -root -rwarp 0 -5
MOUSE UP FAST: xwit -root -rwarp 0 -25

Also, if you have a different keyboard layout or for some other reason these key codes are not working for you or you just want to change these controls, you can find out the code for your buttons by executing the command:

xev -event keyboard

The output will look something like this when you press a key:

KeyPress event, serial 25, synthetic NO, window 0x1e00001,
    root 0x369, subw 0x0, time 2252742, (107,658), root:(1462,769),
    state 0x0, keycode 80 (keysym 0xff97, KP_Up), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

You are lookingn for the part on the third line down where it says:

(keysym 0xff97, KP_Up)

Either the 0xff97 or the KP_UP in this example will work in the file.

New contributor
Kenneth Howard is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • I am having an issue where I cannot reliably click the mouse because the system reads another mouse click immediately after. It also seems this method is quite limited in that some things like menus will not allow you to click them using xdotool. Instead you have to navigate them with the keyboard once they are open. You also cannot drag windows with this method. It needs some work but it is better than nothing. – Kenneth Howard Dec 9 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.