This is a small C program that will try to regulate your computer screen time by auto locking your computer after a certain set time. It will then auto unlock your computer after another set time (called the cooldown period).
It is actually a slightly more advanced rewrite of the first program I ever released publicly. That version was written in Python.
Notifications will be given when the computer is being locked so that you won't be blindsided by the auto lock.
Note: on some laptops, the laptop may suspend itself after being locked for some time. The program currently doesn't have a way to wake the computer up from sleep like this, so make sure the cooldown period isn't too long.
PLEASE NOTE: macOS and Windows are NOT SUPPORTED! This is a Linux only program due to the dependencies outlined below
In order to send notifications, libnotify
has to be installed. It's available in almost all Linux distributions. Note: for Fedora while testing this program, I had to install libnotify-devel
for the program to work. I'd recommend installing an equivalent on other distros as well
For the auto locking and unlocking, loginctl
is used, which is a way to interact with systemd's login service. So, systemd is also required.
You can simply compile the program as such (note: only gcc has been tested to work)
make
Then, run ett
It will prompt you to set the time for the working and cooldown periods, then it will keep running and will accordingly take action.
-
Make a config file so that the working and cooldown periods don't need to be entered every time
-
Make ett a systemd service that can be started on boot for a particular user
-
Add macOS and Windows support; this one is trickier since I don't really have a Mac to test my program with
-
Use C libraries for locking system instead of executing shell commands with system()