Skip to content

No way to choose iTerm2 as the terminal application #637

Closed

Description

@goneng

PBTerminalUtil already knows how to drive iTerm2, and reads the choice from a
PBTerminalHandler user default on every invocation:

https://github.com/gitx/gitx/blob/master/Classes/Util/PBTerminalUtil.m#L33-L52

NSString *terminalHandler = [PBGitDefaults terminalHandler];
BOOL ran = NO;

if ([terminalHandler isEqualToString:@"com.googlecode.iterm2"]) {
	ran = [self runiTerm2Command:command inDirectory:directory];
}

There is a complete runiTerm2Command:inDirectory: implementation behind it, and
PBGitDefaults registers com.apple.Terminal as the default value. What is
missing is any way to change it. The preferences window has General, Integration
and Updates panes and none of them expose this setting, so the only way to pick
iTerm2 is:

defaults write net.phere.GitX PBTerminalHandler com.googlecode.iterm2

which is not discoverable.

Suggested change

Add a terminal application control to the Integration pane, bound to
PBTerminalHandler. Two options in increasing effort:

  • A popup listing the two handlers the code already supports, Terminal and
    iTerm2, disabling or hiding iTerm2 when it is not installed
    (-[NSWorkspace URLForApplicationWithBundleIdentifier:] answers that).
  • A popup populated from the applications that actually claim to be terminals on
    the machine, which would let the existing code grow to support more of them.

Note the current fallback is slightly rough: if the default holds an unknown
identifier, runCommand:inDirectory: logs Unexpected terminal handler ... and
silently uses Terminal.app. Worth tidying alongside a real picker.

Related

Blocked in practice by #636. Both handlers go through Scripting Bridge, so
neither works in a released build until the Apple Events entitlement is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions