Timing how long your computer has been idle

If you have macros or EventGhost Configuration Tree items you wish to share this is the place to do it.
Post Reply
User avatar
Boolean263
Experienced User
Posts: 67
Joined: Sat Aug 12, 2017 7:52 pm
Location: Ottawa, Canada
Contact:

Timing how long your computer has been idle

Post by Boolean263 » Sun Sep 03, 2017 10:14 pm

The `System.Idle` event fires once, after the computer has been idle for about a minute. I wanted to track how long the computer had been idle, so I created this fairly simple setup. It requires the Timer plugin (which ships with EventGhost).

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
    <Folder Name="Idle Timer" XML_Guid="{027846E3-D2C8-4EF7-9005-D96A94CB74E7}" Expanded="True">
        <Macro Name="Start idle timer" XML_Guid="{55189A2D-A4B5-4D5A-A148-611D60BF43CB}">
            <Event Name="System.Idle" XML_Guid="{3856D2CF-75F2-41BA-B219-FC85BAEEC204}" />
            <Action Name="Timer: Start idle timer" XML_Guid="{0B733894-7472-45B1-86EF-0D331820847E}">
                Timer.TimerAction(u'Idle', 0, 0, 60.0, u'Idle.', True, True, 0, u'00:00:00')
            </Action>
        </Macro>
        <Macro Name="Stop idle timer" XML_Guid="{99CAADFC-8879-42E6-9755-96D1157F58A8}">
            <Event Name="System.UnIdle" XML_Guid="{77A2E3AC-AFC4-437D-81DD-B5B00F450290}" />
            <Action Name="Timer: Stop idle timer" XML_Guid="{708830E5-3ADB-4693-8466-C06DC8094589}">
                Timer.TimerAction(u'Idle', 4, 1, 1.0, u'', False, True, 1, u'00:00:00')
            </Action>
        </Macro>
    </Folder>
</EventGhost>
With this enabled, you get a `Timer.Idle.N` event every minute, where N is the number of minutes since the `System.Idle` event fired. (They stop appearing when the `System.UnIdle` event fires.) I use this to fire up iTunes' visualization mode as my screensaver after 5 minutes, but I'm sure there are other uses.

Enjoy!
Windows 10 Home, version 1703, build 15063.540 · EventGhost 0.5.0-rc4 · wxPython 3.0.2.0
Python programmer for fun and profit. Dabbler in EventGhost plugin writing.

User avatar
Boolean263
Experienced User
Posts: 67
Joined: Sat Aug 12, 2017 7:52 pm
Location: Ottawa, Canada
Contact:

Re: Timing how long your computer has been idle

Post by Boolean263 » Sat Sep 09, 2017 4:04 pm

Boolean263 wrote:I use this to fire up iTunes' visualization mode as my screensaver after 5 minutes, but I'm sure there are other uses.
If anyone was curious about how I did that, here's (a trimmed down copy of) my tree for doing that. It uses new actions that I added to the iTunes plugin, which is one reason I didn't post it earlier.

Summary of how it works:
  • The "iTunes as screensaver" folder has a macro that triggers on Timer.Idle.5 which turns on iTunes' visualization and brings it to the front. There's another one that turns it off if it detects System.UnIdle.
  • The above folder is disabled in normal use, so my regular screensaver comes up when iTunes isn't playing. Actions in the "Detecting programs" folder enable the first folder when it thinks iTunes is playing, and disables it when it thinks iTunes is stopped.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
    <Folder Name="Export" XML_Guid="{06A11DF7-DC5F-4396-967A-356946DE94B9}" Expanded="True">
        <Folder Name="Detecting programs" XML_Guid="{B823F988-1E8F-49CE-93EC-6F8F44796ED2}" Expanded="True">
            <Macro Name="Enable: iTunes as screensaver" Enabled="False" XML_Guid="{BB6E1768-8B18-4D35-A815-B29C35431001}" Expanded="True">
                <Event Name="iTunes.StreamTrackChanged" XML_Guid="{EDECDA44-B13F-40CE-B056-1D7E0CDAE6BC}" />
                <Event Name="iTunes.TrackChanged" XML_Guid="{ECFC1936-635B-4344-BEA1-71F4377E59C4}" />
                <Action XML_Guid="{865E772E-3992-43F7-83E1-442E5ECC04FD}">
                    EventGhost.EnableItem(XmlIdLink(257))
                </Action>
            </Macro>
            <Macro Name="Disable: iTunes as screensaver" XML_Guid="{9D70C1E5-8DCB-4F7D-B9EB-6D5BBBE1B4DF}" Expanded="True">
                <Event Name="iTunes.Stopped" XML_Guid="{7A03DEFB-7869-4BFB-92B8-2E1E983892B7}" />
                <Event Name="iTunes.Closing" XML_Guid="{E8B48A1B-0D6E-4F39-8C52-AA1C9D1FA571}" />
                <Event Name="iTunes.NotRunning" XML_Guid="{7D275BA0-2C9B-4BBA-90A1-6D4938F5FF72}" />
                <Action XML_Guid="{41BC7543-852B-450A-AF9F-A92A2AA70715}">
                    EventGhost.DisableItem(XmlIdLink(257))
                </Action>
            </Macro>
        </Folder>
        <Folder Name="iTunes as screensaver" id="257" XML_Guid="{D3E7AA46-746A-4C9C-931A-D59EE1530DEA}" Expanded="True">
            <Macro Name="Visualization on if idle" XML_Guid="{96AF8848-76F2-4ECE-8AC1-08F110724848}" Expanded="True">
                <Event Name="Timer.Idle.5" XML_Guid="{088E734D-1A3D-4FE3-A17D-927CEF24951D}" />
                <Action XML_Guid="{10AD35D7-42EC-47B7-A764-9A2E2A4E8C79}">
                    iTunes.VisualizationOn()
                </Action>
                <Action XML_Guid="{36ABB7C8-0A4D-474F-BC4F-7DB45F70FA86}">
                    Window.BringToFront()
                </Action>
            </Macro>
            <Macro Name="Visualization off if unidle" XML_Guid="{2AA02557-B0A8-4A02-8AEB-96575D3712AA}" Expanded="True">
                <Event Name="System.UnIdle" XML_Guid="{77A2E3AC-AFC4-437D-81DD-B5B00F450290}" />
                <Action XML_Guid="{18122218-6972-40B2-8DFD-CDC8250E87AD}">
                    iTunes.VisualizationOff()
                </Action>
            </Macro>
        </Folder>
    </Folder>
</EventGhost>
Windows 10 Home, version 1703, build 15063.540 · EventGhost 0.5.0-rc4 · wxPython 3.0.2.0
Python programmer for fun and profit. Dabbler in EventGhost plugin writing.

Post Reply