Skip to content

Fail gracefully instead of crashing if grab fails with the error "Could not grab modal" #1031

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

icyflame
Copy link

@icyflame icyflame commented May 9, 2025

I have been using PaperWM on a daily basis for the past few months and it is great. One of the problems that I kept running into repeatedly was #991. This issue was reported on Gnome 47. I ran into this problem on Gnome 42.9.

I attempted a naive fix which simply tries to clean-up all the state instead of crashing. This works well; I have been using a version of this fix, applied on top of the gnome-44 branch, for the past month and I have not suffered any Could not grab modal crashes. I have backported this change to the gnome-44 branch as well: #1032.

It would be great if I could get some guidance about whether this fix looks logical, and whether there might be a way to reproduce this code path somehow. We need to somehow get into preview_navigate (which happens when one uses a keyboard shortcut to switch windows, I believe?) but get there in a state where the keyboard is already grabbed by something else, thus causing PaperWM to fail to grab the keyboard.

Meanwhile, I will continue to use PaperWM daily on two machines (albeit with old Gnome versions: 3.38 and 42.9) I will attempt to get PaperWM up and running on a more recent version and check to see if I run into this crash on the default branch; if I do, then, I will also see whether this fix solves the crash.

I would really like to fix this issue within PaperWM (upstream) because I have not run into any other bug at all and this is a great project!

I have been using PaperWM on a daily basis for the past few months and it is great. One of the
problems that I kept running into repeatedly was paperwm#991. This
issue was reported on Gnome 47. I ran into this problem on Gnome 44.

I attempted a naive fix which simply tries to clean-up all the state instead of crashing. This works
well; I have been using a version of this fix, applied on top of the gnome-44 branch, for the past
month and I have not suffered any `Could not grab modal` crashes.

It would be great if I could get some guidance about whether this fix looks logical, and whether
there might be a way to reproduce this code path somehow. We need to somehow get into
`preview_navigate` (which happens when one uses a keyboard shortcut to switch windows, I believe?)
but get there in a state where the keyboard is already grabbed by something else, thus causing
PaperWM to fail to grab the keyboard. I would really like to fix this issue within PaperWM because I
have not run into any other bug at all and this is a great project!

Signed-off-by: Siddharth Kannan <mail@siddharthkannan.in>
jtaala added a commit that referenced this pull request May 17, 2025
…ils with the error "Could not grab modal" (#1032)

Related to #991. This is backport of the PR to the PaperWM extension
version targeting Gnome 44. The PR to the `develop` branch is
#1031. Please see that PR for
more details.
@jtaala
Copy link
Collaborator

jtaala commented May 17, 2025

See comments on #1032.

Thanks @icyflame - I haven't seen this issue on later Gnome versions (e.g. current 47 etc.). Although, that may be due to how I use PaperWM etc.

Let me know if succeed in seeing this issue in latest gnome and PaperWM. If so, I'm happy to run this branch for a few days just to make sure it doesn't introduce any other issues (and if not, can merge).

Cheers.

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.

2 participants