A Chrome extension that keeps you on your focus tab. Two modes: instant tab lock and a Pomodoro-style focus timer with escalating breaks.
Version: 1.1.1 (see manifest.json)
- Click the extension icon and choose Lock Tab to lock yourself to the current tab.
- Optionally enter a task before locking. It appears as a draggable reminder on every tab in your allowed set (drag to reposition, double-click to reset to top center).
- If you switch to another tab, Tab Lock blocks that tab. In the popup, under Blocked tab, choose Breathing ritual (10s) for a guided inhale/exhale animation before the locked screen, or Tab lock only to show the locked screen immediately.
- Opening a new tab while locked does not add it to the allowed set. It stays blocked until you explicitly add it from Manage tabs in the popup.
- While locked, Leave-site warning: on allowed tabs, clicking a link that would take you to a different hostname shows a confirm dialog so you do not drift off-site by accident (same-site and subdomain navigation is not interrupted).
- Click Unlock Tab to disable the lock.
- The toolbar icon switches between locked and unlocked artwork; the badge shows ON when a focus lock is active.
- Start Pomodoro begins a focus cycle (the optional task reminder works here too):
- 60 min focus → 5 min break → 60 min focus → 10 min break → 60 min focus → 20 min break → (repeats)
- During focus phases, tab lock behaves like Lock Tab.
- During breaks you can browse freely.
- Lifeline: hold for 5 seconds to cancel the Pomodoro session and unlock.
- Clone or download this repository.
- Open Chrome and go to
chrome://extensions/. - Turn on Developer mode (toggle in the top-right).
- Click Load unpacked.
- Select the
unswitchproject folder (or your local clone path).
- Go to the tab you want to focus in (document, IDE, study page, and so on).
- Click the Tab Lock icon in the Chrome toolbar.
- Choose Lock Tab for an immediate lock, or Start Pomodoro for structured focus and break periods.
- Chrome 88 or later (Manifest V3)
- Permissions:
tabs,activeTab,scripting,alarms,storage - Host permissions:
<all_urls>(needed to inject the blocker, overlay, and reminder on ordinary web pages)
unswitch/
manifest.json # Extension manifest (Manifest V3)
background.js # Service worker: lock state, Pomodoro alarms, tab/window handlers
popup/
popup.html # Toolbar popup UI
popup.css
popup.js
content/
blocker.js # Full-screen blocker on tabs outside the allowed set (content script)
blocker.css
overlay.js # 10-second breathing ritual shown before the locked screen
overlay.css
leave-domain.js # Confirm before leaving the current site from an allowed tab while locked
reminder.js # Draggable task banner on allowed tabs
reminder.css
blocked/
blocked.html # Fallback blocked page
blocked.css
icons/ # Locked / unlocked toolbar icons (16, 32, 48, 128 px)
store-assets/ # Icons and screenshots for store listing (optional)
- Tab lock toggle: Lock → switch to another tab → see 10-second breathing ritual → see locked screen.
- Unlock: Unlock from popup → switch tabs freely.
- Icon / badge: Icon reflects lock state; badge shows ON when locked.
- Locked tab closed: Closing the primary locked tab disables the lock.
- Leave-site warning: On an allowed tab while locked, click an external link → confirm dialog; cancel stays on page.
- Pomodoro start: Start Pomodoro → tab locks, countdown visible in popup as expected.
- Pomodoro focus → break: After focus duration → break phase, free browsing.
- Pomodoro break → focus: After break → focus phase, lock active again.
- Pomodoro cycle: Break lengths follow 5 → 10 → 20 minutes across cycles.
- Lifeline: Hold Lifeline 5 s → session ends, tabs unlock.
- Cross-window: Lock in window A → focus window B with a non-allowed tab → forced back to locked tab.
MIT