nimble-commander icon indicating copy to clipboard operation
nimble-commander copied to clipboard

Commandline launcher

Open pshirshov opened this issue 6 years ago • 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?

pshirshov avatar Apr 20 '19 20:04 pshirshov

Perhaps calling a Service might help? http://magnumbytes.com/forum/viewtopic.php?f=5&t=365

mikekazakov avatar Apr 21 '19 16:04 mikekazakov

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

pshirshov avatar Apr 21 '19 17:04 pshirshov

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.

duhd1993 avatar Oct 13 '19 15:10 duhd1993

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 avatar Oct 13 '19 21:10 pshirshov

@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

duhd1993 avatar Oct 13 '19 21:10 duhd1993

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 avatar Oct 16 '19 23:10 pshirshov

@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.

duhd1993 avatar Oct 17 '19 00:10 duhd1993

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 avatar Oct 17 '19 01:10 pshirshov

@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 ~

duhd1993 avatar Oct 17 '19 01:10 duhd1993

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

sapegin avatar Mar 19 '24 08:03 sapegin