dev-nis / jolla-settings-screenmonitor

A simple screen usage monitor for Sailfish OS
1 stars 1 forks source link

Feature request: Monitor application usage #7

Open HenkKalkwater opened 3 months ago

HenkKalkwater commented 3 months ago

I saw your app in the Sailfish Community newsletter and it reminded me that I considered once writing an app that kept track of application usage time. Perhaps the feature could be implemented in this app, if you'd be interested.

The idea is to log how long an application has been used each day and to create a list of most-used applications.

An implementation idea that I have depends on the fact that lipstick, the Sailfish OS compositor, emits a dbus notification every time the top-most window changes and sends the pid of the new top-most window:

https://github.com/sailfishos/lipstick/blob/master/src/compositor/compositor.xml#L10-L12

    <signal name="privateTopmostWindowProcessIdChanged">
      <arg name="pid" type="i"/>
    </signal>

The pid can be somewhat mapped to an application name, for Sailfish OS applications at least, by reading the file /proc/$pid/cmdline. It is not ideal, since the name of the executable does not always map to the running application and you'd have to filter out all "boosters" (mapplauncherd) entries and parse their command line.

Would you be interested in this feature? Or would that be out of scope for this application?

dev-nis commented 3 months ago

Hi!

Generally, I would be interested in this feature, I also already thought about it, the only problem is that I don't really have an idea on how to exactly implement this.

But the things you described here might help me to figure it out some day, so thanks for that! If you can provide more help or information, feel free to post it here