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

Using the context menu "Cmder Here" should create a new tab (if there's existing terminal) instead of creating a new window #1645

Closed
arvilmena opened this issue Feb 6, 2018 · 13 comments

Comments

@arvilmena
Copy link

Hello mates :)

Do we have an already existing way to enable this:

  1. Say, I already have an existing CMDER window
  2. I go to D:/somewhere/directory, Right click -> Cmder Here
  3. I wish that the CMDER terminal that will open to go to the already existing window as a new tab (only if there's already existing window, if none, create a new one)

Is this possible? Because my screen is clustered with too many terminal :(

Regards,

@DRSDavidSoft
Copy link
Contributor

Since this issue is related to how ConEmu works, a modification based on this would work (I use a variation of that myself).

The question is, whether the moderators approve of changing the default behavior in favor of tabs.

Personally I think using tabs is a much better solution, and a window per context menu is pointless.

@mew1033
Copy link

mew1033 commented Dec 7, 2018

@DRSDavidSoft Can you explain a little more how you got this working?

@DRSDavidSoft
Copy link
Contributor

@mew1033 Cmder launches ConEmu by calling it from the Cmder.exe binary.

You'll have to either compile Cmder.exe with this option built it, or modifying the Registry key for the context menu to run ConEmu with the switch directly.

I went with the latter at the time of writing my comment.


@daxgames Could you add this option to the launcher code?
e.g. Cmder.exe /newtab %v could be used to open a new tab in ConEmu.

@Puggers
Copy link

Puggers commented Mar 15, 2019

@DRSDavidSoft Sorry to bother you with this, but I am really not versed in dealing with registry files, I was hoping you would have a sample of what the registry key should look like with this modification?

@mew1033 Cmder launches ConEmu by calling it from the Cmder.exe binary.

You'll have to either compile Cmder.exe with this option built it, or modifying the Registry key for the context menu to run ConEmu with the switch directly.

I went with the latter at the time of writing my comment.

@daxgames Could you add this option to the launcher code?
e.g. Cmder.exe /newtab %v could be used to open a new tab in ConEmu.

@daxgames
Copy link
Member

Just use latest cmder 1.3.11 and register with cmder /register /single. Works for me to open a new tab in an existing window.

@GF-Huang
Copy link

GF-Huang commented Apr 5, 2019

@daxgames Can you tell me the step by step ?

@daxgames
Copy link
Member

daxgames commented Apr 5, 2019

Read the above post

@DRSDavidSoft
Copy link
Contributor

DRSDavidSoft commented Apr 5, 2019

@greatfirewall Since it may be a bit confusing, I'll explain in detail:

  • When you download the Cmder .zip file, it will contain a file with this name: Cmder.exe
    This is called the cmder launcher and it's used in Cmder to open a terminal.

  • One of the things that the launcher do is registering the context menu for windows.
    How does it do it? By running the .exe file with the switch: cmder.exe /register.
    You can type it in a terminal while you're in the cmder directory (e.g. C:\apps\cmder)

    So, if you execute the switch that I mentioned above, then Cmder will install the context menu.

  • Now, we get to the part that @daxgames said. In cmder version 1.3.11 (and above), a new switch has been added to the launcher, that allows you to register Cmder with the single instance windows enabled:

    cmder.exe /register /single
    

    What does that mean? well, the /single switch means that any new cmder terminals will open in a new tab instead of a new window.

NOTE 1: You can omit the .exe extension (and any other path extensions) in Windows, hence why @daxgames wrote cmder /register /single.

NOTE 2: To use this, you must update to the latest version of Cmder (which is 1.3.11 as of writing this).

I hope this helps! :)

@GF-Huang
Copy link

GF-Huang commented Apr 5, 2019

@DRSDavidSoft Thank you ! Solved !

@DRSDavidSoft
Copy link
Contributor

DRSDavidSoft commented Apr 5, 2019

@greatfirewall You're welcome, I'm happy to help :)

A couple of more notes:

You can read more about what the switch actually does in ConEmu here:
https://conemu.github.io/en/ConEmuArgs.html

@GF-Huang
Copy link

By the way, How can I do Cmder Here as Administrator ?

@DRSDavidSoft
Copy link
Contributor

DRSDavidSoft commented Apr 25, 2019

@greatfirewall

  1. Do you want to have one Cmder Here that opens as administrator, or to have two options like Cmder Here and Cmder Here as Administrator?

  2. In any case, I suggest to use csudo instead of always starting in administrator mode. For example, type csudo notepad.exe, csudo nano.exe, etc. when you're in Cmder window to run an executable (such as notepad.exe and nano.exe) as administrator.

    You can even get a new Cmder as administrator window, by running csudo cmder. This only works if you're on the latest version, and have added [cmder_root] to your %PATH%.

  3. If you want to always start Cmder as administrator, the -new_console:a conemu switch should be used (the a stands for administrator).

    I'm not sure how it should be handled -- but it should either be included in the cmder.exe launcher code, or by modifying the default ConEmu settings.

  4. Additionally, using the windows' UAC elevation would also do the trick, there are several programs available that can elevate the executable.


P.S. To see how your context menu is set-up, go to here (Win + Rregedit.exe):

HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder

From the toolbar, go to FileExport and save the file (e.g. my_cmder.reg).

Then attach it to your comment (by dragging and dropping it), so I can see how your current Cmder context menu is set-up.

@GF-Huang
Copy link

@DRSDavidSoft Thanks for your detail guide.

Yes, I want to have Cmder Here and Cmder Here as Administrator both.

Currently, I use cmder.exe /register /single register for Cmder Here, so I want to make Cmder Here as Administrator single also. Is this possible ?

This is my HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder:

image
image

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

6 participants