# How to Use Per-Application Profiles with OS Identifiers in OpenLogi

> Learn how to use per-application profiles with OS identifiers in OpenLogi. Automatically switch input configs for macOS, Linux, and Windows applications.

- Repository: [Xuan Zhang/OpenLogi](https://github.com/AprilNEA/OpenLogi)
- Tags: how-to-guide
- Published: 2026-09-08

---

**OpenLogi automatically switches input configurations by mapping per-application profiles to OS-specific identifiers like macOS bundle IDs, Linux WM_CLASS names, and Windows executable paths.**

OpenLogi enables granular control over mouse behavior through per-application profiles that activate based on the currently focused window. This system relies on platform-specific application identifiers to match your configuration against running software, allowing distinct bindings, DPI settings, and gestures for individual apps. The implementation spans the core identity definitions, platform hooks, and UI state management within the AprilNEA/OpenLogi repository.

## How OpenLogi Identifies Foreground Applications

The identification mechanism centers on the `ForegroundApp` struct defined in [`crates/openlogi-core/src/app.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-core/src/app.rs). This structure captures the **`id`** field, which stores a unique string representation of the active application determined by the underlying operating system.

Each platform employs a different identifier scheme:

- **macOS:** Uses the application's **bundle identifier** (e.g., `com.apple.Safari`).
- **Linux (X11):** Uses the window's **`WM_CLASS`** class name (e.g., `firefox`).
- **Linux (Wayland):** Uses the **`xdg` app-id** reported by the compositor.
- **Windows:** Uses the **lower-cased full path** to the executable (e.g., `c:\program files\firefox\firefox.exe`).

## The Profile Resolution Pipeline

When you switch between applications, the platform-specific hook implementations in [`crates/openlogi-hook/src/lib.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-hook/src/lib.rs) (around line 519) read the foreground window from the OS window server and construct a `ForegroundApp` instance. This identifier propagates through the IPC layer to the UI layer, where `state.active_profile_name()` in [`crates/openlogi-desktop/src/state.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-desktop/src/state.rs) (line 445) resolves which profile configuration should become active.

## Configuring Per-Application Profiles

To create OS-specific application profiles, follow these identification and configuration steps:

1. **Determine your application's identifier:**
   - On **macOS**, run: `defaults read /Applications/YourApp.app/Contents/Info CFBundleIdentifier`
   - On **Linux (X11)**, execute `xprop WM_CLASS` and click the target window to see the class name.
   - On **Linux (Wayland)**, check your compositor's debug output for the `app_id` field.
   - On **Windows**, note the full lower-cased executable path.

2. **Edit your configuration file** at `~/.config/openlogi/config.toml` and create a `[profile.<identifier>]` table using the exact string from step 1.

3. **Define bindings** within the profile table for buttons, DPI, gestures, or scroll behavior.

4. **Reload the OpenLogi agent** to apply changes, either by restarting the service or triggering a configuration reload.

5. **Switch applications** to test—the foreground-app watcher automatically selects matching profiles based on the current identifier.

### Configuration Examples

Here are platform-specific TOML configurations for web browsers:

```toml

# macOS Safari using bundle identifier

[profile.com.apple.Safari]
button_1 = "scroll_up"
button_2 = "scroll_down"

# Linux (X11) Firefox using WM_CLASS

[profile.firefox]
button_1 = "zoom_in"
button_2 = "zoom_out"

# Windows Chrome using lower-cased executable path

[profile."c:\\program files\\google\\chrome\\application\\chrome.exe"]
button_1 = "back"
button_2 = "forward"

```

## Cross-Platform Profile Considerations

Because profile keys use OS-specific identifiers, a profile created on macOS will not match the same application on Windows or Linux. The `ForegroundApp.id` values differ by design—bundle IDs bear no relation to executable paths or WM_CLASS names. To maintain consistent settings across multiple operating systems, you must define separate `[profile]` tables for each platform using their respective identifier formats.

## Summary

- OpenLogi uses the `id` field in `ForegroundApp` (defined in [`crates/openlogi-core/src/app.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-core/src/app.rs)) to key per-application profiles.
- Platform hooks in [`crates/openlogi-hook/src/lib.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-hook/src/lib.rs) capture the identifier from the window server at line 519.
- The UI layer resolves active profiles via `active_profile_name()` in [`crates/openlogi-desktop/src/state.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-desktop/src/state.rs) at line 445.
- Configuration requires OS-specific identifiers: macOS bundle IDs, Linux WM_CLASS/app-id, or Windows executable paths.
- Profiles do not transfer across operating systems due to differing identifier schemes.

## Frequently Asked Questions

### Why doesn't my profile work when I move from macOS to Linux?

Profiles are keyed by OS-specific identifiers that differ between platforms. macOS uses bundle identifiers like `com.company.app`, while Linux uses `WM_CLASS` or `xdg` app-id strings. You must create separate profile entries for each operating system using their respective identifier formats.

### How can I find the correct identifier for a Linux Wayland application?

Check your compositor's debug output or logging interface for the `app_id` field associated with the target window. Unlike X11's `WM_CLASS`, Wayland uses the `xdg` app-id protocol, which compositors expose through their diagnostic tools.

### Do I need to restart OpenLogi after adding a new profile?

Yes, you must reload the OpenLogi agent after modifying `~/.config/openlogi/config.toml`. Either restart the agent service or trigger a configuration reload if your installation supports hot-reloading. Once reloaded, switching to the target application automatically activates the new profile.

### Can I use wildcards or regex in profile identifiers?

No, OpenLogi performs exact string matching against the `ForegroundApp.id` field captured by the platform hooks. The identifier must match exactly—character for character—including case sensitivity on case-sensitive platforms.