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

iTerm2 Plugin Fails to Run in iTerm? #2086

Closed
timvisher opened this issue Aug 14, 2015 · 9 comments
Closed

iTerm2 Plugin Fails to Run in iTerm? #2086

timvisher opened this issue Aug 14, 2015 · 9 comments

Comments

@timvisher
Copy link

When trying to run Run a Text Command in iTerm, nothing happens and this gets spit out in the logs.

Is this the appropriate place to log this issue. Anything I can do to help fix it?

I'm on iTerm2 Build 2.9.20150810-nightly.

@skurfer
Copy link
Member

skurfer commented Aug 14, 2015

Probably the same thing described in quicksilver/iTerm2-qsplugin#5

Is this the appropriate place to log this issue.

Yes.

Anything I can do to help fix it?

Feel like updating the AppleScript in the plug-in? I don’t use iTerm.

@jasmas
Copy link

jasmas commented Feb 5, 2016

I started work on this, but actually started to refactor as a new plugin called iTerm3 because 2.9 will release as iTerm3 when stable. I'm not sure if some detection code would be possible or better. The bundle identifier will likely change when it releases as stable and detection would be easier at that point. I really just focused on fixing what was keeping it from compiling and getting the 'Run text command.." actions to work right. I think all the actions with named sessions are mostly useless now and that part probably still needs to be redone for profiles instead of sessions.

https://github.com/jasmas/iTerm2-qsplugin/tree/iTerm3

@pjrobertson
Copy link
Member

Great, thanks! Probably keeping it as 1 plugin would be best if possible. Plugins can be related to multiple bundles - you're right a change in bundle ID would make things easier.

I've just gone through a similar thing for Safari 7/8 changes in the Safari plugin
To check Safari version I'm checking for the existence of a file that Safari 8 creates. It's more complicated in terms of actions though.
EDIT: Actually you could always use the NSBundle version:

NSString *version = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"];

If you feel like it should be a new plugin then we can also include that - when you're ready/iTerm3 is ready please make a PR or let us know on the QS Dev group and we'll get a release out.

@studgeek
Copy link

I wrote this simple Pane 2 AppleScript Action to fill the gap in the meantime. Just drop it in ~/Library/Application Support/Quicksilver/Actions and restart Quicksilver. Then it will show up as an available action for folders. Unfortunately it will also show up for files because I don't know the QS Type for just Folders.

using terms from application "Quicksilver"
    on get direct types
        -- TODO: Change to be just the QS Folder type (not sure what its name is)
        return {"NSFilenamesPboardType"}
    end get direct types

    on open files theFiles
        set filePath to POSIX path of item 1 of theFiles

        tell application "iTerm"
            activate
            set newWindow to (create window with default profile)
            tell current session of newWindow
                write text ("cd '" & filePath & "'")
            end tell
        end tell

    end open files
end using terms from

@studgeek
Copy link

Kind of obvious, but here is the script I am using to replace Run in iTerm3 until this is fixed...

using terms from application "Quicksilver"
	on get direct types
		-- TODO: Is there a File QS type that doesn't include directories?
		return {"NSFilenamesPboardType"}
	end get direct types
	
	on open files theFiles
		-- TODO: Handle multiple files
		set filePath to POSIX path of item 1 of theFiles
		
		tell application "iTerm"
			activate
			set newWindow to (create window with default profile)
			tell current session of newWindow
				write text (filePath)
			end tell
		end tell
		
	end open files
end using terms from

@studgeek
Copy link

For parent directory you just want to replace the write text argument with something like this:

"cd `dirname`" & filePath & "`"

@fturcheti
Copy link

Thank you for the scripts @studgeek!

@franvillamil
Copy link

A bit late on this, but @studgeek 's script is giving me the following error on Script Editor, and it doesn't run on Quicksilver:

Expected function name, command name or function name but found “get”.

@stale
Copy link

stale bot commented Apr 12, 2023

This issue hasn't been updated in over 2 years. It has been marked as 'stale' and will be closed in 30 days. Please check whether this is still an issue with the latest version of Quicksilver. If so, update or comment on this issue to keep it open.

@stale stale bot added the noactivity label Apr 12, 2023
@stale stale bot closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants