From d6c8d69079c0adc9a0c61c1aae449c70e83f9609 Mon Sep 17 00:00:00 2001 From: kvii <13721952202@163.com> Date: Mon, 2 Dec 2024 11:29:58 +0800 Subject: [PATCH] feat: add wrap for window-size and window-position flag --- lib/launcher/flags/flags.go | 6 ++++++ lib/launcher/launcher.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/launcher/flags/flags.go b/lib/launcher/flags/flags.go index f21605da..2b8b2994 100644 --- a/lib/launcher/flags/flags.go +++ b/lib/launcher/flags/flags.go @@ -27,6 +27,12 @@ const ( // ProxyServer flag. ProxyServer Flag = "proxy-server" + // WindowSize flag. + WindowSize Flag = "window-size" + + // WindowPosition flag. + WindowPosition Flag = "window-position" + // WorkingDir flag. WorkingDir Flag = "rod-working-dir" diff --git a/lib/launcher/launcher.go b/lib/launcher/launcher.go index 92436c84..4926b376 100644 --- a/lib/launcher/launcher.go +++ b/lib/launcher/launcher.go @@ -337,6 +337,16 @@ func (l *Launcher) Proxy(host string) *Launcher { return l.Set(flags.ProxyServer, host) } +// WindowSize for the browser. +func (l *Launcher) WindowSize(x, y int) *Launcher { + return l.Set(flags.WindowSize, fmt.Sprintf("%d,%d", x, y)) +} + +// WindowPosition for the browser. +func (l *Launcher) WindowPosition(x, y int) *Launcher { + return l.Set(flags.WindowPosition, fmt.Sprintf("%d,%d", x, y)) +} + // WorkingDir to launch the browser process. func (l *Launcher) WorkingDir(path string) *Launcher { return l.Set(flags.WorkingDir, path)