Skip to content

Add a check to silence an error when switching displays with xrandr. #3

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: master
Choose a base branch
from

Conversation

NicolasWebDev
Copy link

@NicolasWebDev NicolasWebDev commented Sep 29, 2023

Hi,

When I dock/undock my laptop to an external display, I cal xrandr then I restart awesome.
In that case, I had the following error in my awesome logs:

2023-09-28 19:22:39 E: awesome: Error during a protected call: /home/sathors/.config/awesome/awesomewm-micky/init.lua:43: attempt to index a nil value (local 'client_under_mouse')
stack traceback:
    /home/sathors/.config/awesome/awesomewm-micky/init.lua:43: in function </home/sathors/.config/awesome/awesomewm-micky/init.lua:41>
    (...tail calls...)
    [C]: in function 'xpcall'
    /usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
    (...tail calls...)
    /usr/share/awesome/lib/gears/timer.lua:198: in local 'func'
    /usr/share/awesome/lib/gears/object.lua:148: in function 'gears.object.emit_signal'
    [C]: in function 'xpcall'
    /usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
    (...tail calls...)
    /usr/share/awesome/lib/gears/timer.lua:92: in function </usr/share/awesome/lib/gears/timer.lua:91>

To fix the error in that case, I added a simple check in the code to bail out if client_under_mouse is nil.

Maybe it is not the best way to fix the problem, I'm not sure, because my knowledge of lua scripting and of the awesome API is limited.

@basaran
Copy link
Owner

basaran commented Nov 24, 2023

Not at all, it's the right way. Thank you for pointing it out. I actually had a similar fix on my local dev. I will create a dev branch soon to include this.

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