Skip to content

erel3/lidguard

Repository files navigation

LidGuard icon

LidGuard

Laptop theft protection for macOS

Release Platform Swift License

A menu bar app that detects lid close and power disconnect events,
then tracks your device and sends alerts via Telegram and Pushover.


How It Works

 Disabled ──arm──▶ Enabled ──trigger──▶ Theft Mode
    ◀──disarm───    ◀──authenticate───
                                          ├─ 📍 Location
    arm: menu, shortcut                   ├─ 📶 WiFi & IP
    trigger: lid close, power disconnect  ├─ 🔋 Battery
    authenticate: Touch ID, Telegram      ├─ 🔔 Alerts (Telegram + Pushover)
    disarm: Touch ID                      ├─ 🚨 Siren alarm
                                          └─ 🔒 Lock screen overlay

When theft mode activates, LidGuard sends tracking updates every 20 seconds with location, IP, WiFi, and battery status — all controllable remotely via Telegram.

Features

🛡️ Theft Detection — lid close, power disconnect, power button press
📍 Device Tracking — location, IP, WiFi, battery every 20s
📲 Telegram & Pushover — instant alerts with full device info
🎮 Remote Control — enable, disable, alarm, status via Telegram bot
🚨 Alarm — synthesized siren or system sounds at max volume (enforced, can't be silenced)
😴 Sleep Prevention — IOKit assertions + pmset disablesleep
🔒 Lock Screen — fullscreen "STOLEN DEVICE" overlay with owner contact info
⌨️ Global Shortcut — system-wide hotkey to arm/disarm
🔐 Touch ID — biometric auth for settings, disable, and quit
🛑 Shutdown Blocking — prevents force quit and shutdown during theft mode
🔄 Auto-Update — checks for new versions and installs with one click
🚀 Launch at Login — start protection automatically via macOS login items

Install

Download

Grab the latest .zip from Releases, unzip, and move LidGuard.app to /Applications.

Build from Source

git clone https://github.com/Erel3/lidguard.git
cd lidguard
make run            # build .app with -dev suffix and open
make lint           # run swiftlint
make install        # install to /Applications

Setup

On first launch, LidGuard opens Settings automatically if no notification service is configured.

Telegram Bot

LidGuard uses a Telegram bot to send alerts and receive remote commands.

  1. Open Telegram and message @BotFather
  2. Send /newbot, pick a name and username
  3. Copy the bot token (looks like 123456789:ABCdefGHI...)
  4. Send any message to your new bot, then open https://api.telegram.org/bot<TOKEN>/getUpdates
  5. Find your chat ID in the response JSON ("chat":{"id":123456789})
  6. Paste both into LidGuard Settings → Notifications → Telegram

The bot only responds to your chat ID — no one else can control it.

Pushover (optional)

Pushover delivers instant push notifications to your phone. Useful as a fast backup channel alongside Telegram.

  1. Create an account at pushover.net and install the mobile app
  2. Copy your User Key from the Pushover dashboard
  3. Create an application to get an API Token
  4. Paste both into LidGuard Settings → Notifications → Pushover

Settings

Settings are organized into four tabs:

Tab What's there
General Contact name & phone (shown on lock screen overlay), launch at login, auto-update, reset
Triggers Lid close, power disconnect, power button toggles; global shortcut config
Protection Sleep prevention, shutdown blocking, lock screen, alarm sound & volume, auto-alarm
Notifications Telegram bot token & chat ID, Pushover user key & API token, per-service toggles

Credentials are stored in macOS Keychain — never synced or uploaded.

Remote Commands

Control LidGuard from anywhere via your Telegram bot:

Command Action
/stop or /safe Deactivate theft mode
/enable Arm protection
/disable Disarm protection
/status Device info + current state
/alarm Trigger siren
/stopalarm Stop siren

Telegram replies include context-aware button keyboards — no need to type commands manually.

Menu Bar

LidGuard lives in the menu bar with a custom laptop icon:

Icon State
Closed eye (dark) Disabled
Open eye (green) Protection enabled
Open eye (red) Theft mode active

Left-click opens the full menu. Right-click quick-toggles protection.
Hold Option while the menu is open to reveal hidden items (test alert, activity log).

Permissions

Permission Why
Accessibility Global keyboard shortcut + power button monitoring
Location Services Device tracking in theft mode
Contacts (optional) Auto-fill owner phone number from your Me card

The app is not sandboxed — it needs direct access to IOKit, CoreAudio, and pmset for full theft protection.

License

MIT

About

macOS laptop theft protection — Telegram alerts, location tracking, siren alarm

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors