Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keep-focus-when-hidden option #1109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions niri-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ pub struct Cursor {
pub xcursor_size: u8,
#[knuffel(child)]
pub hide_when_typing: bool,
#[knuffel(child)]
pub keep_focus_when_hidden: bool,
#[knuffel(child, unwrap(argument))]
pub hide_after_inactive_ms: Option<u32>,
}
Expand All @@ -771,6 +773,7 @@ impl Default for Cursor {
xcursor_theme: String::from("default"),
xcursor_size: 24,
hide_when_typing: false,
keep_focus_when_hidden: false,
hide_after_inactive_ms: None,
}
}
Expand Down Expand Up @@ -3766,6 +3769,7 @@ mod tests {
xcursor_size: 16,
hide_when_typing: true,
hide_after_inactive_ms: Some(3000),
keep_focus_when_hidden: false
},
screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
clipboard: Clipboard {
Expand Down
4 changes: 3 additions & 1 deletion src/niri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ impl State {

let pointer = &self.niri.seat.get_pointer().unwrap();
let location = pointer.current_location();
let under = if self.niri.pointer_hidden {
let under = if self.niri.pointer_hidden
&& !self.niri.config.borrow().cursor.keep_focus_when_hidden
{
PointContents::default()
} else {
self.niri.contents_under(location)
Expand Down
11 changes: 11 additions & 0 deletions wiki/Configuration:-Miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cursor {

hide-when-typing
hide-after-inactive-ms 1000
keep-focus-when-hidden
}

clipboard {
Expand Down Expand Up @@ -142,6 +143,16 @@ cursor {
}
```

#### `keep-focus-when-hidden`

When the cursor is hidden, pointer focus will be kept. This will leave items hovered upon, keep tooltips open, etc.

```kdl
cursor {
keep-focus-when-hidden
}
```

### `clipboard`

Clipboard settings.
Expand Down