Skip to content

Haris-Kayani/Discipline_Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focus Mode - Distraction Blocker Extension

A Chrome extension that helps you stay focused by blocking distracting websites during study sessions.

Features

  • Focus Mode Toggle: Quickly enable/disable blocking from the popup
  • Whitelist-Based Blocking: Only allow access to specific domains (e.g., learning sites)
  • Pomodoro Timer: Set focus sessions (default 25 minutes)
  • Custom Block Page: Friendly page showing why site was blocked + remaining time
  • Persistent State: Settings survive browser restarts
  • Daily Stats: Track how many distractions were blocked today

Installation

For Development/Testing

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (toggle in top-right corner)
  3. Click Load unpacked
  4. Select the Discipline Google Extension folder
  5. The extension will appear in your toolbar

Adding Icons (Optional)

The extension works without custom icons, but you can add them:

  1. Create PNG images (16x16, 48x48, 128x128 pixels)
  2. Place them in the icons/ folder
  3. Update manifest.json to reference them

Usage

  1. Click the extension icon in your toolbar
  2. Toggle Focus Mode ON to start blocking
  3. Add allowed sites to your whitelist (e.g., scrimba.com)
  4. Start a timer for timed focus sessions (auto-disables when done)
  5. Blocked sites will show a friendly "Focus Mode Active" page

Default Whitelist

The extension comes with these sites pre-whitelisted:

  • github.com
  • stackoverflow.com

You can add or remove sites from the popup.

File Structure

Discipline Google Extension/
├── manifest.json        # Extension configuration
├── background.js        # Service worker (blocking logic, timer)
├── popup/
│   ├── popup.html       # Popup UI
│   ├── popup.js         # Popup logic
│   └── popup.css        # Popup styles
├── blocked/
│   ├── blocked.html     # Block page
│   ├── blocked.js       # Block page logic
│   └── blocked.css      # Block page styles
└── icons/               # Extension icons (optional)

Technical Notes

  • Manifest V3: Uses modern Chrome extension APIs
  • Service Worker: Handles background logic, survives browser restarts
  • chrome.alarms: Reliable timer that works even when popup is closed
  • chrome.storage.local: Persists all settings locally

Limitations

  • Cannot block chrome:// pages (browser security)
  • Cannot block other extensions' pages
  • User can always disable the extension (this is a self-discipline tool)
  • Timer has 1-minute minimum granularity (Chrome alarms limitation)

Development

To modify the extension:

  1. Edit the source files
  2. Go to chrome://extensions/
  3. Click the refresh icon on the extension card
  4. Changes will take effect immediately

License

MIT License - Feel free to modify and use for your own purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors