Skip to content

window-management: add 'Raise window on focus' toggle - #2066

Open
perpetualbits wants to merge 1 commit into
pop-os:masterfrom
perpetualbits:focus-follows-cursor-no-raise-toggle
Open

window-management: add 'Raise window on focus' toggle#2066
perpetualbits wants to merge 1 commit into
pop-os:masterfrom
perpetualbits:focus-follows-cursor-no-raise-toggle

Conversation

@perpetualbits

@perpetualbits perpetualbits commented Jul 8, 2026

Copy link
Copy Markdown
  • I have disclosed use of any AI generated code in my commit messages.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Addresses pop-os/cosmic-comp#863.

Summary

Adds a "Raise window on focus" toggle to Settings → Window Management → Focus
navigation. It controls the compositor option focus_follows_cursor_raise, which
lets focus-follows-cursor move focus without also raising the window ("sloppy
focus").

The toggle sits directly under "Focus follows cursor" and is only shown while
focus-follows-cursor is enabled, since raising has no effect without follow-cursor
focus.

Relationship to cosmic-comp

This pairs with the compositor change that adds the focus_follows_cursor_raise
option (pop-os/cosmic-comp#2612). The two are only loosely coupled: this page
reads and writes the raw config key via comp_config.get/set("focus_follows_cursor_raise"),
exactly like the existing focus_follows_cursor toggle, so it does not depend
on the cosmic-comp-config crate carrying the new field and compiles against
current cosmic-comp-config as-is.

Implementation

Mirrors the existing focus-navigation toggles:

  • New Message::SetFocusFollowsCursorRaise(bool).
  • New Page field read on load (default true, matching the compositor default so
    existing behaviour is preserved) and written on toggle.
  • The row is added with section.add_maybe(...), gated on focus_follows_cursor,
    so it appears only when focus-follows-cursor is on. (A disabled/greyed toggle was
    the first instinct, but COSMIC's toggler does not render a disabled switch
    state, so a gated toggle would look identical to an enabled one; hiding the row
    is unambiguous.)
  • New i18n string focus-navigation.focus-follows-cursor-raise = "Raise window on focus".

Testing

  • cargo build is clean; the changed file produces no warnings; cargo fmt clean.
  • Verified in a running settings window: the toggle appears under "Focus follows
    cursor" only when that is enabled, and toggling it writes focus_follows_cursor_raise,
    which a compositor with the paired change picks up live.

Screenshots can be added if useful.

@leviport

leviport commented Jul 8, 2026

Copy link
Copy Markdown
Member

The PR template is required.

@perpetualbits

perpetualbits commented Jul 9, 2026

Copy link
Copy Markdown
Author

The PR template is required.

I have no idea what that is. Please explain or at least give me a pointer in the right direction. You should understand this is the first time I try to contribute to this project.
I have literally no idea how you work.

@mmstick

mmstick commented Jul 9, 2026

Copy link
Copy Markdown
Member

This repository automatically provides a template for the PR description when creating a PR in GitHub. Your description does not contain the required checklist from that template.

@notlaast

Copy link
Copy Markdown

@perpetualbits I'm just trying to speed things up here because I've been (im)patiently waiting for such a feature in COSMIC since day 1. Please please please modify your original post to include this checklist below. It would be a pity if such a critical feature (WHICH COSMIC SHOULD HAVE SUPPORTED FROM DAY 1, smh, let me scream this because it's ridiculous) is blocked simply because of some silly code of conduct-like formality is not satisfied.

The checklist appears to be:

  • I have disclosed use of any AI generated code in my commit messages.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@perpetualbits

perpetualbits commented Jul 21, 2026 via email

Copy link
Copy Markdown
Author

@perpetualbits

Copy link
Copy Markdown
Author

@notlaast thank you — and no worries about the nudge, it's appreciated.

I've now completed the required checklist on both PRs. To be upfront: this work
was done with AI assistance (Claude Code), disclosed via an Assisted-by: trailer
on every commit. I understand the changes in full and validated them on real
hardware, so I can respond to review comments.

While going back through it I found and fixed a bug in the compositor half: with
auto-raise disabled, moving the pointer from a hovered window onto the empty
desktop still raised the window. Rather than patch the stalled compositor PR, I've
opened a fresh, fully-documented replacement — pop-os/cosmic-comp#2612 — that
supersedes #2535, with the root cause and fix written up in detail. This settings
PR (#2066) is unchanged and pairs with it.

Really appreciate you helping push this along — it's a feature I've wanted for a
long time too.

Adds a toggle in the Focus navigation section bound to the compositor's
focus_follows_cursor_raise option (default true). It is shown only while
focus-follows-cursor is enabled, since raising has no effect without
follow-cursor focus.

Assisted-by: Claude Code (Anthropic)
Signed-off-by: Roland Nagtegaal <perpetualbits@gmail.com>
@perpetualbits
perpetualbits force-pushed the focus-follows-cursor-no-raise-toggle branch from c181e07 to 19744d9 Compare August 11, 2026 17:33
}
false
});
// Defaults to true so that turning on focus-follows-cursor keeps the

@gold gold Aug 27, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion only:

The historical behavior is a UX gaffe; thus part of the fix should be to change the default to focus and not raise, which is what the majority of users who enable focus follows cursor would want. Allow the user to opt in to the historical behavior.

@perpetualbits

perpetualbits commented Aug 27, 2026 via email

Copy link
Copy Markdown
Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants