-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Screen Lock Sensor Not Functioning #52
Comments
Hey @sqshr that is no good. Would you be able to run the following in a terminal: dbus-monitor "type='signal',sender='org.freedesktop.ScreenSaver',interface='org.freedesktop.ScreenSaver',path='/org/freedesktop/ScreenSaver',member='ActiveChanged'" This will monitor for the signals that the sensor relies upon. While the above command is running, can you try locking and unlocking your screen? When you come back to your unlocked desktop and the terminal, can you check for output from the command that looks like:
The above shows the screen lock going on and off and these are the signals the agent is watching for. If we don't see those, then it's possible that your setup isn't exposing screen lock state via that service, if you do see those signals, then definitely there is a bug in the code. |
Hi,
I've tried gnome-screensaver too (as I assumed that would send the signals) but apparently not! Running Looking under /org/freedesktop/ScreenSaver, I only see Inhibit and Uninhibit as methods- I assume there should be more? Sorry for opening a bug when the issue is clearly me! I'll try and work out what I'm missing. Thanks for your help :) |
Hey this is interesting. It seems like there are multiple places that expose screen locking status on D-Bus. I wonder if there is a better place for me to monitor that covers more desktops/window managers. Can you see if you get any output calling the following method with dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.ListSessions There should hopefully be an object path in the output, which looks something like: Can you copy that path and then run the following: dbus-monitor --system "type='signal',interface='org.freedesktop.DBus.Properties',path='/org/freedesktop/login1/session/_33',member='PropertiesChanged'" Replacing the path as appropriate. Then if you lock and unlock your screen, do you see any signals output in the terminal? 🤞 that there are signals exposed there by Awesome. If so, I could change the code to monitor this location. I seem to get signals reporting in the above for my KDE desktop. I'm assuming Gnome probably does the same. If Awesome also does, then it might be that this is a good place to monitor and catch screen-locking on more machines. |
Hey. I have noted that systemd login status is respected- so if I run Casting the net wide (
So there's the lock signal- I don't see an unlock one though! Again tried with both xscreensaver and gnome-screensaver. |
Interesting! It seems like it might be more useful to use the signal emitted under It's definitely odd that you only see the lock signal and not an unlock one. Did you get any further with your troubleshooting? |
Troubleshooting is perhaps a generous term, but I have a horrendous workaround in bash:
This will generate the unlock message every time the screen is unlocked (I'll just throw it in So as long as my screen lock key combination runs |
Hey I've released version 5.1.2 which contains the changed code to get screen lock status as discussed in this issue. I'm hoping that works, together with your own workaround above for you. Thanks for helping here! |
Hi, thanks very much- I was on holiday last week, so I'm about to give it a go! |
Hi,
I've also run it and not locked my screen- in that case it seems to sit happily/stably. Let me know any other output you'd like to help! |
I can see what the problem is here. I recently discovered that when you add D-Bus watches, all watches get all data from every other watch. I was expecting a particular watch to only receive the data it was watching for. The battery sensor code was written this way. I've fixed it up and v6.0.2 should resolve this problem. Can you try it out? |
Good news- It's stable when I lock and unlock now! However: I'm not seeing any debug output for locking/unlocking (I've grepped for 'lock' and also 'session'. I've also looked in home assistant and can't see lock state as a sensor. Just to confirm, other sensors are updating- so it's all registered and working otherwise. Debug output follows:
|
Alright, I think I can see what is going on. I'll make the D-Bus watch more general in what it triggers on and with some filtering I can get the screen lock state, without any need to know a session beforehand and without any specific desktop interface. I'll implement this in the next version, to release shortly 😄 |
I've released v6.1.0 which I believe should fix this issue. Please try it out and let me know! |
Still no lock sensor present- I don't get the error string "Could not ascertain user session from D-Bus. Cannot monitor screen lock state." in the debug output, nor any mention of screen lock/unlock. For sanity I checked if I was still getting the lock and unlock signals on the system dbus- I am! If there's any output that would help, just let me know. |
Hmm, I'm really unsure why this isn't working for you 😦 The code is now:
You can monitor the messages that would trigger this on the command-line with: dbus-monitor --system "type='signal',interface='org.freedesktop.DBus.Properties',path_namespace='/org/freedesktop/login1/session',member='PropertiesChanged'" I get the signals with Using the above My only thought is that if you aren't seeing messages triggered on lock/unlock with the above Or some restrictions on system bus access for your user are preventing the agent seeing that signal. That would hopefully be revealed with the above |
So, I don't get any output from the above
on lock, and
on unlock. My version into for loginctl is below.
|
Hmm, I don't get those signals at all. Nevertheless I think I understand how it is working on your system and have made some code changes to hopefully capture those signals and set a screen lock sensor appropriately. Can you try out v6.1.1 and see if it correctly picks up your screen lock state? |
Hey @sqshr it sounds like this issue is now fixed? I'll close off this issue, but please try with the latest version of the agent and re-open if it is still a problem with that version. |
Hello
As far as I can tell, the screen lock sensor doesn't seem to be functioning, all is set up and working otherwise.
Installed from go-hass-agent-5.1.0-1-x86_64.pkg.tar.zst (onto arch)
I've seen where the code for the screen lock is and grepped through the debug output for "lock", which should hit any strings, and I don't see any errors nor the sensor appear in home assistant (when many others do).
I'm not running a DE, just awesome with xscreensaver, but I've looked and definitely have org.freedesktop.ScreenSaver as a service, so I don't think it's on my end (very happy to be proven wrong though).
The text was updated successfully, but these errors were encountered: