Hi, everyone. I’m working on setting up some basic keybindings using xbindkeys and xdotool, but I’m encountering issues. My aim is to eventually remap several keystrokes, but right now I’m testing just two to see if they work. If these work out, I plan to add more. The keybindings I’m focusing on are:
Ctrl+A to move the cursor one word to the left (same as Ctrl + [left arrow])
Ctrl+F to move the cursor one word to the right (same as Ctrl + [right arrow])
I’ve been using these shortcuts in LibreOffice Writer for years via its built-in macros and the Tools ==> Customize ==> Keyboard menu. Now, I’m trying to set this up natively in Linux (Kubuntu 22.04). The reason is that I also use other word processors (like SoftMaker TextMaker and Fade In) and various text editors, so it would be very helpful to have these navigation commands work across all applications.
I followed some online guides and created a configuration file named .xbindkeysrc in my home directory using the command:
xbindkeys --defaults > ~/.xbindkeysrc
I edited this file with my favorite IDE, Geany, and included these keybindings:
# Default keybinding I uncommented
"xbindkeys_show" control+shift + q
Remap Ctrl+A to Ctrl+Left Arrow "xdotool key --clearmodifiers ctrl+Left" control + a
Remap Ctrl+F to Ctrl+Right Arrow "xdotool key --clearmodifiers ctrl+Right" control + f
After saving the file, I executed xbindkeys from the command line. However, when I tested these keybindings in Geany and other text editors or word processors like AbiWord, they did not work. Pressing Ctrl+A or Ctrl+F only caused Geany to blink without performing the expected action. Interestingly, these keybindings also fail in LibreOffice Writer, even though they’ve worked for years via LibreOffice's custom commands. Other custom navigation commands continue to work fine in LibreOffice Writer.
When I terminate xbindkeys with:
pkill xbindkeys
the Ctrl+A and Ctrl+F shortcuts revert to their default functions in LibreOffice Writer, and Geany’s default shortcuts for select all text and find start working again.
The documentation indicates that simply running xbindkeys should automatically use the .xbindkeysrc file from my home directory. To confirm, I tried specifying the configuration file directly with:
xbindkeys -f .xbindkeysrc
but the outcome was the same. I also tried opening .xbindkeysrc with nano and re-saving it to ensure it wasn’t saved incorrectly, but this didn’t fix the issue. My xbindkeys version is:
xbindkeys 1.8.7 by Philippe Brochard
and my xdotool version is:
xdotool version 3.20160805.1
It appears that xbindkeys is running, but the key remaps are not being applied. I have swapped the left Ctrl key and Caps Lock in Kubuntu’s system settings, and I wondered if this might be causing the issue. However, the Ctrl+A and Ctrl+F remappings also don’t work with the right Ctrl key (which I did not alter). I tried adjusting the indentation in the config file for better readability, but this did not resolve the problem.
I also considered that it might be a file permissions issue and used chmod to set various permissions (up to 777 for full access), but this made no difference.
I’m not sure why it’s not working as expected despite following the tutorial steps. Any suggestions or insights would be greatly appreciated. Thanks!
Ctrl+A to move the cursor one word to the left (same as Ctrl + [left arrow])
Ctrl+F to move the cursor one word to the right (same as Ctrl + [right arrow])
I’ve been using these shortcuts in LibreOffice Writer for years via its built-in macros and the Tools ==> Customize ==> Keyboard menu. Now, I’m trying to set this up natively in Linux (Kubuntu 22.04). The reason is that I also use other word processors (like SoftMaker TextMaker and Fade In) and various text editors, so it would be very helpful to have these navigation commands work across all applications.
I followed some online guides and created a configuration file named .xbindkeysrc in my home directory using the command:
xbindkeys --defaults > ~/.xbindkeysrc
I edited this file with my favorite IDE, Geany, and included these keybindings:
# Default keybinding I uncommented
"xbindkeys_show" control+shift + q
Remap Ctrl+A to Ctrl+Left Arrow "xdotool key --clearmodifiers ctrl+Left" control + a
Remap Ctrl+F to Ctrl+Right Arrow "xdotool key --clearmodifiers ctrl+Right" control + f
After saving the file, I executed xbindkeys from the command line. However, when I tested these keybindings in Geany and other text editors or word processors like AbiWord, they did not work. Pressing Ctrl+A or Ctrl+F only caused Geany to blink without performing the expected action. Interestingly, these keybindings also fail in LibreOffice Writer, even though they’ve worked for years via LibreOffice's custom commands. Other custom navigation commands continue to work fine in LibreOffice Writer.
When I terminate xbindkeys with:
pkill xbindkeys
the Ctrl+A and Ctrl+F shortcuts revert to their default functions in LibreOffice Writer, and Geany’s default shortcuts for select all text and find start working again.
The documentation indicates that simply running xbindkeys should automatically use the .xbindkeysrc file from my home directory. To confirm, I tried specifying the configuration file directly with:
xbindkeys -f .xbindkeysrc
but the outcome was the same. I also tried opening .xbindkeysrc with nano and re-saving it to ensure it wasn’t saved incorrectly, but this didn’t fix the issue. My xbindkeys version is:
xbindkeys 1.8.7 by Philippe Brochard
and my xdotool version is:
xdotool version 3.20160805.1
It appears that xbindkeys is running, but the key remaps are not being applied. I have swapped the left Ctrl key and Caps Lock in Kubuntu’s system settings, and I wondered if this might be causing the issue. However, the Ctrl+A and Ctrl+F remappings also don’t work with the right Ctrl key (which I did not alter). I tried adjusting the indentation in the config file for better readability, but this did not resolve the problem.
I also considered that it might be a file permissions issue and used chmod to set various permissions (up to 777 for full access), but this made no difference.
I’m not sure why it’s not working as expected despite following the tutorial steps. Any suggestions or insights would be greatly appreciated. Thanks!