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

Package an optionally installed Shell script that adds .../contour.app/... to /etc/paths.d #1615

Open
whisperity opened this issue Oct 3, 2024 · 4 comments
Labels
build enhancement New feature or request feature-request User requested features platform: macOS topics that directly address macOS platform

Comments

@whisperity
Copy link
Member

whisperity commented Oct 3, 2024

Abstract

The package layout and installation logic on Mac is... unconventional, to say the least. It is common, however, that someone would want to spawn a separate contour process (if, for nothing else, contour debug ...; but I also regularly start contour profile white for screenshotting into presentations — so the "Start new Window" keybind action is not satisfactory), but on Mac, it always gives command not found.

Specification

In an installer .dmg it is possible to package a .pkg file which runs custom installation actions (e.g., Citrix is installed this way, but so is Google Drive IIRC).

If doing a full-on .pkg is infeasible, we should package a script which, when double-clicked and sudo-authenticated by the user, optionally (i.e., not in part of the "copying" of contour.app to /Applications) installs a shell script under /etc/paths.d:

$ cat /etc/paths.d/contour-terminal
/Applications/contour.app/Contents/MacOS

This way, /usr/libexec/path_helper will return contour's installation path as well, and if this is appropriately sourced into the spawned shell profile, contour becomes an executable command as-is.

@whisperity whisperity added enhancement New feature or request build platform: macOS topics that directly address macOS platform feature-request User requested features labels Oct 3, 2024
@christianparpart
Copy link
Member

@whisperity great idea. I admit I'm having a macOS (as you know), but I've never mastered using one in terms of being a power user, and thus, I simply did not know about it. Thanks for looking into it. :)

I however wonder how to do that in the context of CMake's CPack. 🤔

@christianparpart christianparpart added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 3, 2024
@whisperity
Copy link
Member Author

@christianparpart I'm also incrementally evolving here (whisperity/dotfiles@3c7501d). I think as long as we can package a shell script that can do echo "/Applications/contour.app/Contents/MacOS" > "/etc/paths.d/contour-terminal" while also requiring sudo (usually these programs pop mac's own "Please authenticate" modal dialog!) that should be fine. It just needs an icon in the .dmg view such that the user is presented with the option to click it. 😉

@christianparpart christianparpart removed help wanted Extra attention is needed good first issue Good for newcomers labels Oct 3, 2024
@christianparpart
Copy link
Member

p.s.: Maybe we should find a better way that would avoid requiring to touch /etc/paths.d/ during installation or shell-spawn.
Ideally the PATH env var should contain the search path to the contour executable already. 🤔 ...

@whisperity
Copy link
Member Author

That is what the path_helper is for. Both Brew and Podman-Desktop uses the same "trick" to add entries into the PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build enhancement New feature or request feature-request User requested features platform: macOS topics that directly address macOS platform
Projects
None yet
Development

No branches or pull requests

2 participants