I'm running xfce4 on debian. I'd like to assign keyboard shortcuts for the home and end keys (specifically, to move the cursor to the beginning and end of a line).

In the settings manager there is a gui interface for assigning keyboard shortcuts to commands. However, how could I set a keyboard shortcut (e.g. ctrl+a or ctrl+e) for another key (home or end)?


3 Answers 3


I tried several tools, like xmodmap, xbindkeys and xdotool to assign Ctrl-Left to Home and Ctrl-Right to End.

Problem is: as result, it sends Ctrl-Left-Home and Ctrl-Right-End because keystrike isn't released and nothing works...

I had to create a script with a sleep :

$ cat HomeEnd.sh 
sleep .2
xdotool key ${KEY}

Then I assigned a shorcut with Settings Manager > Keyboard > Application Shortcuts or with command line :

$  xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Ctrl>Left" -s "${HOME}/bin/HomeEnd.sh Home" -n -t string
$  xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Ctrl>Right" -s "${HOME}/bin/HomeEnd.sh End" -n -t string

Now It works, I just have to strike Ctrl-Left or Ctrl-Right and release the keys.


The easiest way to do that now is using AutoKey:


To invoke a sequence of keypresses, you create a new script:


and assign it to a hotkey.


This could be an answer, but the intention was to provide useful hints.

If I read correctly, you are trying to bind a single key to several keys presses. The given example is to remap End to Ctrl+E (this may be easier to understand).

xmodmap and xbindkeys

The classic approach is to check your keycode using xev and use X tool like xmodmap to remap the keys, as explained in this answer on askubuntu.com. But this doesn't allow you to remap several keys, mentioned in the answer for this question.

The other approach is to use xbindkeys to grab the keys and xvkbd to send keys, whose answer was given to this post. However, this approach also has its own caveat which cause focus to lose, as mentioned by someone in the comment.

Actually, there is similar question being asked, to remap several key presses to another several key presses (which is one level harder than your request). Unfortunately, the answer has clearly mentioned that you can't achieve that with xmodmap and suggesting to use xbindkeys instead.

Alternative: xdotool

Some time ago, I was still using a two-button mouse (I know, quite old piece of hardware) and trying to emulate the mouse middle-click. Then, I discovered xdotool which was able to emulate mouse clicks, as well as keyboard key presses.

My suggestion is, use xdotool to emulate keyboard key press for End (this will give you a string of command). Then use this command to assign a custom shorcut Ctrl+E in Xfce4, which is found under Settings Manager > Keyboard > Application Shortcuts.

To build the command using xdotool, you can refer to several examples of which one of them is quoted as follows.

Example: focus the firefox url bar

WID=`xdotool search "Mozilla Firefox" | head -1`
xdotool windowactivate --sync $WID
xdotool key --clearmodifiers ctrl+l

# As of version 2.20100623, you can do this simpler version of above:
xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+l

I haven't used this tool for some time, so I can't give exact answer to your question. In my opinion, using xdotool with Xfce4 Application Shortcuts is the best solution you can try on Debian Xfce.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .