Skip to content
Open
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Things OpenLogi does that Options+ won't:
- **Run on Linux.** Linux is a first-class platform in OpenLogi.
- **Gestures on supported buttons.** Assign gesture actions to supported controls — or turn gestures off entirely.
- **Plain-text config.** Everything is one TOML file you can sync between machines however you like.
- **Script it.** A real CLI alongside the GUI: a JSON [automation API](docs/USAGE.md#automation-api) for DPI, SmartShift, Fn-lock, and report rate, plus hardware diagnostics.
- **Script it.** A real CLI alongside the GUI: a JSON [automation API](docs/USAGE.md#automation-api) for DPI, SmartShift, Fn-lock, and report rate, [haptic pulses](docs/USAGE.md#haptic-feedback) on mice that have them, plus hardware diagnostics.

## Features

Expand Down
12 changes: 11 additions & 1 deletion crates/openlogi-agent-core/src/action_ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,19 @@ impl Default for ActionRingManager {
}

impl ActionRingManager {
/// Take the next session ID without opening a ring.
///
/// The agent's haptic worker orders the haptic sessions it owes an engine
/// restore by ID. Haptics played for another client than the ring open a
/// session of their own, and take its ID here so it orders against the
/// ring's.
pub fn reserve_session_id(&self) -> u64 {
self.next_session.fetch_add(1, Ordering::Relaxed)
}

/// Open or replace the current session and wake the overlay long-poll.
pub fn begin(&self, spec: ActionRingSessionSpec) -> ActionRingInvocation {
let session_id = self.next_session.fetch_add(1, Ordering::Relaxed);
let session_id = self.reserve_session_id();
let mut actions = BTreeMap::new();
let mut slots = BTreeMap::new();
for (slot, entry) in spec.layout.slots {
Expand Down
13 changes: 12 additions & 1 deletion crates/openlogi-agent/src/bin/mock_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use openlogi_core::device::{
BatteryInfo, BatteryLevel, BatteryStatus, Capabilities, DeviceInventory, DeviceKind, LockKey,
PairedDevice, StandaloneDevice, prettify_codename,
};
use openlogi_core::hid::{DisableKeysMask, DisableKeysState, HidppOperation};
use openlogi_core::hid::{DisableKeysMask, DisableKeysState, HapticPulse, HidppOperation};
use openlogi_core::single_instance::{self, InstanceError, Role};
use openlogi_fixture::{DeviceProfile, FixtureError, ProfileDeviceSettings, ProfileSetting};
use openlogi_hid::{
Expand Down Expand Up @@ -1603,6 +1603,17 @@ impl Agent for MockAgent {
) -> Result<(), ActionRingCommandError> {
Err(ActionRingCommandError::SessionNotFound)
}

async fn play_haptic(
self,
_: Context,
route: DeviceRoute,
pulse: HapticPulse,
) -> Result<(), WriteError> {
self.state.lock().await.settings_for(&route)?;
info!(%route, ?pulse, "play_haptic (no-op in the mock)");
Ok(())
}
}

#[cfg(test)]
Expand Down
Loading
Loading