It is currently March 28th, 2024, 9:14 am

Away From Keyboard(/mouse) plugin?

Share and get help with Plugins and Addons
nixx3d
Posts: 28
Joined: February 17th, 2014, 2:22 am

Re: Away From Keyboard(/mouse) plugin?

Post by nixx3d »

ok.. I don't like doing this, but figured to at least give it a try :)
As my 'coding' knowledge doesn't go further then some html, a bit of actionscript and even less JavaScript I want to ask the following:

if there is anybody out there that's in a good mood, bored and wants to make a stranger happy... would that person want to write a plugin for rainmeter that shows the time value of the total user inactivity (no keys + no mouse) ?


I've searched the web for useful things about the code, it 'seems' to be fairly simple for those that know what they are doing.

http://www.codeproject.com/Articles/9104/How-to-check-for-user-inactivity-with-and-without

Since I have no clue on how it should be implemented and have no wish (not laziness, just a realistic assessment of time spend vs. result) to give many hours learning how to compile a plugin and even more hours on figuring out how to debug it I hope someone with the C# knowledge & plugin experience can "just" "whip" this out with the examples above (and below).

I don't want to be a freeloader, so if that person has desires for some graphic work I'd be happy to return a similar favor (my work can be found at http://www.3d-specialist.net)

thanks in advance!



http://www.dotnetspider.com/resources/29654-To-get-System-idle-time.aspx
http://www.codeproject.com/Articles/13756/Detecting-Application-Idleness
http://icodesnippet.com/snippet/cpp/determine-windows-idle-time-using-getlastinputinfo-dreamincode
http://www.codeproject.com/Questions/94947/Detect-user-inactivity-systemwide
http://forums.codeguru.com/showthread.php?484968-Terminating-an-app-after-5-min-idle
nixx3d
Posts: 28
Joined: February 17th, 2014, 2:22 am

Re: Away From Keyboard(/mouse) plugin?

Post by nixx3d »

jsmorley wrote: Yeah, agreed, and I don't think that is the best resource to use. If you read the remarks:

This function is useful for input idle detection. However, GetLastInputInfo does not provide system-wide user input information across all running sessions. Rather, GetLastInputInfo provides session-specific user input information for only the session that invoked the function.

Someone might get a wild hair and take a look at this, you never know.
It seemed I was aiming for that as I was writing the previous post without seeing your response :)

Have tried to make it as easy as possible.. now just to hope that someone feels like it.
Not quite sure though what that 'session' means, I figured it is the current user, not?
Or is it the current program that invokes the request?

I've found some testing apps in the last example thread that does display the data that I'm looking for.. so hope the answer is in there..

we'll see.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Away From Keyboard(/mouse) plugin?

Post by Brian »

I made a little plugin here: Removed.

Some strange things I noticed:

  1. The OS seems to only update this value every 15 seconds (at least for Windows 7, not sure about other OS's). So the measure returns 0 if there is no idleness, and when it is idle, the measure increments in 15 second intervals.
  2. Even if a user moves the mouse or uses the keyboard (etc.), the measure only updates in that 15 second timeframe, so it may appear the measure is giving incorrect information.


I can't seem to find any other way around it at the moment, but I am sure something exists.


EDIT - We have added this to the SysInfo plugin.

-Brian
nixx3d
Posts: 28
Joined: February 17th, 2014, 2:22 am

Re: Away From Keyboard(/mouse) plugin?

Post by nixx3d »

Brian wrote:I made a little plugin here:

Some strange things I noticed:
  1. The OS seems to only update this value every 15 seconds (at least for Windows 7, not sure about other OS's). So the measure returns 0 if there is no idleness, and when it is idle, the measure increments in 15 second intervals.
  2. Even if a user moves the mouse or uses the keyboard (etc.), the measure only updates in that 15 second timeframe, so it may appear the measure is giving incorrect information.
I can't seem to find any other way around it at the moment, but I am sure something exists.

-Brian
Wow, this is awesome, Thank you very much!

the 15 second thing is not really an issue for my use.
Read somewhere that is the default system interval.
In the demo of the last link (direct source here http://forums.codeguru.com/attachment.php?attachmentid=25434&d=1253504408 ) they do have it per milisecond, perhaps that it can be helpfull.

And it seems I'm lucky as the time is directly reset when I use my wacom (i do not have a mouse) so in my situation it's perfect!
I guess the wacom driver force windows to update it's idle time directly.

again, thank you! this will enable my skin to be more effective.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Away From Keyboard(/mouse) plugin?

Post by Brian »

You are very welcome.

I decided to go another route to get the last input information as it is more accurate and it is really unlikely that many Rainmeter users will be using multiple user accounts at the same time.

Check here for the latest: Removed

EDIT - We have added this to the SysInfo plugin. Check here for more information: http://docs.rainmeter.net/manual-beta/plugins/sysinfo

-Brian
nixx3d
Posts: 28
Joined: February 17th, 2014, 2:22 am

Re: Away From Keyboard(/mouse) plugin?

Post by nixx3d »

Brian wrote:You are very welcome.

I decided to go another route to get the last input information as it is more accurate and it is really unlikely that many Rainmeter users will be using multiple user accounts at the same time.

Check here for the latest: Removed

EDIT - We have added this to the SysInfo plugin. Check here for more information: http://docs.rainmeter.net/manual-beta/plugins/sysinfo

-Brian
Great work!
And thank you again for the quick implementation, it's much appreciated!
nixx3d
Posts: 28
Joined: February 17th, 2014, 2:22 am

Re: Away From Keyboard(/mouse) plugin?

Post by nixx3d »

ok, maybe one more question, just to clear some confusion on my side..

Basically I'm implementing the Idle result as an UpdateDivider setting where I have the following basics before the rest of skin starts

Code: Select all

[Rainmeter]
Update=100

[variables]
Refresh=1
IdleDelay=10
IdleFactor=(1+(([IdleTime]/60)*#IdleDelay#))
Update=(#Refresh#*#IdleFactor#)
UpdateOHM=(#Update#*10)
; and 10 more update variations

[IdleTime]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IDLE_TIME
It all seems to work as far I can tell, but now the question is, do I need to use "DynamicVariables=1" with all measures and meters to do it 'correctly'?

At first I had the updatedivider and DynamicVariables settings incorportated with the styles structure, but this didn't seem to always work
So I'm not entirely sure about the correct method.

alternatively is there an option to simply set all variables to dynamic for the whole skin?

it might be worth do add that the variables refresh & idlefactor are there so only those 2 will need adjustment to quickly customize all the update rates.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Away From Keyboard(/mouse) plugin?

Post by Brian »

nixx3d wrote:It all seems to work as far I can tell, but now the question is, do I need to use "DynamicVariables=1" with all measures and meters to do it 'correctly'?
Just like any other dynamic variable, you will need to add DynamicVariables=1 when using this as a section variable (ie. [IdleTime]). DynamicVariables=1 is not required when used in a bang, formula (for Calc measures), IfConditions, and when used with the MeasureName option of a meter (ie. MeasureName=IdleTime).

nixx3d wrote:At first I had the updatedivider and DynamicVariables settings incorportated with the styles structure, but this didn't seem to always work
So I'm not entirely sure about the correct method.
DynamicVariables=1 and UpdateDivider should work just fine with MeterStyles.

nixx3d wrote:alternatively is there an option to simply set all variables to dynamic for the whole skin?
Not at this time, sorry.


-Brian
Post Reply