Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
608 views
in Technique[技术] by (71.8m points)

bash - 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/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

"C:Program Files (x86)GoogleChromeApplicationchrome.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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...