From fe5014853363620acdf41f79e6d0eda7544a0fa7 Mon Sep 17 00:00:00 2001 From: Tommaso Negri Date: Fri, 28 Aug 2026 11:13:30 +0200 Subject: document options to run bar from yabai and aerospace --- Sources/bar/bar.docc/run-at-login.md | 44 +++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'Sources') diff --git a/Sources/bar/bar.docc/run-at-login.md b/Sources/bar/bar.docc/run-at-login.md index 1a6164b..8f38c1e 100644 --- a/Sources/bar/bar.docc/run-at-login.md +++ b/Sources/bar/bar.docc/run-at-login.md @@ -3,15 +3,40 @@ 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. +Although, as soon as you're happy with your build is a good idea to integrate `bar` with your window manager or create a launch agent that can start the program for you. -## Create the agent +## Using yabai +If you are using [yabai](https://github.com/asmvik/yabai), add this line **at the very end** of your `yabairc` to start `bar` alongside the window manager: + +```sh +# ~/.config/yabai/yabairc + +killall bar 2>/dev/null; bar & +``` + +## Using AeroSpace + +If you are using [AeroSpace](https://github.com/nikitabobko/AeroSpace), add an **after startup command** to start `bar` alongside the window manager: + +```toml +# ~/.config/aerospace/aerospace.toml + +after-startup-command = [ + "exec-and-forget bash -c 'killall bar 2>/dev/null; bar &'" +] +``` + +## Using a launch agent + +If you want to run `bar` independently from a window manager, you can create a launch agent that runs it at login. Copy this code in a `plist` file inside the `~/Library/LaunchAgents/` directory. > 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` +> Important: Replace the two `[USER]` placeholders with your actual username. + ```plist @@ -22,7 +47,7 @@ E.g: `house.panini.bar.plist` ProgramArguments - [EXECUTABLE_PATH] + /Users/[USER]/.local/bin/bar RunAtLoad @@ -32,22 +57,15 @@ E.g: `house.panini.bar.plist` StandardOutPath - /tmp/bar_[USER].out.log + /Users/[USER]/.local/state/bar/bar.out.log StandardErrorPath - /tmp/bar_[USER].err.log + /Users/[USER]/.local/state/bar/bar.err.log ``` -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 phase, this should be `~/.local/bin/bar`. - -2. Replace the two `[USER]` placeholders with your actual username. - -## Activate the agent +### Activate the agent You can than register the launch agent like so: -- cgit v1.2.3