# Installation (https://mangowm.github.io/docs/bar/installation)

## Dependencies [#dependencies]

Build tools: `meson`, `ninja`, `wayland-scanner` (part of `wayland`),
`pkg-config`.

Libraries:

| Package                        | Purpose                     |
| ------------------------------ | --------------------------- |
| `cjson`                        | JSONC configuration parsing |
| `wayland`, `wayland-protocols` | Wayland client protocol     |
| `fcft`, `tllist`               | Font rendering              |
| `pixman`, `cairo`              | 2D drawing                  |
| `pango`                        | Text layout                 |
| `libpulse`                     | PulseAudio volume module    |
| `systemd-libs`                 | sd-bus (tray DBus)          |
| `gdk-pixbuf2`                  | Tray icon decoding          |
| `alsa-lib`                     | ALSA fallback for volume    |

### Arch [#arch]

```sh
yay -S mangobar-git
```

### Debian / Ubuntu [#debian--ubuntu]

- Installation dependencies

```sh
sudo apt install meson ninja-build libcjson-dev libwayland-dev \
  wayland-protocols libfcft-dev libpixman-1-dev libcairo2-dev \
  libpango1.0-dev libpulse-dev libtllist-dev libsystemd-dev libgdk-pixbuf-2.0-dev \
  libasound2-dev pkg-config
```

- Build from source code

```sh
git clone https://github.com/mangowm/mangobar.git
cd mangobar
meson setup build -Dprefix=/usr
ninja -C build
sudo ninja -C build install
```

If `meson.build` changes after a `git pull`, ninja re-runs meson
automatically; install any newly added dependencies first.

> **Note:** Built-in volume and brightness scrolling do not require `pamixer`
> or `brightnessctl`. They are only needed if your click/scroll commands call
> them.

## Nix [#nix]

Build the package locally with:

```sh
nix build .#mangobar
./result/bin/mangobar
```

## Home Manager [#home-manager]

The flake exports a Home Manager module. Add it to your flake inputs and
enable the user service:

```nix
{
  imports = [ inputs.mangobar.homeManagerModules.default ];

  services.mangobar = {
    enable = true;
    systemdTarget = "mango.target";
  };
}
```

The service starts with `graphical-session.target` by default. Set
`systemdTarget` to your compositor's user target, such as `mango.target`.
Override `services.mangobar.package` to use a different mangobar derivation.

Set `services.mangobar.settings` to generate
`~/.config/mangobar/config.jsonc` from a Nix attribute set, or use
`services.mangobar.configFile` for an existing JSONC file. These options are
mutually exclusive. Changing either configuration restarts the service during
Home Manager activation; rebuilding the mangobar package does as well.

```nix
services.mangobar.settings = {
  modules-left = [ "workspaces" "layout" "window" ];
  modules-right = [ "cpu" "memory" "clock#time" ];
};
```

## Running [#running]

Run `mangobar` inside a mangowm session:

```sh
mangobar
```

### Command-line options [#command-line-options]

| Flag        | Description                              |
| ----------- | ---------------------------------------- |
| `-h`        | Show the usage message and exit          |
| `-v`        | Show the version and exit                |
| `-c <path>` | Use the given configuration file (JSONC) |
| `-s <path>` | Use the given CSS style file             |

`-c` and `-s` are checked first. When they are omitted, the config is read
from `$MANGOBAR_CONFIG`, then `~/.config/mangobar/config.jsonc`, and the CSS
style file from `$MANGOBAR_CSS`, then `~/.config/mangobar/style.css`.

```sh
mangobar -c ~/alt/config.jsonc -s ~/alt/style.css
```