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

Drag-n-Drop to cygwin shell #337

Closed
mcatkins opened this issue Sep 23, 2015 · 17 comments
Closed

Drag-n-Drop to cygwin shell #337

mcatkins opened this issue Sep 23, 2015 · 17 comments

Comments

@mcatkins
Copy link

(I love ConEmu - thanks for it!)

If I drag-n-drop a file from Windows explorer onto cygwin bash running in a mintty window, the path is converted to Unix format, with "/cygdrive/c/" (or whatever), prepended. This is fantastically useful!

Could we have an option to do the same conversion of filenames when dropped on to a ConEmu tab/window? (The prefix could be an option, if it is not easy to work it out)

(I hope this isn't already there - I looked and couldn't find it :-) !)
Martin

@pyhedgehog
Copy link

-1

  1. Do you want to drop files in unix format to non-unix consoles? How unix console should be detected?
  2. How you propose to convert path to unix format? It's not just prepending "/cygdrive/". Mintty takes cygwin mounts into account. There are functions in cygwin dll - cygwin_conv_path() and relatives. They only can be called from cygwin process. Also there are cygwin binary - cygpath. You definitely don't want to create new process for each D&D.
  3. What about having several installations of cygwin on single computer (cygwin32 and cygwin64 for example). Mintty supposed to run binaries of same cygwin installation. How you propose to detect which cygwin to use?

@Maximus5
Copy link
Owner

@pyhedgehog That's too severily ;)

Bottom line. It's possible and most probably will be implemented.

@pyhedgehog
Copy link

What about SFU of other posix layer versions?

@Maximus5
Copy link
Owner

For example?

@pyhedgehog
Copy link

There was several similar packages:

  1. POSIX subsystem delivered with NT since 3.51 till 2000.
  2. Interix
  3. Microsoft Windows Services for UNIX (SFU).

@Maximus5
Copy link
Owner

No one of them are well known or used.

@Maximus5
Copy link
Owner

Build 151015

@pyhedgehog
Copy link

BTW:

  1. Thanks for referencing Apps+Ins. I was unaware of this feature.
  2. This feature has nothing near "cygwin path" it states. Real cygwin path should do same as cygpath -u do.

@Maximus5
Copy link
Owner

Ctrl-V now converts path automatically if current app is cygwin/msys

@kevin-stuart
Copy link

Is there any way to disabled this feature? The description for keyboard shortcuts mentions only that Ctrl+Alt+Shift+V autoconverts, but Ctrl+Shift+V does this as well. Maybe add this to the paste options page? I have a use case, where I need the verbatim paths and it is tedious to change paths after pasting.

@DRSDavidSoft
Copy link

DRSDavidSoft commented Oct 14, 2017

@Maximus5 Hey there, when I drag a file into a cmder (ConEmu) window, it replaces to the unix /cygdrive prefix. However, I've modified the /etc/fstab to "mount" the Windows drives inside /mnt/, like this:
/mnt/c/Users/David/Desktop

However, ConEmu doesn't use the correct path, but instead uses /cygdrive which doesn't exist.
This doesn't happen in mintty.exe, is uses the correct /mnt path.

What should I do in order to fix this behaviour?

image

image

@Maximus5
Copy link
Owner

You should use -new_console to define desired mount prefix.

@Maximus5
Copy link
Owner

Mintty is working "inside" cygwin workspace, but ConEmu is an external aggregator which starts cygwin shells.

@DRSDavidSoft
Copy link

DRSDavidSoft commented Oct 14, 2017

@Maximus5 Thanks for replying!
How would I call the cygwin.bat with the -new_console parameter? Is the switch being integrated into the below batch file correctly?

@echo off & cd /d %0\..
set PWD=%~1
set CMDER_ROOT=C:\development\cmder
set CYGWIN_ROOT=C:\development\cygwin
set BASH_COMMAND=pushd "%CYGWIN_ROOT%" ^& "%CYGWIN_ROOT%\bin\bash" --login -i -c 'cd "`cygpath -au '%PWD:\=/%'`"; exec bash' ^& popd
set CONEMU_SWITCHES=-new_console:m:/mnt -new_console:a
start "Cygwin Shell" %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CYGWIN_ROOT%\bin\mintty.exe" /title Bash /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /c "%BASH_COMMAND%" %CONEMU_SWITCHES%

cmderdev/cmder#1562 (comment)

@Maximus5
Copy link
Owner

start %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CYGWIN_ROOT%\bin\mintty.exe" /title Bash /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /c "%BASH_COMMAND%" that is absolutely crazy...

  1. You are trying to run mintty as ChildGui, that mean that you D&D into mintty, but not a ConEmu. But you said "This doesn't happen in mintty.exe"...
  2. mintty is minimalistics terminal for cygwin shells. If was not designed to run cmd.exe, completely. You'll get only problems from this usecase.
  3. ConEmu provides correct Tasks for all installed bash shells from the box. Read docs: https://conemu.github.io/en/Tasks.html

@DRSDavidSoft
Copy link

I think you misinterpreted the command line, I've used mintty.exe simply as the icon for the new tab:
/icon "%CYGWIN_ROOT%\bin\mintty.exe"
The purpose of the above batch file is load bash with the working directory set to a custom path %PWD%.
(Yes I know the correct way to do this is -new_console:d:%PWD% and I should have probably used it instead of the workaround I'm using, but it would have then only worked in ConEmu and not Console2, so I decided against the switch.)

In fact, I see when the Bash task is launched in ConEmu, the -new_console:m:/ switch is used:
set CHERE_INVOKING=1 & %ConEmuDir%\..\cygwin\bin\bash.exe --login -i -new_console:m:/cygdrive -new_console:C:"%ConEmuDir%\..\cygwin\Cygwin.ico"

task_bash_cgwin

Which means that as specified in the documentation, using -new_console:m:/mnt is the key!


Anyways, thanks for your time! I really appreciate the work and effort you've put into ConEmu. I first encountered it on a stackoverflow answer you made a while ago, and since then I've fallen in love with it! :)

context_menu

I guess I should make sure to read as much as the documentation as I can, to avoid using it incorrectly like you mentioned.

Cheers!

@Maximus5
Copy link
Owner

Yeah, I've missed -icon switch...

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

No branches or pull requests

5 participants