- Swift 100%
|
|
||
|---|---|---|
| Sources/sidetect | ||
| .gitignore | ||
| LICENSE.md | ||
| Package.resolved | ||
| Package.swift | ||
| README.md | ||
sidetect — Secure Input Detector
A minimal macOS command-line tool that detects whether Secure Input is currently enabled and, if so, which application is responsible.
Secure Input is a macOS feature that prevents other processes from reading keyboard events. It is typically activated by password fields in browsers, terminal emulators, and password managers. If an application enables Secure Input and crashes or misbehaves without disabling it, keyboard input may stop working correctly in other apps (e.g. key remappers like Karabiner-Elements).
Requirements
- macOS 26 or later
- Swift 6.3+ / Xcode 26+
The software may compile and run on older systems, but they were not tested.
Build
git clone https://forgejo.michelon.ch/michelon/sidetect.git
cd sidetect
swift build -c release
The compiled binary will be at .build/release/sidetect.
Usage
OVERVIEW: Detects whether macOS Secure Input is enabled and which app holds it.
USAGE: sidetect [--pid] [--app-name] [--version] [--continuous] [--interval <interval>]
OPTIONS:
-p, --pid Print only the PID of the locking app (nothing if Secure Input is disabled).
-a, --app-name Print only the app name of the locking app (nothing if Secure Input is disabled).
-v, --version Print version information.
-c, --continuous Continuously report Secure Input state (press Ctrl-C to stop).
-i, --interval <interval> Polling interval in seconds when used with --continuous (default: 2).
-h, --help Show help information.
Examples
When Secure Input is disabled:
$ sidetect
Secure Input is disabled.
$ sidetect -p
(no output)
$ sidetect -a
(no output)
When Secure Input is enabled:
$ sidetect
Secure Input is enabled by iTerm2 (PID 1234).
$ sidetect -p
1234
$ sidetect -a
iTerm2
Continuous monitoring:
$ sidetect -c
Secure Input is disabled.
Secure Input is disabled.
Secure Input is enabled by iTerm2 (PID 1234).
...
$ sidetect -c -i 2
Secure Input is disabled.
Secure Input is disabled.
...
Other:
$ sidetect -v
sidetect (Secure Input Detector) v1.0
$ sidetect -h
OVERVIEW: Detects whether macOS Secure Input is enabled and which app holds it.
...
How It Works
IsSecureEventInputEnabled()(Carbon / HIToolbox) checks whether Secure Input is active.- If active, the responsible PID is read from the
kCGSSessionSecureInputPIDkey inside theIOConsoleUsersdictionary in the IORegistry root entry. - The process name is resolved from the PID using
sysctl(KERN_PROC_PID).
License
This software is released under the terms of the MIT License.