Skip to content

Repository files navigation

RestLock

A WPF desktop application for managing screen locking with scheduled rest reminders.

Download

Latest release: RestLock v1.1.1Download

Features

  • 🛌 Scheduled screen locking — set Work End and Rest End times for weekdays and weekends independently
  • Warning system — 10-minute, 5-minute, and 10-second countdown alerts before lock
  • 😴 Snooze — postpone lock by a configurable number of minutes (limit per session)
  • Break reminders — optional Pomodoro-style breaks during work periods
  • 💧 Water reminders (v1.1.0+) — gentle, non-blocking reminders to drink water
  • 🔒 Multi-monitor lock — full-screen lock windows on every monitor
  • ⌨️ Keyboard hook — blocks Win key, Alt+Tab, Alt+F4, Ctrl+Esc, Ctrl+Shift+Esc during lock
  • 🐕 3-layer watchdog protection (v1.1.0+) — registry Run key + user-mode watchdog + Windows Service
  • 📊 Session statistics — track successful vs. failed rest sessions
  • 🔧 Per-day overrides — customize the schedule for any specific day of the week
  • ⏱️ Flexible time pickers (v1.1.0+) — pick any minute, not just 15/30/45
  • 🔇 Pause — temporarily disable the schedule (2-hour pause, limited to 2 per week)
  • 🆙 Auto-update check (v1.1.0+) — checks GitHub for new releases; popup is suppressed during lock, banner shown in Settings instead
  • 🚪 Quit button (v1.1.0+) — proper exit via Settings → Quit RestLock (no need for Task Manager)
  • 🪟 Windows 11 Fluent Design — Mica backdrops, modern UI via WPF-UI

Tech Stack

  • Framework: .NET 10 (WPF)
  • Language: C# 14 with nullable reference types
  • Database: SQLite (via Microsoft.Data.Sqlite 10.x)
  • Logging: Serilog
  • MVVM: CommunityToolkit.Mvvm 8.4.2
  • UI: WPF-UI 4.3.0 (Windows 11 Fluent Design)
  • Crash Reporting: Sentry 6.7.0

Legal

Project Structure

src/
  RestLock.Models/           - Domain models
  RestLock.Core/             - Core logic and interfaces
  RestLock.Storage/          - SQLite data access
  RestLock.Services/         - Business services
  RestLock.Infrastructure/   - DI, hosting, logging
  RestLock.UI/               - WPF application
  RestLock.Watchdog/         - User-mode watchdog (Layer 2)
  RestLock.WatchdogService/  - Windows Service watchdog (Layer 3, v1.1.0+)
tests/
  RestLock.Tests/            - Unit tests (xUnit + Moq)

Prerequisites

  • .NET 10 SDK (version 10.0.100 or later)
  • Windows 10 (build 10240+) or Windows 11 (recommended for Mica backdrop support)
  • The repo includes a global.json that pins the SDK to 10.0.x with rollForward: latestFeature, so any 10.0.1xx or 10.0.2xx SDK will be accepted.

Build

dotnet build RestLock.sln

Publish (single-file, self-contained)

Debug:

dotnet publish src/RestLock.UI/RestLock.UI.csproj -c Debug -r win-x64 --self-contained true -p:PublishSingleFile=true -o .\out\Debug

Release:

dotnet publish src/RestLock.UI/RestLock.UI.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o .\out\RestLock

The publish step automatically builds and copies RestLock.Watchdog.exe and RestLock.WatchdogService.exe to the same output directory (see the PublishWatchdogAlongsideMain MSBuild target in RestLock.UI.csproj). All three executables are required for the full 3-layer protection to work.

How to exit RestLock

RestLock is designed to enforce your rest schedule, so the tray menu Quit item is DEBUG-only. In Release builds, you can exit via:

  1. Settings → Quit RestLock button (red button at the bottom of the Settings window)
  2. Uninstall RestLock (Settings → Apps → RestLock → Uninstall) — the uninstaller stops the service and kills all processes.
  3. Task Manager — kill RestLock.UI.exe AND stop the RestLockWatchdog service via services.msc (requires admin rights). Killing just the UI process will result in the service restarting it within ~5 seconds.

Protection Architecture (v1.1.0+)

RestLock uses a 3-layer protection model to prevent users from bypassing the rest schedule:

Layer What How it works Bypassable?
1. Registry Run key HKCU\...\Run\RestLock Starts RestLock.UI.exe at logon Yes — user can disable via Task Manager → Startup tab
2. User-mode watchdog RestLock.Watchdog.exe Runs alongside the UI; if the UI is killed, restarts it within ~1 second via Process.WaitForExit() Yes — user can kill both processes within 2 seconds
3. Windows Service (v1.1.0+) RestLockWatchdog service Runs as SYSTEM, starts at boot before user logon; polls every 5 seconds and restarts the UI if missing; cannot be disabled from Task Manager Only via services.msc (requires admin rights)

What this means for users:

  • The app starts automatically at boot (Layer 1 + Layer 3).
  • If the user kills the app via Task Manager, the service restarts it within ~5 seconds (Layer 3).
  • To fully bypass RestLock, a user needs admin rights to stop the service via services.msc.
  • The app is designed for self-imposed productivity enforcement, not adversarial lockdown.

Known Limitations

  • Service bypass (admin required): A user with admin rights can stop the RestLockWatchdog service via services.msc and then kill the app. This is inherent to any user-mode protection — only kernel drivers can prevent this.
  • Windows 10 compatibility: The Mica backdrop does not render on Windows 10. All other features work normally; a compatibility warning is shown on first launch on Win10.
  • Code signing: The app is not code-signed (open-source, no budget for a certificate). SmartScreen may show a warning on first launch — click "More info" → "Run anyway" to proceed.
  • Admin rights required for install: v1.1.0+ installs a Windows Service, which requires admin privileges. The installer will trigger a UAC prompt. (v1.0.0 was per-user with no admin, but had weaker protection.)
  • Upgrading from v1.0.0: The v1.1.0 installer automatically detects v1.0.0 (installed in %LOCALAPPDATA%\RestLock) and uninstalls it before installing v1.1.0 to C:\Program Files\RestLock. Your settings database (%LOCALAPPDATA%\RestLock\restlock.db) is preserved — your schedule, snooze settings, and lock session history carry over automatically. A dialog will ask for confirmation before the migration.

About

Tired of your broken schedule? Try RestLockPro a dekstop application that prevent you to stop staying up all night and fixed schedules that you can fully customize at any moment unless if the LOCK activate!!!

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages