Skip to content

Add support for Alacritty Terminal integration on MacOS - #2781

Merged
love-linger merged 2 commits into
sourcegit-scm:developfrom
chris-t-jansen:feat/add-alacritty-terminal-macos
Oct 13, 2026
Merged

love-linger merged 2 commits into
sourcegit-scm:developfrom
chris-t-jansen:feat/add-alacritty-terminal-macos

Conversation

@chris-t-jansen

Copy link
Copy Markdown

Overview

This PR adds support for the Alacritty terminal as an integration on macOS. I tested the PR myself on my MacBook Pro with both Alacritty and the default macOS Terminal to test compatibility with existing integrations.

Alacritty is cross-platform and available for Windows and Linux as well, so adding support for it on those platforms should be trivial, but this is the platform I wanted it on and could test it on.

Alacritty's Starting Directory

Alacritty differs slightly from other macOS terminals in that it doesn't allow setting the starting directory through open with open -a Alacritty /path/to/dir; instead, you have to set the starting directory using Alacritty's --working-directory CLI option, resulting in something along the lines of open -a Alacritty --args --working-directory /path/to/dir.

However, the macOS implementation of OpenTerminal presently ignores the args parameter (and it's currently declared as string _ in the function signature). Thus, to make Alacritty work properly, I had to add some simple, naive argument handling for the macOS implementation.

To be clear, this implementation of handling args is very simple. Critically, since the open command doesn't process anything after the --args flag, this setup requires any macOS terminal integration that sets args to also set the terminal's starting directory via those args, rather than relying on default behavior.

I considered writing a more robust CLI options handler for more complicated args, but I felt that it was outside the scope of this PR since it would require either hand-rolling an options parser or adding an external dependency. I still think it could be worthwhile, though I know it's not SourceGit's primary concern.

Feel free to comment with any questions/concerns, I'm happy to answer what I can.

Adds a very naive handler for `args` (which was previously the unused `string _` in the `OpenTerminal()` function signature) to allow for "weird" terminals like Alacritty which require the starting directory to be set via a commandline option (`--working-directory` in Alacritty's case).

Critically, this is a simple, naive handling of `args`. Since the `open` command doesn't process anything after the `--args` flag, this setup requires a macOS terminal integration that sets `args` to also set the terminal's starting directory via those `args`.

Personally, I think both the macOS and Linux implementations of `OpenTerminal` could do with more robust CLI parsing (which I'm happy to take a first pass at), but I felt it was outside the purpose of this branch.
Adds integration support for the Alacritty terminal on macOS. Alacritty is cross-platform and available for Windows and Linux as well, so adding support on those platforms should be trivial, but this is the platform I wanted it and could test it for.

I tested this on my MacBook Pro both with the Alacritty terminal and with the default macOS Terminal to ensure compatibility with existing integrations.

Alacritty differs slightly from other macOS terminals in that it doesn't allow setting the starting directory through `open` with `open -a Alacritty /path/to/dir`; instead, you have to set the starting directory using Alacritty's `--working-directory` CLI option, resulting in something along the lines of `open -a Alacritty --args --working-directory /path/to/dir`. Thus, adding support for Alacritty also required adding support for passing arguments to terminals on macOS, at least at a naive level.
@love-linger love-linger self-assigned this Oct 13, 2026
@love-linger love-linger added enhancement New feature or request os-macos This issue only exists on macOS labels Oct 13, 2026
@love-linger
love-linger merged commit fc44e7c into sourcegit-scm:develop Oct 13, 2026
@chris-t-jansen
chris-t-jansen deleted the feat/add-alacritty-terminal-macos branch October 13, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request os-macos This issue only exists on macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants