How do I make Firefox remember its window size?

5

3

I usually use Firefox fully maximized, but occasionally I want to use it at a size which covers approximately half the screen. Unfortunately, when I Unmaximize the window, it shrinks to the size that I last used and then immediately resizes to cover the whole screen. Is there any way to make it stay at the size it was when I last had it Unmaximized?

EDIT: Just to clarify, it only does this if I have shut FireFox down since the last time I un-maximized - if it is still running, it works fine.

a_m0d

Posted 2009-07-18T05:33:08.597

Reputation: 988

Not that I know of – a_m0d – 2009-08-15T07:20:04.857

1Interesting. Mine doesn't do that. Are you using any add-ons that might trigger this? – Sasha Chedygov – 2009-07-18T05:37:01.413

Answers

3

I'll show you three solutions, each of which has its drawbacks, but I hope that at least one of them is acceptable to you.

JavaScript

This is probably the only useful application of window.resizeTo. Type

javascript:window.resizeTo(1280,512)

into the address bar. You can turn this in a bookmarklet easily.

Drawbacks

  • Doesn't work if you have JavaScript turned off.
  • JavaScript blockers may interfer (NoScript doesn't though)
  • Works with the default settings of Firefox but doesn't if you have removed the check mark from Allow scripts to: Move or resize existing windows under Edit/Preferences/Content/Enable JavaScript/Advanced...

Window Manager

wmctrl -r Firefox -e 0,-1,-1,1280,512

Drawbacks:

  • You'll have to have wmctrl installed (there is a wmctrl package for Fedora)
  • Requires EWMH/NetWM compatible X Window Manager (default window managers of KDE and GNOME are supported though)
  • If you have more than one Firefox window open you will have to specify exactly which one you want to resize. See wmctrl documentation on how you can do this, it's not difficult.

Command Line

The most obvious solution is to start Firefox with the desired window geometry. It'll start unmaximized but if you maximize and then again unmaximize, it'll shrink to the size that it had before.

Usually you can determine the window geometry for X Window applications like so:

firefox -geometry 1280x512+0+0

That didn't work for me, so I looked up the Firefox command line options (shortened):

Usage: firefox [ options ... ] [URL]
       where options include:

-height <value>     Set height of startup window to <value>.
-width <value>      Set width of startup window to <value>.
-no-remote      Open new instance, not a new window in running instance.

I tried

firefox -no-remote -height 1280 -width 512 

but that didn't work either. I think this is a bug in Firefox, and maybe it works in other versions or on other platforms.

Drawbacks

  • Neither of the above worked for me with Firefox 3.0.12 on Ubuntu 9.04.
  • It only works as long as you don't change the window size manually.

Ludwig Weinzierl

Posted 2009-07-18T05:33:08.597

Reputation: 7 695

0

Several years later and still an unanswered question. I've written a small utility which allows me to specify Firefox window position at startup. Have a look at http://www.ipsec.info/w/t/override-gtk-geometry.c . Instructions for compilation and usage are included in the source.

Currently it only allows you to specify startup position and size. You can adjust the source to suit your needs, for example to resize the window on some event at runtime.

Milan Pikula

Posted 2009-07-18T05:33:08.597

Reputation: 1

0

That isn't the default behavior on Linux, Windows, or Mac OS X.

Try starting Firefox in safe mode or with a new profile. If it doesn't happen there, start disabling extensions until you find the culprit.

The Mozilla knowledge base has instructions on starting Firefox in safe mode.

You can easily create a new profile (without harming your current one) by following the Profile Manager instructions.

derobert

Posted 2009-07-18T05:33:08.597

Reputation: 3 366