How Key Promoter became Key Promoter X

10 minute read

Key Promoter X

This is the story of how the Key Promoter X was born, a small plugin for IntelliJ IDEA that helps you to learn shortcuts from mouse clicks. If you like to try it out, you can install it directly through IDEA by going to Settings, Plugins, Browse repository. The documentation can be found here and if you have any questions, please don’t hesitate to ask on Gitter.

Some history of the Key Promoter

One of the first things you hear from experienced IDEA users is that you should throw your mouse in the trash. As hard as it at first seems, IntelliJ IDEA is tailored to keep your hands on the keyboard and off the mouse. Nevertheless, especially new users find it hard to do this right from the start and the reason is simple: you need to remember a lot of shortcuts and consulting the KeyMap Reference every time is annoying.

Someone then had a great idea. Why not giving the user a popup-tip every time he clicks something inside IDEA that could have been done with a key combination? That someone was Dmitry Kashin and although I can only try to reconstruct the events, I believe he implemented the original Key Promoter plugin for one of the plugin-contests that were still held by IntelliJ back in 2006.

As small and simple this plugin was as popular it became in the community. And by popular I mean about 250.000-downloads-popular. Unfortunately, in 2012 Dmitry stopped working on the plugin and even with the awesome IntelliJ plugin API we have, a plugin does not survive several years without updates. The community was left with a Key Promoter that did not work on recent IntelliJ versions.

Another user stepped in and forked the original code. His name is unknown to me but he runs under the GitHub profile athiele. He fixed the code and implemented an additional tool-window where you could see how often you missed a particular shortcut. In Januar 2017 I helped someone who asked why the original Key Promoter is broken and I pointed him to the fork. Since then I had an eye on the issue list of the fork and especially I got notified on this one specific issue that suggested to make the fork available through the Jetbrains plugin repository.

For unknown reasons athiele stopped to respond to issues at the end of 2016 and we were again in the same situation of having no maintainer. I kind of forgot about it until on the 20th of June someone again commented how nice it would be to have this in the official Jetbrains repository. It was time for someone to step in and I took a night to look through the code to see how much work it would be. The next day my decision was made and I commented

I copied the repository, fixed the Gradle build and carefully added credits to everyone involved. I wrote a mail to Jetbains if it is possible to take over the original Plugin so that we don’t have two plugins showing up in the IDEA plugin list.

If this is OK with everyone, I would step up and maintain this nice plugin. I’m not sure how much time I can spend on it, but I’m active and available in the foreseeable future. I can merge pull requests and since the code base is not large, I’m sure we can fix some bugs.

The birth of Key Promoter X

While I was waiting for the response of Jetbrains, I took a closer look on the internals of the plugin. There were several things I would have handled differently. One of my biggest concerns were the big shortcut popups. I have to admit that I was a bit afraid if it was possible to make it bullet-proof for all systems. The reason was that those popups were nothing IntelliJ supported out of the box. They were AWT overlays hardly drawn over IDEA with a timer running in the background to make them vanish after a certain amount of time. This did not work in all circumstances. Especially, when you clicked a button that opened a modal dialog the shortcut popup would not disappear.

Another thing was how the shortcut was extracted from the mouse click. I figured that this could be another source of pain in the future as it was done by inspecting the pure mouse event and trying to find out which button was pressed and what IDEA action it invoked by it.

I sat down and thought about how in my opinion such a plugin should work if I had to write it nowadays:

  1. It should be non-intrusive. It should help me but it should not interfere with my work. That instantly ruled out popup overlays that block my view and in the worst case stick on the screen.
  2. I never want to see any dialogs that I have to confirm or cancel. I want to be able to act on suggestions (like “create shortcut”) but only if I want to.
  3. It should of course catch as many buttons as possible
  4. It should integrate well into IDEA and if this means I have to pay the prize of abandoning awesome looking popups, so be it.

I felt that these changes were too crucial to be implemented in the original Key Promoter. I did not want to push users away by turning their beloved plugin upside down just because I felt it was the right thing to do.

With this in mind, I created a new branch, sat down and rewrote most of the plugin. I used IDEA’s AnActionListener interface to catch most mouse actions and only reverted to inspecting AWT events in emergency cases. I implemented all notifications using IDEA’s built-in framework with click-able links to hide certain popups or to create shortcuts. I rewrote the rendering of the statistics list to contain icons and styled text and, of course, automatic refreshing.

When I published it as Key Promoter X and got instantly positive feedback, suggestions for further features and bug-reports. Now, after only some weeks the download counter almost reaches 5000 and I’m very happy that people seem to like it.

Here some links for your convenience:

Leave a Comment

Loading Google+ Comments ...