However, I would prefer to have single-letter shortcuts, like the built-in ones such as + for zooming in. I checked the graphics-kbd.scm file and found that the built-in shortcuts are defined within the (:mode in-active-graphics?) mode. However, my custom single-letter shortcuts don’t work in either the in-graphics or in-active-graphics mode.
Did you put the definition in my-init-texmacs.scm? If yes, did you put it inside a (delayed (lazy-keyboard-force) ..... )? There already seems to be a graphics shortcut bound to c, so you need to make sure your code runs after that definition.
Yes, I did that. The tricky problem is the shortcuts with modifiers works, e.g. M-c, but c does not work. I don’t think c is already taken. I tried others, they don’t work neither. However, the shortcuts such as 1, 2 etc. in the system file works.
So, it seems that graphics shortcuts are intercepted, by the overloaded function keyboard-press in graphics-kbd.scm (I don’t know why). There, only keys that are in graphics-keys are passed through.
Redefining “c” worked for me because the “c” shortcut was already defined in my version, but it only appeared recently and may not yet be in the version you are using.
Then I tried defining new graphics shortcuts. This seems to work in the latest git (if you also redefine graphics-keys to add the new key). In v2.1.2 this seems to crash TeXmacs, though.
A problem here is that you give two commands to the shortcut (one for color, one for opacity). Try bundling them together in one command as (begin (graphics-set-color "red") (graphics-set-opacity "100%")).
In fact, the shortcut works if 1 is replaced by, e.g. M-1, even without begin. It seems multiple commands are automatically concatenated. Other working examples are