From e863c75b7668a0ed8a8505bca83216bfc1ace205 Mon Sep 17 00:00:00 2001 From: Jrelvas <55360900+jrelvas-ipc@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:30:20 +0000 Subject: [PATCH 1/4] Do not show wine's prefix init/update window wineboot shows an annoying window whenever it inits or updates a prefix. Prevent that by setting DISPLAY and WAYLAND_DISPLAY envs to nothing. this commit also fixes a minor spelling error with a related comment ;) --- wine/cmd.go | 11 ++++++++++- wine/wine.go | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/wine/cmd.go b/wine/cmd.go index 92d0477..2ecdf9d 100644 --- a/wine/cmd.go +++ b/wine/cmd.go @@ -38,6 +38,16 @@ func (p *Prefix) Command(name string, arg ...string) *Cmd { } } +// Headless prevents command from showing windows +func (c *Cmd) Headless() *Cmd { + c.Env = append(c.Environ(), + "DISPLAY=", + "WAYLAND_DISPLAY=", + ) + + return c +} + // Refer to [exec.Cmd.Run]. func (c *Cmd) Run() error { if err := c.Start(); err != nil { @@ -45,7 +55,6 @@ func (c *Cmd) Run() error { } return c.Wait() } - // Refer to [exec.Cmd.Start] and [Command]. func (c *Cmd) Start() error { if c.Process != nil { diff --git a/wine/wine.go b/wine/wine.go index fbf2c28..a64471d 100644 --- a/wine/wine.go +++ b/wine/wine.go @@ -120,14 +120,14 @@ func (p *Prefix) Kill() error { return p.Wine("wineboot", "-k").Run() } -// Init preforms initialization for first Wine instance. +// Init performs initialization for first Wine instance. func (p *Prefix) Init() error { - return p.Wine("wineboot", "-i").Run() + return p.Wine("wineboot", "-i").Headless().Run() } // Update updates the wineprefix directory. func (p *Prefix) Update() error { - return p.Wine("wineboot", "-u").Run() + return p.Wine("wineboot", "-u").Headless().Run() } // Version returns the wineprefix's Wine version. From 5a6bf7ee9433201549a746bff323fdc9b2aa08f7 Mon Sep 17 00:00:00 2001 From: Jrelvas <55360900+jrelvas-ipc@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:33:52 +0000 Subject: [PATCH 2/4] cmd.go: Remove unnecessary newline in Headless() --- wine/cmd.go | 1 - 1 file changed, 1 deletion(-) diff --git a/wine/cmd.go b/wine/cmd.go index 2ecdf9d..4ad92e1 100644 --- a/wine/cmd.go +++ b/wine/cmd.go @@ -44,7 +44,6 @@ func (c *Cmd) Headless() *Cmd { "DISPLAY=", "WAYLAND_DISPLAY=", ) - return c } From 143dc94800cadf763b6c399740839eb9d71b5f23 Mon Sep 17 00:00:00 2001 From: Jrelvas <55360900+jrelvas-ipc@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:55:48 +0000 Subject: [PATCH 3/4] registry.go: Use Headless method in RegistryAdd Prevents wineboot init window from showing up when modifying reg of uninit'ed prefix. This fixes the issue where the window showed up with studio prefix init. --- wine/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wine/registry.go b/wine/registry.go index 6d34df1..9bf41cb 100644 --- a/wine/registry.go +++ b/wine/registry.go @@ -24,5 +24,5 @@ func (p *Prefix) RegistryAdd(key, value string, rtype RegistryType, data string) return errors.New("no registry key given") } - return p.Wine("reg", "add", key, "/v", value, "/t", string(rtype), "/d", data, "/f").Run() + return p.Wine("reg", "add", key, "/v", value, "/t", string(rtype), "/d", data, "/f").Headless().Run() } From 2603e2ba87e16f893d14d46c8a8d4258cd02d9bd Mon Sep 17 00:00:00 2001 From: jrelvas <55360900+jrelvas-ipc@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:30:21 +0000 Subject: [PATCH 4/4] cmd: set WINEDEBUG envvar in cmd.Headless() to suppress window-related errors --- wine/cmd.go | 1 + 1 file changed, 1 insertion(+) diff --git a/wine/cmd.go b/wine/cmd.go index 4ad92e1..a589583 100644 --- a/wine/cmd.go +++ b/wine/cmd.go @@ -43,6 +43,7 @@ func (c *Cmd) Headless() *Cmd { c.Env = append(c.Environ(), "DISPLAY=", "WAYLAND_DISPLAY=", + "WINEDEBUG=fixme-all,-winediag,-systray,-ole,-winediag,-ntoskrnl", //Suppress window-related errors ) return c }