parctl - parental control for parents


parctl [-bg color]


parctl monitors and limits computer usage ("tube time"). Programs like this are typically used to prevent children from spending too much time over their digital gadgets. The same paradigm has, however, proved to be effective with adult specimen as well, particularly middle-aged computer scientists.

The modus operandi is as follows. The user is given a fixed time quota called slack for every 24 hours. Whenever the user is interacting with the machine, parctl decreases the slack by the corresponding wall clock time. For example, if the user interacts with the machine for 30 minutes, parctl removes 30 minutes from the slack. "Interaction" is defined as "typing on the keyboard or using the mouse".

parctl resets the slack at a certain reset time each day. If the slack gets used up before that, parctl unconditionally suspends the machine by executing sudo pm-suspend. After that, the machine will be practically unusable until the reset time: wake-ups from the suspend will soon cause a re-suspension.

If the user does not interact with the machine for a certain period of time, parctl goes to idle mode and stops consuming the slack. During idle mode, parctl assumes that the user is away from the machine. When the user starts interacting with the machine again, parctl ends idle mode and resumes slack consumption.

parctl displays the remaining slack continuously in a simple window, and warns the user if they are running out of slack. Note that parctl is an X11 application and hence requires a running X session: true terminal junkies are considered hopeless and unsalvageable.

The author acknowledges certain special cases which call for exceptions, such as intense Emacs hacking or other "critical system upgrades", when the system simply cannot be suspended. In such dire circumstances, the user can selectively disable the slack consumption by switching to grace mode. Of course, the real need for such a blunt measure should be sagaciously evaluated each and every time.

The author also acknowledges certain use cases where the user mostly sits around the machine, gazing and immersing whatever audiovisual or other electromagnetic energy is being emitted by the device. Such activity is called consuming, and parctl can be told when consuming is in progress. During consuming, parctl decreases the slack unconditionally, regardless of any physical interaction with the machine. In other words, parctl does not go into idle mode at all.

User interface and configuration

At startup, parctl opens a single window that continuously displays the remaining slack with one second precision. Window background color depends on the current mode:

Grace mode can be toggled by clicking on the window with mouse button 2.

If parctl is consuming, the remaining slack is displayed in boldface font. Consuming can be toggled by clicking the window with mouse button 3.

Slack time, reset time, and thresholds for different modes can be configured in The default values are:



Set the window background color to color.


SIGINT and SIGTERM cause immediate termination. SIGHUP causes a re-evaluation of


The user must be allowed to run sudo pm-suspend without separate authentication.


Copyright 2017 Petteri Hintsanen <>

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.


sudo(8), pm-suspend(8)