diff options
| author | Tommaso Negri <me@tommasongr.com> | 2026-08-18 10:55:14 +0200 |
|---|---|---|
| committer | Tommaso Negri <me@tommasongr.com> | 2026-08-18 10:55:14 +0200 |
| commit | 90028519d6dfd95058900a9acb091fe8efd712b5 (patch) | |
| tree | 207a95e26973a0d77f5d91b8adc6959af0035fae | |
| parent | c41f667e50157d9a334ab54a124c5bff0be24e5f (diff) | |
| download | bar-90028519d6dfd95058900a9acb091fe8efd712b5.tar.gz bar-90028519d6dfd95058900a9acb091fe8efd712b5.zip | |
improve the run at login docs
| -rw-r--r-- | Sources/bar/bar.docc/run-at-login.md | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/Sources/bar/bar.docc/run-at-login.md b/Sources/bar/bar.docc/run-at-login.md index 43e7a6c..1a6164b 100644 --- a/Sources/bar/bar.docc/run-at-login.md +++ b/Sources/bar/bar.docc/run-at-login.md @@ -5,24 +5,12 @@ How to start the program automatically at login. It is fine to run `bar` manually while you're editing and customising the source code. Although, as soon as you're happy with your build is a good idea to create a launch agent that can start the program for you. -Copy the example down below in a `plist` file inside the `~/Library/LaunchAgents/` directory. +## Create the agent -> Tip: It is best practice to use [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) for the filename. - -Adjust the example as you see fit. -For the full file specification run: - -```shell -man launchd.plist -``` - -You can than register the launch agent like so: - -```shell -launchctl load ~/Library/LaunchAgents/house.panini.bar.plist -``` +Copy this code in a `plist` file inside the `~/Library/LaunchAgents/` directory. -### Example +> Tip: It is best practice to use [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) for the filename. +E.g: `house.panini.bar.plist` ```plist <?xml version="1.0" encoding="UTF-8"?> @@ -34,7 +22,7 @@ launchctl load ~/Library/LaunchAgents/house.panini.bar.plist <key>ProgramArguments</key> <array> - <string>~/.local/bin/bar</string> + <string>[EXECUTABLE_PATH]</string> </array> <key>RunAtLoad</key> @@ -44,10 +32,25 @@ launchctl load ~/Library/LaunchAgents/house.panini.bar.plist <true/> <key>StandardOutPath</key> - <string>/tmp/bar/bar.log</string> + <string>/tmp/bar_[USER].out.log</string> <key>StandardErrorPath</key> - <string>/tmp/bar/bar.err</string> + <string>/tmp/bar_[USER].err.log</string> </dict> </plist> ``` + +Make the two required edits: + +1. Replace `[EXECUTABLE_PATH]` with a path to the `bar` executable. +If you didn't specify a different `PREFIX` in the <doc:installation#Build> phase, this should be `~/.local/bin/bar`. + +2. Replace the two `[USER]` placeholders with your actual username. + +## Activate the agent + +You can than register the launch agent like so: + +```shell +launchctl load ~/Library/LaunchAgents/house.panini.bar.plist +``` |
