Monday, January 10, 2011

Possible to limit the size of a window (such as a browser window) to exact pixel dimensions?

Is it possible set the size of a navigator or web browse window to exact pixel dimensions in Ubuntu?

  • You can right click on the lower right corner of your window and drag it. While you do this the dimension is shown and you can choose the exact size in pixels.

    Oli : This depends on `compiz` running and the "Resize Info" plugin running, no?
    From qbi
  • No there isn't.

    However for FireFox as part of the Web Developer add on there is a window resize menu item for testing pages on different screen resolutions.

    That resizes the FireFox window to an exact pixel size.

  • If you use Mozilla Firefox, you can also use the addon Firesizer. It has a small menu where you can select the size or customize your settings:

    firesizer

    From qbi
  • For Nautilus you can also change the settings with gconf-editor. Go to apps -> nautilus -> preferences. On the right side there is an entry navigation_window_saved_geometry. Double-click on it and enter a number which fits you most.

    From qbi
  • If you're using Compiz (installed by default) there is a Window Rules plugin that can do this. If you need this for web development, then you will be better off with various plugins specific to each browser; otherwise you may find this helpful.

    Open CompizConfig Settings Manager (not installed by default, install the compizconfig-settings-manager package) from System > Preferences. Navigate to the Window Rules plugin in the Window Management category (you'll see #1 below). In the "Size rules" tab, add a new rule (#2), grab the criteria by clicking on the window (#3, #4). Enter the size (you can see I previously added an example rule for Opera at 800x600), and this size will be used when matching windows are created. You can prevent resizing in the Matches tab ("Non resizable windows" option) of the same plugin with similar matching rules (i.e. class=whatever).

    The related and handy Place Windows plugin can be used to specify initial locations for windows.

    screenshot

    From Roger Pate
  • Many X applications also have a --geometry option that lets you specify the height/width and x/y position. For instance:

    gnome-terminal --geometry=114x40+1920+547

    Another tool that can be used is 'wmctrl'. This allows you to alter properties of already running windows, including position and size. For instance:

    chideok:~$ wmctrl -l -G | grep Possible

    0x02339ca2 0 558 111 1216 1006 chideok Possible to limit the size of a window (such as a browser window) to exact pixel dimensions? - Ubuntu - Stack Exchange - Mozilla Firefox

    chideok:~$ wmctrl -i -r 0x02339ca2 -e 0,100,100,100,100

    chideok:~$ wmctrl -lG | grep Possible

    0x02339ca2 0 110 146 100 100 chideok Possible to limit the size of a window (such as a browser window) to exact pixel dimensions? - Ubuntu - Stack Exchange - Mozilla Firefox

    From Bryce

0 comments:

Post a Comment