Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Hidden window" mode #510

Open
arcanis opened this issue Jun 11, 2016 · 15 comments
Open

"Hidden window" mode #510

arcanis opened this issue Jun 11, 2016 · 15 comments
Labels

Comments

@arcanis
Copy link

arcanis commented Jun 11, 2016

It would be nice to be able to run GUI utilities without having the console window displayed. For example, I've made a shortcut to C:\Windows\System32\bash.exe -c "DISPLAY=localhost:0.0 uxterm", but when I run it I end up with two windows (the extra one being unresponsive).

@arcanis
Copy link
Author

arcanis commented Jun 11, 2016

I've tried start /B bash -c "DISPLAY=localhost:0.0 nohup uxterm &" && exit, but with no avail :(

Same thing with disown: exiting the bash shell also exits all child processes.

Also tried powershell -WindowStyle hidden -Command bash -c "DISPLAY=localhost:0.0 uxterm", nope.

@arcanis
Copy link
Author

arcanis commented Jun 11, 2016

I've finally succeded with the following:

powershell -windowstyle hidden -command "&{ bash -c 'DISPLAY=localhost:0.0 uxterm' }"

However, there's still a quick window flash when the command starts, but have no idea how to remove it.

@dertuxmalwieder
Copy link

I second that. The PowerShell shortcut works but it has usability issues.

@onomatopellan
Copy link

From build 17666 release notes

Add --exec option for wsl.exe to invoke a single binary without a shell.

Maybe it's what you are looking for.

@dertuxmalwieder
Copy link

>wsl --exec <my application here>
/bin/bash: --: invalid option

I don't seem to have build 17666 yet. :-)

@onomatopellan
Copy link

onomatopellan commented May 16, 2018

Only Insiders in the fast Ring can try it. Others will need to wait for Fall 2018 Update.

@dertuxmalwieder
Copy link

Thank you. I'll wait.

@benhillis
Copy link
Member

They functionality is will still launch a console. It it mainly a way to launch a particular binary without invoking it through $SHELL -c command. Useful if you hosed your /etc/passwd file or set your default shell to one that doesn't work.

@onomatopellan
Copy link

@benhillis I see, thanks for the clarification.

@therealkenc
Copy link
Collaborator

Useful if you hosed your /etc/passwd file or set your default shell to one that doesn't work.

But that was fixed, no?

@benhillis
Copy link
Member

The former, not the later. Let's say you're a sadomasochist and set your root user's shell to echo.

@therealkenc
Copy link
Collaborator

Got it. That makes sense. It is useful for other stuff too 😉.

@benhillis
Copy link
Member

@therealkenc - Exactly!

@therealkenc
Copy link
Collaborator

Now you just need to fix up the signature of WslLaunch. It looks like:

int execve(const char *filename, char *const argv[], char *const envp[]);

It is interactive unless the caller close()ed fd 0/1/2, naturally.

@hugmanrique
Copy link

This ranks high on my list of hacks:

  1. Create runhidden.vbs file with the following contents:
CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False
  1. Run the script with wscript:
wscript "[SCRIPT_LOCATION]\runhidden.vbs" "wsl code ~"

The window flash is gone! wscript is the .exe version of cscript, which is used to run the VB script. This script was made by harrymc and is available at https://superuser.com/a/62646/1047024 (Solution 1, 3rd script)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants