Skip to main content
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. 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:
rb.app never starts an app; start one with rb.system.exec_detached, which needs the exec permission. 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.