Terminal command to change firefox 3 homepage?

Eeezee

Diamond Member
Jul 23, 2005
9,922
0
76
I have access to my room mate's laptop and would like to play a practical joke on him.

It's easy enough to change the homepage to something like this (NSFW, two giraffes doing a little dance)

I think it would be fun to change his .bashrc so that every time he opens a terminal, it resets his firefox homepage. It's a childish, victimless prank. I know his boss, and he'd find the picture pretty hilarious, so there's definitely no issue.

In the user profile directory, there is a prefs.js and there is definitely a browser.startup.homepage there, but I'm not especially experienced with awk. I'm going to start playing around, but I was just wondering if anyone knew of a better way to do this. The biggest problem I have with this is the warning at the top of the prefs file

/* Do not edit this file.
*
* If you make changes to this file while the application is running,
* the changes will be overwritten when the application exits.
*
* To make a manual change to preferences, you can visit the URL about:config
* For more information, see http://www.mozilla.org/unix/customizing.html#prefs
*/

This indicates, to me, that most of the time this won't even work.

Edit
Here is what I've come up with
echo 'user_pref("browser.startup.homepage", "http://www.giraffes.org/amorous-giraffe.jpg");' >> ~/.mozilla/firefox/*.default/prefs.js

Edit 2:
For mac it would have to be something like
echo 'user_pref("browser.startup.homepage", "http://www.giraffes.org/amorous-giraffe.jpg");' >> ~/Library/'Application Support'/Firefox/Profiles/*.default/prefs.js

But since typically everyone has a different profile name, does anyone know if there's a default path? I tried tabbing on $fire and $FIRE and $m... but I guess there may not be an environmental variable set for easy pranking like what I have in mind :(

Edit: I didn't know you could do wildcards! Okay, this is totally ready for implementation. Just have to find an excuse to get on his computer and access Anandtech
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
lol, I did something like that to one of my room mates. I made a program that changed his background to "All your base are belong to us" and did it in a way the prevented him from changing it to anything else :D
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
Well, first off, he was using a windows PC. so the API for changing the background isn't too bad. What I did was put the picture in his systems folder and renamed it to something random (I also set back the clock date before I did this so he could look up recently modified files) then I just copied the file from that location and called the windows API to change the background over to that picture. If he deleted the file it would "magically" show up again :D then I just call the program at startup with regedit.

I wrote it in C++ with dev-c++, it was something like 3 or 4 lines long, nothing really all that complicated. I be a linux version wouldn't be all that difficult (in fact it might even be easier :D)

*edit* Yep, after a little digging, it isn't too hard to change a background in gnome.

gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$selected_bg"

#!/bin/bash

wget -q http://www.allyourbasearebelongtous.com/allyourbase.jpg
gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$(pwd)/allyourbase.jpg"

Your welcome :D just put this wherever you want it (startup script, .bashrc, wherever you think it will be the most annoying :D This will only work on gnome. Ill look up a kde version as well for yah)
 

Brazen

Diamond Member
Jul 14, 2000
4,259
0
0
You might try grepping a firefox profile directory to see if it's stored in text configuration in there somewhere.
 

Eeezee

Diamond Member
Jul 23, 2005
9,922
0
76
Cogman you are totally awesome

Here is my new plan:
I have two room mates, one with a mac and one with ubuntu. I'm going to do the homepage change to one of them. I will then do the background change to the other. It should be easy to convince them that the other one is responsible.

This is going to be great