DEV Community

sa3i0l
sa3i0l

Posted on

Move mouse with shift + ctrl + hjkl

Ctrl + Shift + hjkl - Move mouse pointer

Ctrl + Shift + Enter - Mouse left click

Example:

Ctrl + Shift + h - left

Ctrl + Shift + j - down

Ctrl + Shift + k - up

Ctrl + Shift + l - right

Linux

Remap the XFCE keyboard to move the mouse with Ctrl + Shift + hjkl, use the xbindkeys and xdotool utilities.

1. Install xbindkeys and xdotool

2. Create a configuration file for xbindkeys by running the following command in the terminal:

xbindkeys --defaults > ~/.xbindkeysrc
Enter fullscreen mode Exit fullscreen mode

3. Edit the ~/.xbindkeysrc file using your preferred text editor and add the following lines:

# Move mouse up with Ctrl + Shift + k
"xdotool mousemove_relative -- 0 -10"
    Control+Shift+k

# Move mouse down with Ctrl + Shift + j
"xdotool mousemove_relative -- 0 10"
    Control+Shift+j

# Move mouse left with Ctrl + Shift + h
"xdotool mousemove_relative -- -10 0"
    Control+Shift+h

# Move mouse right with Ctrl + Shift + l
"xdotool mousemove_relative -- 10 0"
    Control+Shift+l

"xdotool click 1"
  Shift+Control+Return
Enter fullscreen mode Exit fullscreen mode

4. Start xbindkeys by running the following command in the terminal

make xbindkeys run on startup in xfce

1. Open the XFCE Application Menu and go to "Settings" > "Session and Startup".

2. Click on the "Application Autostart" tab.

3. Click on the "Add" button to add a new startup item.

4. In the "Add Application" dialog, enter the following information:

• Name: xbindkeys

• Command: xbindkeys

• Click on the "OK" button to save the new startup item.

• Close the Session and Startup settings window.

----------------------------------------------------------------

Windows

AutoHotKey install program

create new script

#NoEnv
SendMode Input

; Remap Shift+Ctrl+hjkl keys to mouse movements
+^h::MouseMove, -10, 0, 0, R
+^j::MouseMove, 0, 10, 0, R
+^k::MouseMove, 0, -10, 0, R
+^l::MouseMove, 10, 0, 0, R

; Mouse click with Shift+Ctrl+Enter
+^Enter::Click
Enter fullscreen mode Exit fullscreen mode

run on startup

Place a shortcut to the script in the Startup folder

1. Find the script file, select it, and press Ctrl+C.

2. Press Win+R to open the Run dialog, then enter shell:startup and click OK or Enter. This will open the Startup folder for the current user. To instead open the folder for all users, enter shell:common startup (however, in that case you must be an administrator to proceed).

3. Right click inside the window, and click "Paste Shortcut". The shortcut to the script should now be in the Startup folder.

Top comments (0)