mikekazakov/nimble-commander

Commandline launcher

pshirshov opened this issue · 10 comments

It would be great to be able to open current working directory in NC directly from terminal.

Is there a way to do it now?

Maybe it's a good idea to provide a simple cli script by default?

You are looking for something like 'cdf', a oh-my-zsh plugin. osx-plugin
Just change the apple script to this

tell application "NimbleCommander"
  tell front window
    return name
  end tell
end tell

But this will only work when the window is not hidden or closed.

But this will only work when the window is not hidden or closed.

Eh, not a good option :(

Really, I would be happy to buy a couple of licenses, but this minor problem is a showstopper for me.

@pshirshov Actually it could work when you hide the window with cmd+H. But if you close the window with cmd+w. It won't work anyway. Only mike can help you with that.

tell application "NimbleCommander"
	if name of window 1 is "Hotkeys" then
		return name of window 2
	else
		return name of window 1
	end if
end tell

Actually I've checked double commander, it parses argv, so I can run

open /Applications/Double\ Commander.app/Contents/MacOS/doublecmd --args /tmp /Downloads

--args key belongs to open itself.

Could you do the same please?

I promise to purchase 2 licenses in case you may add this feature :)

@pshirshov I thought you want to cd to the current folder of NC in terminal. you actually want to do the opposite.
You could try

function odd() {
	osascript 2>&1 <<EOF
		tell application "NimbleCommander"
			activate
			ignoring application responses
				open ("$(pwd)" as string)
			end ignoring
		end tell
EOF
}

save this to your .bashrc or .zshrc.

I'm also hoping the developer would add more support for applescript or args.

It would't work in case the app is not running. Also it wouldn't allow me to open two directories in both the panels.

@pshirshov Not sure what's wrong on your side. But it could open when NC is closed.

function odf() {
        osascript <<EOF
                tell application "NimbleCommander"
                        activate
                        delay 0.5
                        ignoring application responses
                                open ("$1" as string)
                        end ignoring
                        delay 0.5
                        tell application "System Events"
                                key code 48
                        end tell
                        delay 0.5
                        ignoring application responses
                                open ("$2" as string)
                        end ignoring
                end tell
EOF
}

Try odf /Users ~

open -a 'Nimble Commander' . works for me.