Jump to content

Alfred as DTerm replacement?


Recommended Posts

DTerm is useful and nice enough that it probably doesn't exactly need replacing. But as since finding Alfred I've been able to ditch so many other little utilities, I'm just wondering if it would be feasible to write a workflow that would do DTerm's job. I'm a developer, but have a genetically-predisposed horror of AppleScript, so don't offhand know if this is feasible. Would be interested in opinions.

 

DTerm is a great little app that allows you to run shell commands from its own mini-terminal, but the magic is that it sets its working directory to wherever the frontmost app window's open document is located. Which is great -- you can, for example, be in an editor/IDE, pop up DTerm (with a keyboard shortcut) and run git commands from the directory of the file you're currently editing.

 

It can also optionally run a command in a real Terminal (or iTerm) window if desired.

 

Could this functionality be replicated in an Alfred workflow?

 

 

 

Link to comment

DTerm is useful and nice enough that it probably doesn't exactly need replacing. But as since finding Alfred I've been able to ditch so many other little utilities, I'm just wondering if it would be feasible to write a workflow that would do DTerm's job. I'm a developer, but have a genetically-predisposed horror of AppleScript, so don't offhand know if this is feasible. Would be interested in opinions.

 

DTerm is a great little app that allows you to run shell commands from its own mini-terminal, but the magic is that it sets its working directory to wherever the frontmost app window's open document is located. Which is great -- you can, for example, be in an editor/IDE, pop up DTerm (with a keyboard shortcut) and run git commands from the directory of the file you're currently editing.

 

It can also optionally run a command in a real Terminal (or iTerm) window if desired.

 

Could this functionality be replicated in an Alfred workflow?

 

Some of it. DTerm uses the Accessibility API and Scripting Bridge to determine the path for the front-most app. You'd have to rip the code from DTerm (https://github.com/bdrister/dterm) that gets that front-most path or selected files in Finder/PathFinder and create an executable that spits out the path(s). Wire up an Alfred hotkey to that code and do what you like with the results.

Link to comment

Some of it. DTerm uses the Accessibility API and Scripting Bridge to determine the path for the front-most app. You'd have to rip the code from DTerm (https://github.com/bdrister/dterm) that gets that front-most path or selected files in Finder/PathFinder and create an executable that spits out the path(s). Wire up an Alfred hotkey to that code and do what you like with the results.

 

Thanks, I didn't know the DTerm source code was available. Must have a look through it when I have a moment.

Link to comment

Here you go: dterm-ish.applescript

 

I'm playing around with making this into a workflow, so you can run scripts in the background and get file/command suggestions while you type. It's not ready yet, but hopefully that custom terminal script holds you over for now.  :)

 

That's a terrific start, thanks. Look forward to anything further you do along these lines. Be sure to tweet about them!

 

Looking through the code tends to confirm my Applescript prejudice. It's very readable, but it triggers memories of trying to write applescripts, and it seeming more like a trial-and-error process ("which Englishy locution works where?") than any other programming language I've ever tinkered with.

Link to comment
  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...