Raymo111 / i3lock-color

The world's most popular non-default computer lockscreen.
Other
1.09k stars 137 forks source link

Notifications above lock screen (no compositor) #283

Open kolayne opened 1 year ago

kolayne commented 1 year ago

This issue is a....

[X] Bug
[ ] Other kind of issue (Please describe in detail)

Current Behavior

When various kinds of notifications (e.g. Telegram Desktop, notify-send) arrive with screen locked, they appear on top of the locked screen (with no compositor running).

Expected Behavior

Notifications are not displayed when the screen is locked

Reproduction Instructions

In bash, run sleep 1 && notify-send hey there & i3lock. The notification will appear on screen.

Environment

Output of i3lock --version:

i3lock version: 2.13.c.5

Reproducible in:

[X] AUR package (https://aur.archlinux.org/packages/i3lock-color)
[X] Built from source yourself
[ ] Other (Please describe in detail)

More information

Bisect has shown that the issue has appeared in 0da5cdb4.

Dumb experiments have shown that the following patch (to the current master version) fixes the notifications problem but, unfortunately, makes everything else other than the background color invisible:

diff --git a/xcb.c b/xcb.c
index ae462b0..2af94d4 100644
--- a/xcb.c
+++ b/xcb.c
@@ -183,9 +183,11 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
     }

+    /*
     xcb_visualid_t visual = get_visualtype_by_depth(32, scr)->visual_id;
     xcb_colormap_t win_colormap = xcb_generate_id(conn);
     xcb_create_colormap(conn, XCB_COLORMAP_ALLOC_NONE, win_colormap, scr->root, visual);
+    */

     mask |= XCB_CW_BACK_PIXEL;
     values[0] = get_colorpixel(color);
@@ -203,11 +205,13 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
                 XCB_EVENT_MASK_VISIBILITY_CHANGE |
                 XCB_EVENT_MASK_STRUCTURE_NOTIFY;

+    /*
     mask |= XCB_CW_COLORMAP;
     values[4] = win_colormap;
+    */

     xcb_create_window(conn,
-                      32,
+                      XCB_COPY_FROM_PARENT,
                       win, /* the window id */
                       parent_win,
                       0, 0,
@@ -215,7 +219,7 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
                       scr->height_in_pixels, /* dimensions */
                       0,                     /* border = 0, we draw our own */
                       XCB_WINDOW_CLASS_INPUT_OUTPUT,
-                      visual, /* copy visual from parent */
+                      XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
                       mask,
                       values);


As I have no experience with xorg/xcb programming, I have no idea what I'm doing, so, help is much appreciated :)

Raymo111 commented 1 year ago

Interestingly, I can't repro this on KDE. Which WM/DE are you using?

kolayne commented 1 year ago

i3 version 4.22-35-g754c4f2f

alexandru0-dev commented 1 year ago

i use also i3 v4.22 and also i experience this

kolayne commented 1 year ago

Btw, the issue is reproducible without a window manager. For instance, in xorg started with startx (as in xorg-xinit) and the screen locked with i3lock (i3lock-color, no additional options) notifications from notify-send appear on top of it