RFC: idle protocol

Martin Graesslin mgraesslin at kde.org
Tue Dec 8 23:17:40 PST 2015


On Wednesday, December 9, 2015 4:19:12 PM CET Peter Hutterer wrote:
> On Tue, Dec 08, 2015 at 02:12:01PM +0100, Martin Graesslin wrote:
> > Hi Wayland-developers,
> > 
> > at KDE we developed a protocol for our framework kidletime [1]. The idea
> > is to notify Wayland clients when a wl_seat has been idle for a specified
> > time. We use this for example for power management, screen locking etc.
> > But a common use case is also setting a user as away in a chat
> > application.
> > 
> > We think that this protocol can be in general useful for all Wayland based
> > systems. Our current protocol is attached to this mail. Of course for
> > integration into wayland protocols the namespace needs adjustments (I'm
> > open for suggestions).
> > 
> > The reference implementation of the protocol can be found in the KWayland
> > repository (client at [2], server at [3]).
> > 
> > Best Regards
> > Martin Gräßlin
> > 
> > [1] http://inqlude.org/libraries/kidletime.html
> > [2] git://anongit.kde.org/kwayland (path src/client/idle.h and src/client/
> > idle.cpp)
> > [3] git://anongit.kde.org/kwayland (path src/server/idle_interface.h and
> > src/ server/idle_interface.cpp)
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <protocol name="idle">
> > 
> >   <copyright><![CDATA[
> >   
> >     Copyright (C) 2015 Martin Gr????lin
> >     
> >     This program is free software: you can redistribute it and/or modify
> >     it under the terms of the GNU Lesser General Public License as
> >     published by
> >     the Free Software Foundation, either version 2.1 of the License, or
> >     (at your option) any later version.
> >     
> >     This program is distributed in the hope that it will be useful,
> >     but WITHOUT ANY WARRANTY; without even the implied warranty of
> >     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >     GNU Lesser General Public License for more details.
> >     
> >     You should have received a copy of the GNU Lesser General Public
> >     License
> >     along with this program.  If not, see <http://www.gnu.org/licenses/>.
> >   
> >   ]]></copyright>
> >   <interface  name="org_kde_kwin_idle" version="1">
> >   
> >       <description summary="User idle time manager">
> >       
> >         This interface allows to monitor user idle time on a given seat.
> >         The interface allows to register timers which trigger after no
> >         user activity was registered on the seat for a given interval. It
> >         notifies when user activity resumes.
> you need to describe what classifies as "user activity".

something like "after no input events with a new timestamp"? I'm always bad at 
writing documentation ;-)

> 
> >         This is useful for applications wanting to perform actions when
> >         the user is not interacting with the system, e.g. chat
> >         applications setting the user as away, power management features
> >         to dim screen, etc..
> >       
> >       </description>
> >       <request name="get_idle_timeout">
> >       
> >         <arg name="id" type="new_id"
> >         interface="org_kde_kwin_idle_timeout"/>
> >         <arg name="seat" type="object" interface="wl_seat"/>
> >         <arg name="timeout" type="uint" description="The idle timeout in
> >         msec"/>
> >       
> >       </request>
> >   
> >   </interface>
> >   <interface name="org_kde_kwin_idle_timeout" version="1">
> >   
> >       <request name="release" type="destructor">
> >       
> >         <description summary="release the timeout object"/>
> >       
> >       </request>
> >       <request name="simulate_user_activity">
> >       
> >           <description summary="Simulates user activity for this timeout,
> >           behaves just like real user activity on the seat"/>>       
> >       </request>
> 
> please rename this to "reset_timeout", because "user activity" includes a
> lot more than resetting a timeout under certain condition. You can still
> make it clear in the documentation when it will trigger, what the context
> is, etc., but naming this simulate_user_activity is a bad idea IMO.

sure, good suggestion to rename to reset_timeout.

> 
> >       <event name="idle">
> >       
> >           <description summary="Triggered when there has not been any user
> >           activity in the requested idle time interval"/>>       
> >       </event>
> 
> what happens when the idle time has been exceeded by the time the request is
> processed? or does it only trigger from time-of-request + idletime? if the
> former, you need to detail how the compositor is supposed to keep track of
> this.

It's the latter.

> 
> >       <event name="resumed">
> >       
> >           <description summary="Triggered on the first user activity after
> >           an idle event"/>>       
> >       </event>
> 
> same here, more information is needed, can this be triggered before an idle
> event?

no. I would consider this as a possible security problem if it were possible 
to get notified on each input event.

Thanks for the feedback!

Cheers
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151209/c98228e5/attachment.sig>


More information about the wayland-devel mailing list