Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZZ/qall breaks "show your tabs and windows from last time" #350

Open
mMontu opened this issue Mar 15, 2018 · 9 comments
Open

ZZ/qall breaks "show your tabs and windows from last time" #350

mMontu opened this issue Mar 15, 2018 · 9 comments

Comments

@mMontu
Copy link

mMontu commented Mar 15, 2018

If you have multiple Firefox windows open and leave through Ctrl+Shift+Q, all the windows are restored when Firefox restarts (due to show your tabs and windows from last time preference).

But if you leave through ZZ then a single window is restore on the next session; all the other windows are lost.

@thejukra
Copy link

I can confirm this. Behaves just as mMontu described.

Tough after leaving with ZZ and restarting Firefox with Tridactyl the last opened windows may be restored from Library -> History -> Recently closed windows.

@bovine3dom
Copy link
Member

Yeah, sorry about this. Last time I looked there wasn't a "quit Firefox" command, so we just have to close all of the windows. I'll have a look at it again - thanks for reporting it.

@bovine3dom
Copy link
Member

We can probably just hack our away around this with a TriStart autocmd that checks to see if your most-recently-closed object was a window and then restores it.

@bovine3dom
Copy link
Member

bovine3dom commented May 26, 2019

Dunno why I didn't think of this earlier: bind ZZ !s killall firefox works fine if you have the native messenger and killall installed.

Edit: this issue is so old that there's also the U key bound to undo window that will restore a lost window.

@zeorin
Copy link

zeorin commented Sep 11, 2019

My problem is that when running :qall, upon opening, some of the closed windows are not restored. Neither CTRL+SHIFT+N (native undo close window) nor U will recover the missing windows.
I currently have 7 windows open, with many tabs in each (one has 390 tabs, I know I have a problem).
When I last ran :qall (by accident, because, you know, vim-muscle-memory), and then opened Firefox again, only 3 of these windows were restored. The other windows are totally lost. If you’re like me, and keeping tabs around is how you keep your to-read lists, then this is a major problem.

It's not the 1st time that I've made this mistake.

Recovering from this mistake

Close Firefox.

For anybody else that has the same problem, I (mostly) recovered from this by copying the missing windows from the last upgrade backup session.
In $profile/sessionstore-backups there are usually the following files:

previous.jsonlz4
recovery.baklz4
recovery.jsonlz4
upgrade.jsonlz4-$timestamp

There may be multiple of the upgrade backup files.

Your current session file will be at $profile/sessionstore.jsonlz4.

These files are compressed using a Mozilla-specific lz4 compression algo (don't ask). I use https://github.com/jusw85/mozlz4 to uncompress these.

In my experience, the previous.jsonlz4, recovery.baklz4, and recovery.jsonlz4 files are basically the same as one another and as sessionstore.jsonlz4 (there might be slight timestamp differences in the content data).

So these are of no help, either. The most recent upgrade session backup is where I look for the missing windows. The uncompressed files will be huge single-line JSON files. Hopefully your editor can pretty-print them, if not, you can use the python -m json.tool command-line utility (I run :%!python -m json.tool in Vim) to format them. The data structure is pretty clear, IMO, so you should be able to figure out what to copy where.

Then just re-compress the sessionstore.jsonlz4 and place it in the root of your Firefox profile folder. Start Firefox, and presto!, your windows are back (assuming that the last upgrade backup was recent enough for you)

Avoiding this mistake again

:alias qall noop

This will also handle ZZ and :qa, since they both call :qall.

@ironreality
Copy link

@bovine3dom Hi Oliver!
I have FF 92.0 and Tridactyl 1.21.1
In my case 'ZZ' typing closes FF without saving my tabs.
Also I tried to add bind ZZ !s killall firefox to ~/.tridactylrc
Could you elaborate more on how to use the workaround?

@bovine3dom
Copy link
Member

On about:preferences is Firefox set to "show windows and tabs from last time"? Does :viewconfig --user show your ZZ bind?

@ironreality
Copy link

:viewconfig --user

@bovine3dom Thank you for your fast response!
I added that bind manually right from FF window and now ':viewconfig --user' outputs the next:

{
  "configversion": "2.0",
  "hintfiltermode": "vimperator-reflow",
  "hintnames": "numeric",
  "nmaps": {
    "<": "back",
    ">": "forward",
    "ZZ": "!s killall firefox"
  },
  "update": {
    "lastchecktime": 1597518176214,
    "lastnaggedversion": "1.20.0"
  },
  "updatenaglastversion": "1.20.4"
}

But now pressing 'ZZ' does nothing...
In the same time issuing 'killall firefox' in my terminal closes FF.

@bovine3dom
Copy link
Member

You need :native installed and working : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants