> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebind.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# rb.app

> Check which apps run or sit in front, and bring forward, hide, or quit them.

`rb.app` acts on whole applications. A script reaches for it to ask which app
is in front or to switch to one by name; work on single windows belongs to
[`rb.window`](https://docs.rebind.gg/reference/sdk/window). Names match ignoring case: the display
name or `.app` bundle name on macOS, the executable name on Windows (`.exe`
optional).

This script prints the frontmost app and brings Spotify forward when it runs
behind another app:

```luau theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
-- rebind: min_sdk=3.9.0 name=example version=1.0.0
local front = rb.app.front()
if front then
  print("frontmost:", front.name, front.pid)
end

if rb.app.is_running("Spotify") and not rb.app.is_front("Spotify") then
  rb.app.activate("Spotify")
end
```

| Signature | Effect |
| - | - |
| `rb.app.front() -> AppInfo?` | the frontmost app as `{ name, pid }`, or `nil` |
| `rb.app.is_front(name: string) -> boolean` | whether the frontmost app's name contains `name` |
| `rb.app.is_running(name: string) -> boolean` | whether a matching app runs |
| `rb.app.is_hidden(name: string) -> boolean` | macOS: whether it is hidden; raises on Windows |
| `rb.app.activate(name: string) -> ()` | brings a running app forward and raises when none matches; on macOS it shows a hidden app, which a second call brings forward, and restores a window when all are minimized |
| `rb.app.hide(name: string) -> ()` | macOS: hides it; raises on Windows |
| `rb.app.quit(name: string) -> ()` | asks it to quit; on Windows it closes the app's windows |

`rb.app` never starts an app; start one with
[`rb.system.exec_detached`](https://docs.rebind.gg/reference/sdk/system#rb-system-exec_detached),
which needs the `exec` [permission](https://docs.rebind.gg/reference/sdk/modeline.md#permissions). On
macOS, `activate` needs Accessibility, `quit` and `is_hidden` ask for the
Automation permission on first use, and `quit` does nothing for an app that is
not running.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.