elementary / elementary/notifications

Notifications steal focus

Open
#290 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vala
Stars
39
Forks
6
Avg merge
1d 11h
Merged PRs (30d)
7

Description

### What Happened?

On X11 (classic sessions) on eOS8.1.2, notifications steal focus, due to the `NET_WM_WINDOW_TYPE_NOTIFICATION` atom was being set in a `realize` signal handler, which fires after the window is already visible. This creates a race where the window manager might assign focus to the bubble before seeing the notification window type hint.

`base.show()` still triggers focus on X11 if the window type isn't set.

### Steps to Reproduce

1. login to the classic session

```
./build/src/io.elementary.notifications &
sleep 1

# Click into a terminal or text editor to make sure it has focus, then:
notify-send "Test 1" "Did this steal focus?"
sleep 2
notify-send "Test 2" "Still focused?"
sleep 2
notify-send "Test 3" "And this one?"
```

### Expected Behavior

Notifications don't steal focus away from the active window.

### OS Version

8.x (Circe)

### OS Architecture

amd64 (on most hardwares)

### Session Type

Secure Session (Wayland, This is the default), Classic Session (X11)

### Software Version

Latest release (I have run all updates)

### Log Output

```shell

```

### Hardware Info

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.