Preempt X11 keyboard grabs and window stacking when lockscreen is active

This commit is contained in:
Luxferre committed 2026-11-01 10:39:40 +02:00
1 parent 83dd79fe76
commit f112b6ae72
78 files changed
+403 -53

No files matched your search

+19 -3
View File
@@ -1270,6 +1270,15 @@ activate_selection(unsigned int ev_state)
return;
}
if (strncmp(act, "@plugin:", 8) == 0) {
if (strncmp(act + 8, "locker", 6) == 0) {
int lfd = open("/tmp/bananarchy_screen_locked",
O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
if (lfd >= 0) {
(void)write(lfd, "1\n", 2);
close(lfd);
}
prevfocuswin = None;
}
hide_menu();
menu_mode = MODE_NONE;
trigger_plugin_open(act + 8);
@@ -3278,10 +3287,15 @@ show_menu(void)
if (!engage_ime)
update_t9_status_indicator();
int keep_plugins_open =
(strcmp(current_builtin_menu, "power") == 0 ||
strncmp(current_builtin_menu, "confirm_", 8) == 0);
if (!menu_active) {
menu_active = 1;
mark_menu_active(1);
close_other_active_plugins();
if (!keep_plugins_open)
close_other_active_plugins();
prevfocuswin = None;
Window fw = None;
int rev = 0;
@@ -3322,7 +3336,8 @@ show_menu(void)
XSetICFocus(xic);
XFlush(dpy);
} else {
close_other_active_plugins();
if (!keep_plugins_open)
close_other_active_plugins();
init_soft_mask = 0;
init_soft_ms = 0;
start_ignore = dmenu_now_ms() + 60;
@@ -3357,7 +3372,8 @@ hide_menu(void)
}
XUngrabKeyboard(dpy, CurrentTime);
XSetErrorHandler(ignore_xerror);
if (prevfocuswin && prevfocuswin != win && prevfocuswin != PointerRoot) {
if (prevfocuswin && prevfocuswin != win && prevfocuswin != PointerRoot &&
access("/tmp/bananarchy_screen_locked", F_OK) != 0) {
XWindowAttributes wa;
if (XGetWindowAttributes(dpy, prevfocuswin, &wa) && wa.map_state == IsViewable)
XSetInputFocus(dpy, prevfocuswin, RevertToParent, CurrentTime);