#803 closed enhancement (worksforme)
Handler for user timeout
Reported by: | Scott Bennett | Owned by: | Scott Bennett |
---|---|---|---|
Priority: | major | Milestone: | 0.14 |
Component: | server | Version: | trunk |
Keywords: | Cc: |
Description
Looking for a way to detect that the user has not been interacting with their XPRA session for 'x' seconds. The goal would be to do something configurable when the user has not sent any keyboard or mouse click events for the specified period of time. Mouse movements may or may not be taken into consideration depending on level of effort.
Change History (10)
comment:1 Changed 6 years ago by
Milestone: | → 0.14 |
---|---|
Owner: | changed from Antoine Martin to Scott Bennett |
comment:2 Changed 6 years ago by
Adding a server option + timer would be excellent.
Dropping the connection with an "idle timeout" sounds like a good (and useful) default behavior and will work well for us.
Additionally, we would need to receive an event on the server somehow so that we can decide to trigger a shutdown of the server or not.
Perhaps a method that I can override that returns true for "disconnect and shutdown" or false for "just disconnect"? Or a void method in which I could invoke a shutdown if needed?
comment:3 Changed 6 years ago by
Done in r8642.
To use it:
xpra start --idle-timeout=10
Then attach and the client should get disconnected after 10 seconds of inactivity (key presses or mouse clicks).
You can also change the timeout value at runtime using xpra control:
xpra control :DISPLAY idle-timeout 120
The value zero disables the timeout.
As for overriding the code to inject your own logic, you should be able to just override (or monkey patch) idle_timeout_cb
in ServerBase
.
comment:5 Changed 6 years ago by
Just to make it even friendlier, would it be possible to add mouse cursor events over an xpra window which has focus to the list of events that reset timeout clock?
comment:6 Changed 6 years ago by
r8679 resets the timer when:
- the window gains focus (usually when the user clicks on it, or alt-tabs to it) - we can easily remove this if you want, I thought it made sense
- the mouse is moved over the window whilst it has focus
To make it easier to debug, I've added a new debug category for the server: -d timeout
. Shows things like:
user_event() schedule_idle_timeout() idle_timer=1465, idle_timeout=20 user_event() schedule_idle_timeout() idle_timer=1467, idle_timeout=20
Something else that Scott mentioned, is the ability to have another event that fires before real the timeout so that we can trigger some things (like slowing down window updates, etc). This should probably go in a separate ticket.
comment:7 Changed 6 years ago by
comment:8 Changed 6 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closing this, please re-open if you have problems or follow up in #816.
comment:10 Changed 6 weeks ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/803
We already have a value which fits the bill exactly: the
ServerSource
'slast_user_event
records when the last key event or button event was received by the server, you can see it with:I think we can just add a server option (call it
idle-timeout
? and make it default to 0 = disabled), we then just (re-)schedule a timer inuser_event()
.As for the exact action to take, the easiest thing would be to hardcode it to drop the connection with a "idle timeout" warning message.
Or maybe you want to exit the server instead? (in which case this would probably need to be configurable, in a similar way to the key shortcuts in the client)