On my home desktop I have autologin enabled, i.e. I don’t need to log in manually. Since I always need a terminal and a browser, “
konsole” and “
firefox” are started automatically. So I just switch on my machine and when I come back 5 minutes later, I’m ready to work.
However, sometimes Firefox doesn’t start normally. It looks strange: some colors are replaced with a different one, fonts are different, tooltips on tabs are plain black (text in tooltips is not visible), etc. If I restart Firefox, it becomes OK. I’m not sure what causes this problem, but my guess is that Firefox is started too quickly. I think it would require some libraries that are not yet loaded when Firefox is started. Then these pieces of software are loaded, that’s why Firefox gets OK after a restart.
The solution is simple. Don’t start Firefox immediately after the login. Wait some time until everything else is loaded, and start it after. Of course, we still want to start Firefox automatically, not manually. So we need a simple script:
#!/usr/bin/env bash # /home/jabba/bin/start_firefox.sh sleep 60 # Wait 60 seconds. You can play with this value. /usr/bin/firefox &
Then in the Startup Applications, remove “
firefox” and add this script instead. Provide the absolute path of the script. Make sure it’s executable. Here is a screenshot of the applications that are started automatically on my machine:
Over the last 1.5-2 years, I collected 700+ tabs in my Firefox :) Maybe this summer I will have some time to sort them out. However, today when I switched my computer on, all my tabs were gone and I got a clean Firefox instance with one tab only. Hmm… I had a similar problem once and then I installed an add-on called “Session Manager”. In this add-on I made the setting to offer the list of previous sessions upon restart but it didn’t do anything! Damn, how to get back my tab collection?
.mozilla directory there is a file called
sessionstore.js that stores — among others — the opened tabs. However, this file was very small, my previous tabs were clearly not in it. Thank God there was a backup copy of this file next to it called
sessionstore.bak. It was a big file and the timestamp of the file indicated that it was created 2 days ago when everything was OK with my tabs.
So, how to extract the old tabs from
This is a JSON file, but it’s not pretty printed. I suggest copying this file to somewhere else where you can experiment with it. First, let’s make it readable:
$ python -m json.tool sessionstore.bak > session.json
Now you can open
session.json with a text editor. You will find lines with a “
url” key, but the number of these rows is huge. I had 731 tabs (that I lost) but this file contained 6500+ URLs. As I noticed, it also contains the URLs of closed tabs. How to extract the URLs of the opened tabs only?
Again, Python came to my rescue. After analyzing the structure of this JSON file, I could extract the tab URLs the following way:
$ python # version 2.7 >>> import json >>> f = open('session.json') # input file >>> g = open('tabs.txt', 'w') # output file >>> d = json.load(f) >>> tabs = d["windows"]["tabs"] >>> cnt = 0 >>> for t in tabs: ... print >>g, t["entries"]["url"] ... cnt += 1 >>> cnt 731 # Yeah! All of them are here! >>> g.close() >>> f.close()
The URLs of the lost tabs are now in the
I didn’t make a script of it but feel free to do it. From now on I will make regular backups of my opened tabs with the URL Lister add-on.
Read this: The Best Browser Extensions that Protect Your Privacy @lifehacker.
I installed the following extensions:
A long time ago I also made a Greasemonkey script called BH IMDB/Word Highlight. This script is written for some specific sites in Hungary. However, you can take ideas from this how to highlight a text on a web site.