fig icon indicating copy to clipboard operation
fig copied to clipboard

Integrate Fig with Windows

Open brendanfalk opened this issue 3 years ago • 36 comments

Fig currently works on macOS only. We will build a port that integrates with Windows soon.

Please subscribe to this issue to get an update when Fig's autocomplete integration with the Window is ready :smile:

brendanfalk avatar Feb 19 '21 04:02 brendanfalk

super work

SJanJan avatar Sep 30 '21 02:09 SJanJan

Commenting to get updates - it's really useful, I hope to see a Windows release soon!

you could just click on the 'watch' button at the top

jacobra19 avatar Nov 12 '21 11:11 jacobra19

I can hardly wait!

felix-berlin avatar Dec 05 '21 15:12 felix-berlin

Maybe the best approach for this one is trying to write an app like https://github.com/microsoft/terminal/tree/main/samples that consumes the new Windows Console APIs. Support for zsh/bash/fish first via WSL and Windows Console APIs could be a good MVP. Powershell in MVP 2.

ayr-ton avatar Dec 15 '21 19:12 ayr-ton

Hey everyone! Thank you for your patience. We are super excited about bringing Fig to Windows, but there is lots of work to do before this is possible.

There are at least 7 core functions that need to be built out in order for us to release autocomplete to Windows.

  1. We need to be able to determine the location of the cursor in a 3rd party app.

This seems possible using Microsoft Active Accessibility APIs.

Other Resources

  1. We need to be able to determine what you've typed in the terminal

This means porting our pseudoterminal layer (figterm) to Window. We need to do some research to understand how this should work on a non-UNIX system. See ConPTY

  1. We need to do IPC between our CLI tools and our GUI app. On macOS (and Linux) we use UNIX domain sockets. I am not sure about the equivalent on Windows.

  2. We need to be able to position a 'floating' window overlay on top of 3rd party applications.

  3. We need intercept certain keystrokes to prevent them from being handled by the shell. This can be implemented at the OS level or potentially at the pseudoterminal level.

  4. We need to port over the Fig.js API to Windows. This is the subsystem that links our TypeScript autocomplete engine with native OS functionality.

  5. We need to install our shell integrations. This entails research & experimentation with how shells work on Windows. eg. What is the difference between Cygwin, MSYS/MinGW, git bash and WSL? Which should we support? Where are bashrc and bash_profile equivalents located?

See "How can I use a bash-like shell on Windows" for more details. Also: "Launching a daemon from WSL"

If you have any insight on how to solve these challenges, please comment below or join our #cross-platform channel on Discord. ❤️

mschrage avatar Jan 19 '22 21:01 mschrage

@mschrage I think UNIX domain sockets are available on Windows: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ I don't know if the implementation is more complete nowadays or if it's still lacking the missing features mentioned in the linked article. I also don't know which features you need so the implementation might be enough for your usecase.

levrik avatar Jan 20 '22 08:01 levrik

I think winpty could be a great starting point for pseudo-console implementation. It is known to work well with other UNIX-like software as well.

BasixKOR avatar Jan 20 '22 08:01 BasixKOR

Regarding #1 in the list above, it may be worthwhile to add native support to windows terminal rather than have it be an accessibility hack

ntindle avatar Jan 21 '22 22:01 ntindle

@levrik I didn't know about that Windows had added support for AF_UNIX socket networking. That's awesome.

@BasixKOR I will look into winpty! Our pseudoterminal is written in Rust, so we'll need to figure the right approach / library.

@ntindle does Windows Terminal have support for GUI plugins like Fig? If you have any links to documentation on this or thoughts on how to implement native support, please let me know.

mschrage avatar Jan 25 '22 18:01 mschrage

I understand that Windows terminal support is not done yet, but I'm a bit confused about vscode on Windows, because your README writes that it works on vscode terminal. I assume it only works on vscode terminal on MacOS, right?

digeomel avatar Jan 28 '22 09:01 digeomel

Here's the master feature list for extensions on Windows Terminal.

https://github.com/microsoft/terminal/issues/4000

As far as I can tell, the command palette is fully extensible but doesn't provide the sort of inline support you're probably looking for. They seem very open to feature requests though

RyKilleen avatar Jan 28 '22 14:01 RyKilleen

The "Hyper" terminal from Vercel runs on Windows as well as MacOS. It'd be great to see Fig work with Hyper on Windows 11, at least, even if Windows Terminal integration doesn't work yet.

pcgeek86 avatar Jan 31 '22 05:01 pcgeek86

@digeomel that's exactly right. Fig supports VSCode, but only on macOS.

@pcgeek86 Same thing for Hyper.

mschrage avatar Jan 31 '22 21:01 mschrage

What is the unix-like environment you use on Windows most often?

I'm assuming WSL, but I could be completely wrong.

mschrage avatar Feb 04 '22 22:02 mschrage

Usually WSL through windows terminal , but I also use git bash occasionally through windows terminal….I believe it runs msys2 or something like that On Feb 4, 2022, 4:02 PM -0600, Matt Schrage @.***>, wrote:

What is the unix-like environment you use on Windows most often? I'm assuming WSL, but I could be completely wrong. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jasonwashburn avatar Feb 04 '22 22:02 jasonwashburn

I actually almost never use WSL, I use Git Bash (via Windows Terminal), with Zsh installed on top of it.

TheOnlyTails avatar Feb 04 '22 23:02 TheOnlyTails

I also always use Git Bash

kidsamort avatar Feb 21 '22 16:02 kidsamort

Honestly I mostly just use Powershell; not WSL or Git Bash.

MystPi avatar Feb 21 '22 16:02 MystPi

I always use git bash :)

Lioness100 avatar Feb 23 '22 15:02 Lioness100

Terminal: Windows Terminal Default Shell: Powershell Core (Not sure if it matters, but a heads up: there's the default, older version of Powershell and there's Powershell Core, which is the better, open source version, that also runs on Linux and MacOS) *Nix env: WSL Ubuntu with Bash/Fish (but I rarely need it)

-- Used Cygwin in the past (feels like a lifetime ago) -- Never understood why Git Bash even exists

ionut-botizan avatar Feb 23 '22 17:02 ionut-botizan

Please consider adding support for Tabby on Windows. https://tabby.sh/

sergiubacioiu avatar Feb 24 '22 20:02 sergiubacioiu

WSL when using VS Code terminal, Git Bash otherwise.

resonancedesigns avatar Feb 26 '22 00:02 resonancedesigns

I use Cmder, works really well.

syedfaizan avatar Mar 09 '22 14:03 syedfaizan

I also use Tabby, which is written in TypeScript and allows for plugins - a Tabby Plugin would be fantastic!

joshuajeschek avatar Mar 09 '22 16:03 joshuajeschek

Hope to support alacritty.

hxse avatar Mar 10 '22 08:03 hxse

Some exciting progress to share!

https://user-images.githubusercontent.com/3155109/159592632-d0b229b2-e4cc-447e-be2f-64308640e366.mp4

We've located the caret position, can determine what text has been typed, and got IPC working on Windows. 🥳 There is still lots to do, but some of the key technical challenges have been solved!

We likely will focus on WSL at first and then branch out to support other environments, like git bash and Powershell.

mschrage avatar Mar 22 '22 23:03 mschrage

@mschrage Wow. Is Fig written in Rust? This r#type looks very familiar. Also seeing a .cargo-lock file in the directory.

levrik avatar Mar 23 '22 07:03 levrik

@levrik Looking at the executable icon, it's a tauri app (https://github.com/tauri-apps/tauri) so yes it's built with Rust.

florian-lefebvre avatar Mar 23 '22 17:03 florian-lefebvre

Good eye @florian-lefebvre!

@levrik To answer your question: yes, we use Rust! 🦀

mschrage avatar Mar 23 '22 18:03 mschrage

@mschrage And few hours later I received your newsletter mentioning usage of Rust for at least your CLI 😅

levrik avatar Mar 24 '22 06:03 levrik