Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch Google Chrome from the command line with specific window coordinates

I'm trying to find a shell command that will open Google Chrome with specific x and y coordinates (so that I can set the position of the window when it opens.) Is it possible to do this using command line-arguments?

I need to modify the following command in order to achieve this:

google-chrome http://www.google.com/

like image 200
Anderson Green Avatar asked Nov 18 '12 02:11

Anderson Green


People also ask

How do I open Chrome from command line?

Open Chrome Using Command Prompt You can also do the same thing from the “Run” window. Open Run by typing “Run” in the Windows 10 search bar and selecting the “Run” application. Here, type Chrome and then select the “OK” button. The web browser will now open.

How do I run Chrome from Linux command line?

Install the downloaded Chrome package. To install Chrome from the downloaded package, use the following command: Type sudo dpkg -i google-chrome-stable_current_amd64. deb and press Enter.

How do I change Chrome command line?

Exit any running-instance of Chrome. Right click on your "Chrome" shortcut. Choose properties. At the end of your "Target:" line add the command-line switch.


1 Answers

When you're using Google's Chrome, there is a shorter way:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"       --profile-directory="Default"      --app="data:text/html,<html><body><script>window.moveTo(580,240);window.resizeTo(800,600);window.location='http://www.test.de';</script></body></html>" 

Pro:

  • Automatically opens the window
  • Avoids the popup-blocker
  • Opens multiple windows on different monitors (multi monitor setup, requires two or more Chrome profiles)

Con:

  • Only seems to work in "app" Mode
  • Not tested with other browsers
like image 68
nitram509 Avatar answered Sep 17 '22 13:09

nitram509