smenu icon indicating copy to clipboard operation
smenu copied to clipboard

Windows support?

Open ncovercash opened this issue 6 years ago • 7 comments

Sadly enough I have to ask this. Is windows support planned? It could possibly be as simple as compiling to a .exe with visual studio's tools, however that is not my expertise. With MinTTY and all most unix builtins are supported already.

ncovercash avatar Jan 16 '18 06:01 ncovercash

Sorry, there is no expected version for Windows in the near future but I am open to contributions as long as they respect the KISS principle.

p-gen avatar Jan 16 '18 15:01 p-gen

Both the Windows Subsystem for Linux and Docker for Windows might provide a reasonable shortcut. If I can come up w/ some working instructions, I'll post them here for possible inclusion in the readme/wiki?

Although, perhaps the real issue is Windows console PTY support (although, that's upcoming, too).

AnthonyMastrean avatar Sep 10 '18 19:09 AnthonyMastrean

Thank you, if it's possible I'll have a look.

Note that smenu does not use ptys, ptys are only used by the test system that uses my other small tool: ptylie.

p-gen avatar Sep 10 '18 19:09 p-gen

I wrote a quick Dockerfile, which you can build locally

$ docker build --tag smenu .

Or, you can use the image I published to hub.docker.com.

$ docker pull anthonymastrean/smenu

Since it appears that smenu only takes input on STDIN, you need to use a little function (this runs OK in Git Bash, the only usable Windows port of Bash that I know of). Bash also seems to pass all unbound parameters to the function body (this is good; it's quite a bit more difficult to make this work in PowerShell, which I may explore).

$ function smenu { docker run --rm -it --name smenu anthonymastrean/smenu; }

You should be able to run the example in the README now... except I get this error (which I'm having trouble making sense of)

$ echo $(grep Vm /proc/$$/status | smenu -n20 -W $':\t\n' -q -c -b -g -s /VmH)
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

When I Google the error, I get articles like this one; but, I'm sure that I've installed Git for Windows correctly.

image

Let's try this winpty thing

$ function smenu { winpty docker run --rm -it --name smenu anthonymastrean/smenu; }
$ echo $(grep Vm /proc/$$/status | smenu -n20 -W $':\t\n' -q -c -b -g -s /VmH)
stdin is not a tty

😭

OK, so, it appears I have no idea how this whole STDIN/TTY thing works between Bash and Docker on Windows.

AnthonyMastrean avatar Oct 01 '18 16:10 AnthonyMastrean

Thank you for your work, Note that smenu can also read its words from a file (see the SYNOPSIS and DESCRIPTION parts in the manual). E.g. smenu -- file or simply smenu file when there is no ambiguity)

p-gen avatar Oct 02 '18 23:10 p-gen

Uh-oh, now I'm thinking about doing something silly like...

function smenu {
    cat > /tmp/smenu
    docker run --rm -it -v /tmp/smenu:/tmp/smenu --name smenu anthonymastrean/smenu "$@" -- /tmp/smenu
}

AnthonyMastrean avatar Oct 03 '18 16:10 AnthonyMastrean

At this point, I'd say it's probably better to actually compile w/ VC++ or something rather than chasing this Docker for Windows rabbit hole 🤷‍♂️ 🤗

AnthonyMastrean avatar Oct 03 '18 16:10 AnthonyMastrean