CmdZ

CmdZ is a small Chrome extension that brings Safari’s Command+Z tab restoration behavior to Chrome without stealing Undo from text fields or web apps.
What it is
A dependency-free Manifest V3 extension built with plain JavaScript. It gives the current page the first chance to handle Command+Z on macOS or Ctrl+Z on Windows and Linux. If the page has nothing to undo, CmdZ restores the most recently closed individual tab. The toolbar icon provides a fallback in browser surfaces where Chrome does not allow page-level shortcut listeners.
Why I made it
Safari makes reopening an accidentally closed tab feel immediate with Command+Z. I wanted the same behavior in Chrome without replacing the Undo shortcut that people expect to keep working inside text fields, editors, and web apps.
What I learned
- How to distinguish page-level Undo from a browser action using trusted keyboard and
historyUndoevents. - How to coordinate a content script and service worker while keeping extension permissions focused.
- How to design a browser extension with no tracking, network requests, settings, or third-party dependencies.
