This is a simple Qt5 app, with a frameless and half transparent window that shadows the screen for 5 (default) minutes. No mouse or keyboard blocking is implemented. It's just a window with a countdown timer. It only tells you that you've got to stop for a while, if you would like to. Otherwise it could be dismissed with ALT + F4. It's all up to you.
This program does not invoke itself. I use cron
to run it every half an
hour on my Linux desktop.
-
Precompiled executable for Linux and MacOS are available under bin directory. If Linux, copy the executable to system path. If MacOS, copy to
Applications
. -
Copy & paste the following to an empty file, say
cronjob.txt
.For Linux,
0,30 * * * * DISPLAY=:0.0 /home/gongzhitaao/.local/bin/block-qt -d 1
Note the
DISPLAY:0.0
, reason for this could found in this thread.For MacOS
*/30 * * * * open -a block-qt
Note that
0,30
and*/30
are equivalent. -
In command line, type
contab cronjob.txt
to register this cron job. Basically it tells the system to run this program every half an hour.
This app supports some simple command line arguments, type block-qt -h
to see
the options.
-d, --duration <x> Shadows the screen for <x> minutes
-h, --help Displays this help.
-v, --version Displays version information.