MacOS Secret Agent with Different Language Keyboards

Hello - I am having a bit of a problem with secret agent and keyboard drivers, or keyboard layouts.

After using an Intel macbook pro for 6 yrs, I upgraded to an M3 model a few days ago, and am using Codebook Version 5.0.0 (4194). The laptop has a Japanese-layout keyboard, and I use a UHK external keyboard with an English layout as my daily driver. The keyboard drivers appear to be installed correctly, and I can type as expected on each keyboard. There are a couple differences, such as:

  • Built in Japanese keyboard: shift 2 is ", shift 7 is '.
  • External English keyboard: shift 2 is @, shift 7 is &.
    (there’s a few more but it’s harder to describe)

… and (edit:) I just have to remember those when I type on either keyb, but it’s not a problem for regular use.

I noticed that certain passwords were getting kicked back, so after some head scratching I tested pasting into a text file via secret agent, and via copy paste from Codebook directly, comparing to the actual inputted password stored in Codebook, then noticed that secret agent wasn’t always entering it correctly.

More specifically, what I observed:
Given a stored password of, say, gin&Tonic27, when I use secret agent on that password’s record, the output is gin'Tonic27, where the ampersand is getting replaced by the single quote. Of course this is incorrect so I get an error that the password is incorrect. I guess that implies that for the ampersand, Codebook is entering shift 7, but the Japanese keyboard is getting in the way and entering the single quote.

So I confirmed the drivers for each keyboard, and tried disabling and re-enabling secret agent, but so far no difference. (I selected the scripts folder as usual, when I newly installed Codebook. When I re-enabled secret agent, it did NOT ask me to re-specify the scripts folder.)

There’s another wrinkle. I’m using Japanese language input, which has “modes” - Japanese ones and English. I’m used to switching to English before I use secret agent, because having it switched to Japanese sometimes results in incorrect characters being input. The input software sometimes sees some combination as Japanese, and will input an equivalent-looking but different character, which also results in an error. To avoid it I always tap the “English” toggle before using secret agent. I assume Chinese or Korean users would have the same issue here, so I think this is a bit of a red herring that we can just ignore.

Finally and maybe more maddeningly, when I set the system up a couple days ago so I remember: when I connected the external UHK keyboard, it does that popup test where a wizard asks you to press the key to the right of the left shift, and the key to the left of the right shift, then lets you choose? First I picked the ISO layout, and when I was troubleshooting, I thought that might be the problem, so from system settings, Keyboard, I re-selected English, instead of ISO.

After doing so, for a brief time, the secret agent problem went away, and I was able to get the correct character input, the desired ampersand. However, for some odd reason, after a few minutes it went back to insisting on entering the single quote! So close yet so far.

At any rate, I’d appreciate any help.
Thanks
Rick

Hi @rickcogley

Apologies for the delay in responding. Thanks for your support of Codebook and for posting to the discussion forum, although I’m sorry to hear about the trouble.

The current implementation of Secret Agent uses an Apple script to simulate key presses to “type” in the selected value(s) for you, your description of this issue sounds like a limitation which is to be expected for Secret Agent when using a different languages build in keyboard layout. Unfortunately, we don’t have any devices that have integrated different language keyboard layouts to test out workarounds/adjustments.

(I selected the scripts folder as usual, when I newly installed Codebook. When I re-enabled secret agent, it did NOT ask me to re-specify the scripts folder.)

It is expected to not prompt you to install the script again. It should only prompt you to install it when enabling the preference for the first time or when the script has changed (i.e. we make an adjustment for it). I don’t suspect that re-installing the script will have any affect, but if you would like to get it to prompt you again to test it out you can run this command in terminal:

defaults delete net.zetetic.Strip.mac ZSApplicationScriptsBookmarkData

Then uncheck and recheck the Secret Agent preference.

After doing so, for a brief time, the secret agent problem went away, and I was able to get the correct character input, the desired ampersand. However, for some odd reason, after a few minutes it went back to insisting on entering the single quote!

Interesting that it was working for a while for you. It sounds like it was using your external UHK keyboard for simulating the key presses briefly? There may be a way to fully disable the integrated macOS keyboard which could allow the external keyboard to be used for the keypresses. There used to be a command you could use in Terminal involving kextunload but it doesn’t appear to be applicable any more in recent versions of macOS.

We would like to look into adjusting the script which Secret Agent uses to see if we can avoid this issue altogether (for example telling the AppleScript to use a specific keyboard, but I don’t immediately see a way to do that). I’ve added an internal tracking ticket for us to circle back to. When we have a possible adjustment available for beta testing, would you be wiling to try it out on your end?

In the mean time, we’d recommend using the Password AutoFill extension for applications which support it, and copy/paste for any others.

Cheers,
Micah

Hi @mmoore thanks and sure, happy to test