zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.06k stars 2.96k forks source link

Open current folder on shortcut icon #14388

Open rcarlier opened 3 months ago

rcarlier commented 3 months ago

Check for existing issues

Describe the feature

Maybe it's a setting that I'm unaware of, but I can't configure a shortcut on the finder to open Zed in the current folder (like when you drag&drop on the icon)...

If this is not possible, it would be an interesting feature

If applicable, add mockups / screenshots to help present your vision of the feature

zed

dtonda8 commented 3 months ago

It's possible :) Inspired by this

  1. Open Automation
  2. Choose "Application"
  3. Search for "Run Shell Script" and Drag & Drop onto workspace on the right
  4. Enter this command (assuming you have zed installed with homebrew)
    finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
    /opt/homebrew/bin/zed "$finderPath"

    Should look like this:

image

  1. Save file with the name of your choice
  2. Add it to toolbar (like this)

Optional: follow the link above to change icon image

Final result:

https://github.com/user-attachments/assets/ea9fed34-8869-4ae9-82ee-a5f37ed96b32

Moshyfawn commented 3 months ago

Thanks @dtonda8!

@rcarlier https://github.com/zed-industries/zed/issues/14388#issuecomment-2226876648 satisfy your use-case?

rcarlier commented 3 months ago

Yes ! I have installed via download, so the automator line must be:

finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
/Applications/Zed.app/Contents/MacOS/zed "$finderPath"

Many thank's