Skip to content

Regression: right-click header bar context menu broken since iced update #1158

@markc

Description

@markc

Summary

The right-click context menu on the header bar (system window menu with Sticky, Always on Top, move to workspace, etc.) stopped working after commit 03d0171 ("chore: update iced", 2026-03-06).

Apps compiled against the previous checkout (384e8f6, 2026-02-20) still have a working right-click menu. Apps compiled against 03d0171 or later do not.

Root Cause

In iced/widget/src/mouse_area.rs, the ButtonPressed(mouse::Button::Right) event handler was dropped during the iced update. The on_right_press field, setter method, and all call sites (including header_bar.rs line 444) still exist — only the event dispatch is missing.

384e8f6 (working) has at line 520:

if let Some(message) = widget.on_right_press.as_ref() {
    if let Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right)) =
        event
    {
        shell.publish(message.clone());
        return event::Status::Captured;
    }
}

03d0171 (broken) — the above block is entirely absent. The match event block handles ButtonReleased(Right), ButtonPressed(Middle), ButtonReleased(Middle), and WheelScrolled, but not ButtonPressed(Right).

Fix

Add the missing handler back into the match event block in mouse_area.rs:

Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right)) => {
    if let Some(message) = widget.on_right_press.as_ref() {
        shell.publish(message.clone());
        shell.capture_event();
    }
}

Impact

Every libcosmic app loses the header bar right-click system window menu (Sticky Window, Always on Top, Move to Workspace, etc.). This affects all apps using cosmic::Application since the header bar unconditionally sets .on_right_click(Action::ShowWindowMenu).

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