Carnac by Code52 – unusual way to expose the shortcuts

Carnac by Code52

A while ago I was talking at Southampton and Reading user group about Azure Data Studio shortcuts. I thought it would be a good idea to add the keystrokes I am pressing on the screen while I am presenting.

Code52

After a short search, I found the tool I really liked. It is called Carnac and was developed by Code52.org. Unfortunately looks like the Code52 project is inactive now, but seemed like a great idea. Their goal was:

a new coding project every week

http://code52.org/

Anyway, have a look at some of their other projects as well.

Carnac

Back to the Carnac. Although the parent organisation is “dead” for the past few years, the tool itself has been updated less than a year from now. The source code is on GitHub if you need more details.

Carnac on Chocolatey

Install Carnac with Chocolatey

One way to get Carnac is to download the tool from the GitHub repository, however, I decided to install it with Chocolatey (read more about Chocolatey) as it was simple enough.

choco install carnac

<#
Installing the following packages:
carnac
By installing you accept licenses for the packages.

Progress: Downloading carnac 2.3.13... 16%
Progress: Downloading carnac 2.3.13... 49%
Progress: Downloading carnac 2.3.13... 82%
Progress: Downloading carnac 2.3.13... 100%

carnac v2.3.13 [Approved]
carnac package files install completed. Performing other installation steps.
Downloading carnac 
  from 'https://github.com/Code52/carnac/releases/download/2.3.13/carnac.2.3.13.zip'

Installing carnac...
carnac has been installed.
  carnac can be automatically uninstalled.
 The install of carnac was successful.
#>

Once the installation is complete we will see its icon (bottom-left corner)

Carnac icon

Now you should be ready to play with it. If it does not show up try CTRL+ALT+P to enable the app.

Carnac app settings

Click on it and open the app interface. You can see three menu options: General, Appearance and About. On the first screen, we can decide where to locate the shortcuts – a tiny square with four bars in it (in my example it is at the bottom of the monitor #1).

Carnac settings: General

The next screen is Appearance.

Carnac settings: Appearance

On that screen, we have more flexibility and control over the final result. Most of the options are pretty clear, however, I want to get your attention on the last 5 options:

Shortcuts Only

That says it will show shortcuts listed in the keymaps folder. To find the folder I had to look where the shortcuts (sic!) lead me. From the Start menu pick Open file location

Once in the folder, try it again:

and here we are:

If you know a quicker way, please let me know 😉

Finally, we have a few folders. The one starting with an app* contains the Keymaps folder with the *.yml config files for each application.

Carnac: Keymaps folder

Here is the sample content of chrome.yml

group: google-chrome
process: chrome

# Reference: https://support.google.com/chrome/answer/157179?hl=en

shortcuts:
  # Tab and window shortcuts
  - name: Open a new window
    keys:
      - Ctrl+n
  - name: Open a new window in Incognito mode
    keys:
      - Ctrl+Shift+n
  - name: Open a new tab, and jump to it
    keys:
      - Ctrl+t
  - name: Reopen the last closed tab, and jump to it
    keys:
      - Ctrl+Shift+t
  - name: Jump to the next open tab
    keys:
      - Ctrl+Tab
      - Ctrl+PageDown

Now, look what happens if I use one of the shortcuts listed there. Shows me the shortcut and the description.

Carnac: shortcuts with custom description

Now, I may want to use a different browser, for example, Opera. There is no XML file for opera. The next step would be to create it and call it opera.yml. To do so, I had to find out the name of the process and put it into the group (for some reason the process did not work for me).

group: opera
process: 

shortcuts:
  # Tab and window shortcuts
  - name: Mikey wants a new window
    keys:
      - Ctrl+t

In order to make the change, we need to restart Carnac. Now go to Opera and hit your favourite shortcut (mine is to open a new tab Ctrl+T) and see a custom message that was not available before. Neat.

Carnac: shortcut and name for a custom application

Only Keys with Modifiers

This option will reduce the number of pop-ups on the screen to only these shortcuts that have ctrl, alt, shift, or win keys. That means you won’t see arrows or escape or single tabs.

Show space as

It means that the space will looks like one of these:

Show Application icon

Turn that option on to see an icon next to the shortcut. I have it on, so you could see Opera or Chrome logos, but if you disable that you will see shortcuts only.

Process Filter

This feature seems to not working properly for me. It kind of works on the first shortcut after changing the setting, but then it does not. It was raised as an issue in an earlier version, but it seems to be a case in 2.3.13 as well. Let me know if you figure it out.

Summary

This little app is so helpful and, despite its flaws with some configuration, it does what it is expected to do.

Thank you,
Mikey

Leave a Reply

%d bloggers like this: