Friday, February 5, 2021

The Great Suspender has been suspended. Here's a better way to recover your tabs.

This was a terrific Chrome extension -- tabs that weren't used for some period of time were suspended so that they didn't chew up CPU cycles. And all you had to do was click on the tab and your original tab content was displayed. 

Apparently, the original developer sold the extension, and the purchaser installed malware, so Google disabled it... that's a pain because I have maybe 150 suspended tabs that are no longer available. The Verge (https://www.theverge.com/2021/2/4/22266798/chrome-blocks-the-great-suspender-disabled-malware-tab-recovery) and others published a way to get the tabs back -- essentially: 
 1) go to history 
 2) search for URLs with the suspender's extension id (klbibkeccnjlkjkiokjodocebajanakg) and then copy, edit, paste the URLs. 

 The key is that the full URL contains the URL of the real website right at the end of the Suspenders' URL, preceded by "uri=". 
 For example, the Suspender's URL of: 

chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=7%20Best%20Coding%20Challenge%20Websites%20in%202020%20-%20GeeksforGeeks&pos=0&uri=https://www.geeksforgeeks.org/7-best-coding-challenge-websites-in-2020/

contains the URL for the geeksforgeeks.org website that you had visited. The recommendation is that you copy & save those URLs to get your tabs back. The problem is, that just leaves you with list of URLs but your tabs are still broken and you'll eventually want to kill the tabs and open the URLs again. Not convenient if you've organized your tabs -- such a with Chrome's Tab Groups.

You could try to edit the URL in place in the tab, but that's tricky given how long that Suspender URL is... and if you make a mistake, then Chrome takes over and replaces the URL with chrome-extension://invalid/ and then you really do have to go to history and find it there. 

I've got a better way: just copy the text from the suspended tab (more on this below -- it's the same URL as you might find in history, of course), paste it into your favorite text editor, use a little RegEx to get the part you want, and then paste it back into your tab. 

Again, the key is that you want to make sure that nothing happens to have Chrome recognize that this is an invalid extension. Here's how I do this: 

 1. Click once into the address bar -- you'll see the URL highlighted (it selects the whole thing). 
 2. Copy that URL (on Mac, it's Cmd-c; windows Ctrl-c). 
 3. Head over to your favorite editor (I use Vim and stack the Chrome window I'm working on top and bottom so they're quick to get to) and paste in that URL. 
 4. Select and copy the portion of the Suspender's URL that you want. 

In Vim, I've mapped the following command to a shortcut: 
     nnoremap ,,gg dd"*P:s/^.*\(http.*$\)/\1/<CR>0v$"+y 

The first part ( nnoremap ,,gg) defines my shortcut.
The second part (dd"*P) deletes the current line and pastes in what you just copied from Chrome.
The third part ( :s/^.*\(http.*$\)/\1/<CR>) is the search & replace command with the RegEx selection. The <CR> just adds a carriage return so that the command is executed. This leaves that line in the editor with the contents of your actual URL. 
The fourth part (0v$"+y) is a little bit of Vim magic to select that URL and copy it into the system clipboard. 

 Now you can go back to Chrome and paste your recovered URL back into your tab. 

 It's a pain, but at least you can fix your tabs in place -- that way you get it all back as it was.