1

While Lenovo does install some of the nicest keyboards on their ThinkPad line, I am forever frustrated by the placement of the Home and End keys. They're too far from the main keys to be useful. What I would like to do is replicate the + for "Home" and + for "End" that is found in macOS using Ctrl+ and Ctrl+ respectively.

I have tried to make the change via Gnome Tweaks to no avail, and xdotool has also proven to be a dead-end with this particular task because it doesn't work in the applications that I use on a day to day basis. This keyboard shortcut must work in the following applications:

  • Sublime Text
  • Firefox / Edge / Chrome (one or more)

And bonus points if it works in:

  • Sublime Merge
  • TablePlus

While this would be awesome in Terminal, particularly when using vi, I don't expect these shortcuts to be used there.

Has anyone found a way to properly map keyboard shortcuts to Home and End?

Additional Info:

  Detail
OS Ubuntu Desktop 20.04.1 LTS
Systems Lenovo ThinkPad X1 Carbon (2017)
Lenovo ThinkPad W541
Dell XPS 13 (2016)

1 Answer 1

0

Solution found in the form of AutoKey!

This can be installed from a .deb package or via pip3. I opted for the latter:

$ sudo pip3 install git+https://github.com/autokey/autokey

Once installed, it can be started like so:

$ autokey-gtk &

Note: This application also has a QT build, which works for people using KDE Plasma, Lumina, etc.

Configuration

Once AutoKey is installed, there will be a character indicator in the corner:

AutoKey Indicator

Choose "Show Main Window" to bring up the UI:

AutoKey UI

To send key commands, a new script needs to be created. This can be done by clicking the triangle beside "New", then choosing "Script". Enter any name you wish then, in the large textbox to the right, paste one of the following commands:

Action Command
Jump to beginning of current line keyboard.send_key("<home>")
Jump to end of current line keyboard.send_key("<end>")

Next, let's set the key combination by clicking on the [Set] button next to "Hotkey":

AutoKey | Set Hotkey

This process is a little finicky, but it's possible to set Ctrl+{arrow} by doing this:

  1. Click "Press to Set"
  2. Press the arrow (or regular) key you wish to use (NOT a combination, but just the arrow or regular key)
  3. Click the "Control" button
  4. Click "OK"

This takes effect immediately and can be tested in just about any UI application. I have confirmed it works in:

  • Sublime Text & Sublime Merge
  • Firefox, Chrome, & Edge
  • TablePlus
  • Calibre
  • vi and nano
  • gEdit

Your Answer

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