Skip to content

Meeting recording capsule won't stay in a new corner after drag (Linux/Windows) #1767

Open

Description

@ImBIOS

What I see

The black recording pill (Meeting — 8:55 AM / elapsed time, screenshotted on Linux) blocks something on screen. I drag it, it follows the pointer, but on release it jumps back to the corner it started in instead of staying where I dropped it.

Why

Capsule::drag (src/rune_ui/meeting_capsules.rs) snaps a released drag with primary_screen_size().map_or(self.corner, ...). On macOS that reads NSScreen; on every other OS it is hardcoded to None, so the fallback is always the starting corner:

/// Linux and Windows leave a dragged capsule in its corner.
#[cfg(not(target_os = "macos"))]
fn primary_screen_size() -> Option<(f32, f32)> {
    None
}

So on Linux/Windows the capsule can never move corners — release always snaps back.

Diagnosis for the fix

  • Linux: the X11 root window size (x11rb::connect + setup().roots, already a dependency) is the screen Rune places the capsule on. XWayland answers for its own root window; on pure Wayland there is no X server, so None (stays in corner) is correct there.
  • Windows: GetSystemMetrics(SM_CXSCREEN/SM_CYSCREEN) (windows-sys, already a dependency).
  • The pure snap math (nearest_corner) is already OS-independent and covered by a_released_capsule_snaps_to_the_corner_nearest_its_centre.

Suggested patch

I have this working on a branch with cargo check clean, 26 meeting_capsules tests + 46 labs tests passing, fmt + code-shape clean. Diff sketch:

#[cfg(target_os = "linux")]
fn primary_screen_size() -> Option<(f32, f32)> {
    use x11rb::connection::Connection as _;
    let (connection, screen) = x11rb::connect(None).ok()?;
    let size = connection.setup().roots.get(screen)?;
    (size.width_in_pixels > 0 && size.height_in_pixels > 0).then(|| (
        f32::from(size.width_in_pixels),
        f32::from(size.height_in_pixels),
    ))
}

#[cfg(target_os = "windows")]
fn primary_screen_size() -> Option<(f32, f32)> {
    let width = unsafe { GetSystemMetrics(SM_CXSCREEN) };
    let height = unsafe { GetSystemMetrics(SM_CYSCREEN) };
    (width > 0 && height > 0).then_some((width as f32, height as f32))
}

Happy to post the full diff (4 files: the fix + a stale-comment update in rune_ui/labs.rs + docs/features/{meetings,labs}.md updates) wherever is most useful — per CONTRIBUTING I am not opening a PR.

Environment: Linux (X11), Hex at dev 1982f53.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions