henrikruscon / hyper-statusline

Status Line Plugin for Hyper
MIT License
390 stars 79 forks source link

Not working on windows #38

Closed apopek closed 6 years ago

apopek commented 7 years ago

I'm working on Windows 8.1 I'm in directory with github .git folder and nothing showing, no error messages in console

Hyper 1.2.1

windows

henrikruscon commented 7 years ago

Sorry doesn't currently support Windows. Hyper 1.2.0 was expected to bring Windows support by setting CWD but it doesn't. There's still no efficient & consistent method to fetch CWD on Windows.

apopek commented 7 years ago

So please add this information in README.md that windows is not supported, thanks.

henrikruscon commented 7 years ago

I'll look into adding it to Hyper myself through a PR ✌️

I'll leave this open until I either found a solution or added a disclaimer in readme.

jnsn commented 7 years ago

According to https://github.com/zeit/hyper/pull/1412, the "cwd" was added to the redux session, on the 15th of January.

My guess is that it's available in current releases then?

henrikruscon commented 7 years ago

@jnsn Sadly it doesn't do anything. Confirmed in the commit: https://github.com/zeit/hyper/commit/232295a195141810390113ff2d9e04efa737c4e3

I'm still looking to PR this myself but I've been really busy with work lately.

postromantic commented 7 years ago

lsof -p {pid} can be replaced with handle -p {pid} for windows. But there is a bug in Hyper: pid is always incorrect on windows. It's node-pty issue: https://github.com/Tyriar/node-pty/issues/67

Stanzilla commented 7 years ago

@postromantic Hyper is now on 0.6.4 of node-pty. handle is a Sysinternals tool and does not come with Windows, so not sure that helps? If yes, how would you use it?

@henrikdahl If you still want to implement it in Hyper, I think this is a good start https://github.com/zeit/hyper/issues/1357#issuecomment-288562100

postromantic commented 7 years ago

@Stanzilla, thanks. i've tried to use handle with latest version, but it's not as good as i expected. The issues are:

  1. handle returns multiple file handles. for bash it's ok (cause cwd is always first handle), but for cmd it's random file handles so no way to pick the right one. powershell doesn't expose cwd as file handle at all
  2. bash on windows usually run with parent process (for instance, i'm using git-cmd.exe --command=/usr/bin/bash.exe) so you have to lookup for a child pid. it's quite easy, but very slow: wmic process where (ParentProcessId=${pid}) get ProcessId

So it doesn't work well. The right way is to track cwd in wintpy, similar to ConEmu/ConsoleZ.

I'm using another approach now: set bash prompt to show cwd in title and subscribe to SESSION_SET_XTERM_TITLE event to set current cwd in the hyper-statusline. Hacky, but works well for me.

Stanzilla commented 7 years ago

@postromantic do you have the code for that somewhere?

postromantic commented 7 years ago

@Stanzilla sure https://gist.github.com/postromantic/b0456349819aa3031992999137f42167 https://gist.github.com/postromantic/47017c4aebca98e4bfb24b65737de4ba

Nicholaiii commented 7 years ago

Waiting eagerly for this! hyper-statusline is so sexy, and I can get rid of cwd clutter in my terminal.

dougd commented 7 years ago

I've submitted a PR for my attempt to fix the issue on Windows. It is not 100% perfect but works good enough for me (I'm on Windows 7) - and better than the existing solution which doesn't work on Windows at all :-)

Pandawan commented 7 years ago

Wait, can't you easily get the CWD with the chdir command?

Stanzilla commented 7 years ago

You can but good luck trying to use that in a script. Getting it into a variable is not trivial.

Stanzilla commented 7 years ago

Does this help? https://github.com/Tyriar/node-pty/commit/d33cc1c6d904aa870dd2769f6176282d07bd6ee7

dougd commented 7 years ago

Looks promising - how do we get that available?

henrikruscon commented 6 years ago

In next release ✌️ #73