Ubuntu Studio Linux 14.04.1 LTS
From a Linux shell script, I'd like to launch a browser window of an exact size, e.g. as a step for automatically recording a screencast.
My first thought was to use Xwindows -geometry
setting, which once upon a time was common to all apps in Xwindows and was preserved in Gnome options
#!/bin/bash -e
chromium-browser -geometry 1280x720 # ignores the spec
# firefox -geometry 1280x720 ignores the spec too
I found this post in the FreeBSD forum which also says that firefox ignores the -geometry
setting. The recommendation was to use Javascript on startup, like this:
% firefox javascript:%20resizeTo\(1280,720\)
to call window.resizeTo() in JS. Testing, that doesn't work either. The linked page from MDN notes that with a few exceptions, this will not work post Firefox 7.
@helloV pointed me to: Launch Google Chrome from the command line with specific window coordinates
which is about position not size. Nevertheless, digging through it yielded these ideas that also don't work
NO:
chromium-browser --window-size=800,600
chromium-browser --window-size="800,600"
chromium-browser --window-size=800x600
chromium-browser -window-size=800,600
chromium-browser -window-size=800x600
We could always read the Firefox Command Line Options page (hint: window size isn't there) or the Chrome switches source code, where we will find --window-size=w,h
and that was tried above.
From: setting the window dimensions of a running application and a reading of man xdotool
:
This will resize a window after clicking it to select:
xdotool selectwindow windowsize 1280 720
Is there anything simpler or cleaner to start a browser window of specified pixel dimensions?