Troubleshooting Hyperswitch

time to fix this once and for all

Posted by Peter on Sunday, May 26, 2019

For many years I’ve been using an excellent little gem called Hyperswitch. From time to time I have had problems with it, suddenly it just stopped working and I have never found out what the reason really was. I have Googled for it and tried all sorts of things but nothing has worked and suddenly it has started to work again. I probably did something right but I have never really understood why it started to work and today after installing “MacBook Pro Supplemental Update” it stopped working again. This time I decided to get to the bottom with this and to blog about it.

After some research I realized that my issue probably was related to the “Secure Input” feature in MacOS. When Secure Input is enabled for an application, applications like HyperSwitch, Contexts etc. will not be able to use hotkeys.

So let’s find out if any application is using Secure Input. Open up a terminal and run the ioreg command.

$ ioreg -l -w 0 | grep SecureInput                  
  |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100008,"kCGSSessionSecureInputPID"=309,"kCGSSessionSystemSafeBoot"=No,"kCGSSessionIDKey"=257,"kCGSSessionUserNameKey"="peter","kCGSessionLoginDoneKey"=Yes,"kCGSSessionGroupIDKey"=20,"kCGSessionLongUserNameKey"="Peter Merikan","kCGSSessionAuditIDKey"=100008,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})
      |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100008,"kCGSSessionSecureInputPID"=309,"kCGSSessionSystemSafeBoot"=No,"kCGSSessionIDKey"=257,"kCGSSessionUserNameKey"="peter","kCGSessionLoginDoneKey"=Yes,"kCGSSessionGroupIDKey"=20,"kCGSessionLongUserNameKey"="Peter Merikan","kCGSSessionAuditIDKey"=100008,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})

With the help of kCGSSessionSecureInputPID we can see the pid 309 and that’s the number of the process using Secure Input. Let’s see whose pid it is.

$ ps -p 309
  PID TTY           TIME CMD
  309 ??         3:54.62 /Applications/iTerm.app/Contents/MacOS/iTerm2 -psn_0_86037

So it is iTerm2 that uses Secure Input. Let´s kill iTerm and see what it looks like when it’s closed.

$ kill -9 309 

Run ioreg again and see.

$  ioreg -l -w 0 | grep SecureInput                  
  |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100008,"kCGSSessionSecureInputPID"=309,"kCGSSessionSystemSafeBoot"=No,"kCGSSessionIDKey"=257,"kCGSSessionUserNameKey"="peter","kCGSessionLoginDoneKey"=Yes,"kCGSSessionGroupIDKey"=20,"kCGSessionLongUserNameKey"="Peter Merikan","kCGSSessionAuditIDKey"=100008,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})
      |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100008,"kCGSSessionSecureInputPID"=309,"kCGSSessionSystemSafeBoot"=No,"kCGSSessionIDKey"=257,"kCGSSessionUserNameKey"="peter","kCGSessionLoginDoneKey"=Yes,"kCGSSessionGroupIDKey"=20,"kCGSessionLongUserNameKey"="Peter Merikan","kCGSSessionAuditIDKey"=100008,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})

It still looks like iTerm is using Secure Input. Time to restart MacOS to make sure it releases everything.

$ sudo shutdown -r now

When we are back again, open up the terminal, not iTerm, and see if iTerm is still using Secure Input.

$ ioreg -l -w 0 | grep SecureInput  

This time no application is using Secure Imput. To verify that Hyperswitch is working I started two Chrome windows and pressed Alt+Tab and yes, finally Hyperswitch is working as expected. Alt+Tab Chrome

Start up two Firefox windows just to make sure. And voila, it works to. Alt+Tab Firefox

So now we have to tell iTerm not to use Secure Input. We will change it with the help of the command PlistBuddy in the terminal. There is also a menu option we can use and I will show you that later on. But let’s change via the terminal.

$ /usr/libexec/PlistBuddy -c "Set :\"Secure Input\" false"  ~/Library/Preferences/com.googlecode.iterm2.plist

and start iTerm.

$ open -a iTerm

After opening iTerm I just verified that Hyperswitch was working as intended.

The menu option for Secure Input for iTerm can be found at iTerm2 > Secure Keyboard Entry Menu Option in iTerm

That’s it. I finally nailed it and it feels great.

Until next time, take care and remember, you are great.

If you find ambiguities, typos or other errors, you know what to do.


comments powered by Disqus