Skip to content

retr0h/tlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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.

Worms Screensaver DVD Screensaver Pipes Screensaver
Worms DVD Pipes
Passphrase Prompt Touch ID Prompt
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

⬇️ Download binary (macOS)

Grab the latest release for your architecture:

# Apple Silicon (M1/M2/M3/M4)
curl -sL https://github.com/retr0h/tlock/releases/latest/download/tlock_$(curl -sL https://api.github.com/repos/retr0h/tlock/releases/latest | grep tag_name | cut -d '"' -f4 | tr -d v)_darwin_arm64 -o tlock

# Intel Mac
curl -sL https://github.com/retr0h/tlock/releases/latest/download/tlock_$(curl -sL https://api.github.com/repos/retr0h/tlock/releases/latest | grep tag_name | cut -d '"' -f4 | tr -d v)_darwin_amd64 -o tlock

chmod +x tlock
sudo mv tlock /usr/local/bin/

πŸ” Verify checksum

curl -sL https://github.com/retr0h/tlock/releases/latest/download/checksums.txt -o checksums.txt
grep "$(uname -s | tr A-Z a-z)_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" checksums.txt | sed 's/tlock_.*$/tlock/' | shasum -a 256 -c

πŸ”¨ Build from source

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 --worms                  # Worms screensaver
tlock --pipes                  # Pipes screensaver
tlock --dvd                    # Bouncing lock screensaver
tlock --random                 # Random screensaver
tlock --random --cycle 5m      # Rotate screensaver every 5 min
tlock --worms --delay 30s      # Worms after 30s idle

As a tmux lock command:

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

βš™οΈ How It Works

tlock brings the classic xlock experience to your terminal β€” an animated screensaver that kicks in when your terminal is locked, with authentication required to dismiss it.

  1. 🎨 Pick a screensaver β€” --worms, --pipes, --dvd (bouncing lock), or --random
  2. ⌨️ Any keypress pauses the screensaver and shows the passphrase prompt
  3. πŸ”‘ Type your macOS password and press Enter to unlock
  4. πŸ–οΈ Press Esc to switch to Touch ID β€” authenticate with your fingerprint
  5. 🚫 Wrong password? ACCESS DENIED β€” back to the screensaver
  6. πŸ”„ Cycle mode β€” --random --cycle 5m rotates screensavers automatically

Without a screensaver flag, tlock shows the passphrase prompt directly.

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
  • πŸ”’ Bouncing DVD padlock screensaver
  • πŸ”² Pipes screensaver with fade-out reset
  • 🎲 Random screensaver selection with --cycle rotation
  • πŸ” 1Password CLI integration

πŸ“„ License

MIT - John Dewey

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors