Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open chrome browser with given sizes

I am trying to launch chrome browser with a single tab window using this c# code:

Process process = new Process();
process.StartInfo.FileName = "chrome";
process.StartInfo.Arguments = url + " --new-window --window-size=640,480";
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();

The new window opens, but the size does not correspond to the size I passed along as argument. Does the command line switch of chrome "--window-size=x,y" not work?

Is there a different method available for this purpose.

like image 639
System Avatar asked Jun 20 '14 08:06

System


Video Answer


1 Answers

Looks like there is a know bug in chrome commandline switch.

Ref: http://www.ericdlarson.com/misc/chrome_command_line_flags.html "... Start the browser maximized, regardless of any previous settings. TODO(pjohnson): Remove this once bug 1137420 is fixed. We are using this as a workaround for not being able to use moveTo and resizeTo on a top-level window. --start-maximized ..."

One of the workaround that I can think of is as suggested by sorpigal using cmdow. Set The Window Position of an application via command line

like image 64
Jags Avatar answered Oct 07 '22 12:10

Jags