tlock

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 12 Imported by: 0

README ΒΆ

release go report card license build release powered by just conventional commits macOS go reference github commit activity

____________   _____________________
7      77  7   7     77     77  7  7
!__  __!|  |   |  7  ||  ___!|   __!
  7  7  |  !___|  |  ||  7___|     |
  |  |  |     7|  !  ||     7|  7  |
  !__!  !_____!!_____!!_____!!__!__!

πŸ”’ Lock your terminal. Unlock with your fingerprint.

A terminal lock screen for macOS that uses Touch ID for biometric unlock with macOS password fallback. Drop it into tmux as your lock-command and walk away.

Worm ScreensaverPassphrase PromptTouch ID Prompt
Screensaver Passphrase Touch ID

✨ Features

  • πŸ–οΈ Touch ID fingerprint unlock via macOS LocalAuthentication
  • πŸ”‘ macOS password fallback with blinking block cursor
  • 🎨 Glitch-style unicode bordered prompts (purple/teal palette)
  • 🧠 Auto-detects Touch ID availability (skips when lid is closed)
  • πŸ›‘οΈ Signal-proof β€” Ctrl+C, Ctrl+Z won't bypass the lock
  • πŸ“ Terminal resize aware
  • πŸ–₯️ Designed as a tmux lock-command

πŸ“¦ Install

Note: tlock requires CGo and macOS frameworks (LocalAuthentication, PAM), so it must be built from source on a Mac.

git clone https://github.com/retr0h/tlock.git
cd tlock
go build -o tlock .
sudo mv tlock /usr/local/bin/

πŸš€ Usage

Run directly:

tlock                                        # Password prompt only
tlock --snake                                # Worms immediately
tlock --screensaver                          # Worms after 30s idle (default delay)
tlock --screensaver --screensaver-delay 60   # Worms after 1 min idle

As a tmux lock command:

# ~/.tmux.conf
set -g lock-command "tlock --snake"
set -g lock-after-time 1800    # Lock after 30 min idle
bind ^X lock-server            # Ctrl+X to lock now

βš™οΈ How It Works

  1. Terminal locks and shows the passphrase prompt with a blinking cursor
  2. Type your macOS password and press Enter to unlock
  3. Press Esc to switch to Touch ID β€” authenticate with your fingerprint
  4. Wrong password? ACCESS DENIED β€” back to the prompt. Try again.

All signals (SIGINT, SIGTERM, SIGTSTP) are ignored. The only way out is authentication. πŸ”

πŸ“‹ Requirements

  • 🍎 macOS (uses LocalAuthentication.framework and PAM)
  • 🐹 Go 1.21+ with CGo enabled
  • πŸ–οΈ Touch ID hardware (optional β€” password fallback always available)

πŸ’‘ Inspiration

tlock is inspired by xlock, the classic X11 screen locker from the 90s that shipped with most Unix workstations. The worm screensaver mode (xlock -mode worm) by David Bagley was a staple of SGI Indigos and Sun workstations in dimly lit server rooms everywhere.

πŸ”€ Alternatives

Tool Platform Description
xlock / xlockmore X11 / Unix The OG screen locker with 50+ screensaver modes
vlock Linux Virtual console lock β€” locks Linux TTYs
bashlock macOS / Linux Simple bash-based terminal lock
slock X11 Suckless screen locker β€” minimal, no frills

πŸ—ΊοΈ Roadmap

  • πŸ› xlock-style worm screensaver with fading trails
  • πŸ”€ Cycling figurine text screensaver
  • βš™οΈ Configuration file (~/.config/tlock/config.yaml)
  • πŸ” 1Password CLI integration

πŸ“„ License

MIT - John Dewey

Documentation ΒΆ

Overview ΒΆ

Package main implements tlock, a terminal lock screen for macOS with Touch ID and password authentication.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL