# How to Set Up DPI Presets and Cycle DPI Presets Actions in OpenLogi

> Learn to set up DPI presets and cycle DPI presets actions in OpenLogi. Instantly switch mouse sensitivity levels with custom button binds without opening the application.

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

---

**OpenLogi enables you to define a list of DPI sensitivity values in its TOML configuration and bind a single "Cycle DPI Presets" action to any mouse button, allowing instant switching between predefined sensitivity levels without opening the application window.**

OpenLogi is an open-source utility for advanced Logitech device customization that communicates directly via the HID++ protocol. By configuring `dpi_presets` and assigning the **Cycle DPI Presets** action, you can toggle between distinct sensitivity modes—such as 800 DPI for precise pixel work and 3200 DPI for rapid navigation—directly from your mouse hardware.

## Configuring DPI Presets in the TOML Configuration

OpenLogi reads hardware settings from a user-level TOML configuration file at startup. Defining the `dpi_presets` array makes specific DPI values available to the runtime action system.

### Defining the dpi_presets Array

Edit your OpenLogi configuration file (see the example structure in [`docs/config.example.toml`](https://github.com/AprilNEA/OpenLogi/blob/main/docs/config.example.toml)) to include a top-level array of integer DPI values:

```toml

# ~/.config/openlogi/config.toml

dpi_presets = [400, 800, 1600, 3200]

```

The array can contain any number of integer values supported by your specific Logitech mouse model. OpenLogi validates this configuration during initialization and stores the values for runtime access. The actual device communication that applies these values occurs in [`crates/openlogi-device/src/write/dpi.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-device/src/write/dpi.rs), which implements the HID++ write protocol for DPI changes.

## Binding the Cycle DPI Presets Action

Once the presets are defined, you must bind the **Cycle DPI Presets** action to a physical button. OpenLogi supports both GUI-based configuration and direct TOML editing.

### Assigning via the OpenLogi Interface

The OpenLogi UI exposes this action in the localization entries found at [`crates/openlogi-ui/locales/en.toml`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-ui/locales/en.toml). To bind the action:

1. Open **OpenLogi → Presets → Actions**.
2. Locate **Cycle DPI Presets** in the available actions list.
3. Drag the action onto your desired button (for example, *Button 5* on a Logitech MX Master series).
4. Save the active profile to persist the binding.

When triggered, the action handler in [`crates/openlogi-agent-core/src/action_ring.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-agent-core/src/action_ring.rs) receives the command and advances to the next DPI value in your configured array.

### Manual Profile Configuration

Advanced users can define the binding directly in the profile TOML by adding an entry to the `actions` table:

```toml
[[profile.actions]]
name = "cycle_dpi_presets"
type = "cycle_dpi_presets"
button = "button5"

```

The `type = "cycle_dpi_presets"` identifier tells the OpenLogi agent to interpret this entry as a DPI cycling command. The runtime dispatches this to the device driver, which updates the mouse sensitivity immediately upon button press.

## Understanding the Cycle DPI Presets Implementation

The **Cycle DPI Presets** action operates through a three-stage pipeline. First, the input event reaches the action ring handler at [`crates/openlogi-agent-core/src/action_ring.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-agent-core/src/action_ring.rs), which identifies the `cycle_dpi_presets` command type. The handler then queries the next value from the `dpi_presets` array, wrapping back to the first element after reaching the end of the list. Finally, the new DPI value is serialized into a HID++ packet and transmitted to the hardware via the write implementation in [`crates/openlogi-device/src/write/dpi.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-device/src/write/dpi.rs). This architecture ensures sub-millisecond latency when switching sensitivity levels during active use.

## Summary

- **Define presets** by adding a `dpi_presets` array to your OpenLogi TOML configuration, specifying integer DPI values in your preferred cycle order.
- **Bind the action** either through the UI (referenced in [`crates/openlogi-ui/locales/en.toml`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-ui/locales/en.toml)) or by adding a `type = "cycle_dpi_presets"` entry to your profile's actions table.
- **Runtime execution** occurs through [`crates/openlogi-agent-core/src/action_ring.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-agent-core/src/action_ring.rs), which dispatches changes to the HID++ writer in [`crates/openlogi-device/src/write/dpi.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-device/src/write/dpi.rs).
- The system cycles sequentially through your preset list and automatically returns to the first value after reaching the final entry.

## Frequently Asked Questions

### What configuration file format does OpenLogi use for DPI presets?

OpenLogi uses the **TOML** format for all configuration files. The `dpi_presets` array must be defined at the root level of your user configuration file (typically located at `~/.config/openlogi/config.toml` or as shown in [`docs/config.example.toml`](https://github.com/AprilNEA/OpenLogi/blob/main/docs/config.example.toml)). This array accepts only integer values representing valid DPI steps for your specific Logitech device.

### How many DPI presets can I define in OpenLogi?

You can define **any number of DPI presets** in the `dpi_presets` array. The OpenLogi agent initializes the full list into memory at startup, and the Cycle DPI Presets action will sequentially iterate through every value you provide. There is no enforced upper limit within the configuration parser, though your specific mouse hardware may only support specific DPI ranges (e.g., 200-4000).

### Does the Cycle DPI Presets action require the OpenLogi UI to be running?

No, the **Cycle DPI Presets** action functions independently of the UI. Once you save the profile configuration—whether through the interface or manual TOML editing—the `openlogi-agent-core` service handles the button events directly. The action ring processor ([`crates/openlogi-agent-core/src/action_ring.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-agent-core/src/action_ring.rs)) intercepts the hardware input and issues the DPI change command without requiring the graphical interface to remain open.

### What happens when I reach the end of the DPI presets list?

The action **automatically cycles back to the first DPI value** in your `dpi_presets` array. When the action handler in [`crates/openlogi-agent-core/src/action_ring.rs`](https://github.com/AprilNEA/OpenLogi/blob/main/crates/openlogi-agent-core/src/action_ring.rs) detects that it has reached the final index of the preset list, it resets the internal pointer to zero and applies the initial DPI value on the next button press, creating a continuous loop through your sensitivity options.