A lightweight background service for Ubuntu/Debian Linux that reminds you to take breaks after 45 minutes of continuous computer use. Help maintain your health and productivity with regular break reminders!
- β±οΈ Smart Usage Tracking: Monitors continuous active usage time
- π Idle Detection: Automatically pauses when screen is locked or system is idle
- π Desktop Notifications: Uses native Ubuntu notifications
- βοΈ Highly Configurable: Customize break intervals, idle thresholds, and notification messages
- π¬ Custom Rules: Skip notifications during specific activities (movies, games, etc.)
- πͺΆ Minimal Resource Usage: Designed to run in the background with minimal CPU and memory impact
- π Auto-start: Runs automatically at system startup via systemd
- The service starts automatically when you log in
- It monitors your active usage time (excluding idle/lock periods)
- After 45 minutes (configurable) of continuous active use, you get a notification
- Timer resets after the notification or when you lock your screen
- Process repeats to help you maintain healthy break habits
- Ubuntu, Debian, or other Debian-based Linux distribution
- Python 3.6 or higher
- X11 display server
xprintidle- for idle time detectionlibnotify-bin- for desktop notifications
- Clone or download this repository:
cd ~/Documents
git clone <repository-url> forty_five_break
# Or if you already have the files:
cd ~/Documents/forty_five_break- Run the installation script:
chmod +x install.sh
./install.shThe installer will:
- Check for required dependencies and install them if missing
- Set up configuration files
- Install the systemd service
- Optionally start and enable the service
If you prefer to install manually:
- Install dependencies:
sudo apt-get update
sudo apt-get install -y python3 xprintidle libnotify-bin- Create configuration directory:
mkdir -p ~/.config/forty_five_break
cp config.json.example ~/.config/forty_five_break/config.json- Install systemd service:
mkdir -p ~/.config/systemd/user
cp forty-five-break.service ~/.config/systemd/user/
systemctl --user daemon-reload- Make script executable:
chmod +x forty_five_break.py- Start and enable the service:
systemctl --user enable forty-five-break.service
systemctl --user start forty-five-break.serviceThe configuration file is located at ~/.config/forty_five_break/config.json.
{
"break_interval_minutes": 45,
"idle_threshold_seconds": 300,
"check_interval_seconds": 10,
"notification_title": "Time for a Break! π§",
"notification_message": "You've been working for 45 minutes. Take a 5-minute break!",
"notification_urgency": "normal",
"custom_rules": {
"enabled": false,
"process_blacklist": ["vlc", "mpv", "firefox"]
}
}Options Explained:
break_interval_minutes: Time of continuous usage before notification (default: 45)idle_threshold_seconds: Seconds of inactivity before considering user idle (default: 300)check_interval_seconds: How often to check usage status (default: 10)notification_title: Title of the break notificationnotification_message: Message shown in the notificationnotification_urgency: Notification urgency level (low,normal,critical)custom_rules.enabled: Enable custom rule processingcustom_rules.process_blacklist: List of process names that will skip notifications when running
To skip notifications when watching movies or playing games:
- Edit your config file:
nano ~/.config/forty_five_break/config.json- Enable custom rules and add process names:
{
...
"custom_rules": {
"enabled": true,
"process_blacklist": [
"vlc",
"mpv",
"totem",
"firefox",
"chromium",
"steam",
"minecraft"
]
}
}- Restart the service:
systemctl --user restart forty-five-break.serviceStart the service:
systemctl --user start forty-five-break.serviceStop the service:
systemctl --user stop forty-five-break.serviceRestart the service:
systemctl --user restart forty-five-break.serviceCheck service status:
systemctl --user status forty-five-break.serviceEnable auto-start at boot:
systemctl --user enable forty-five-break.serviceDisable auto-start:
systemctl --user disable forty-five-break.serviceView systemd logs:
journalctl --user -u forty-five-break.service -fView application logs:
tail -f ~/.local/share/forty_five_break/monitor.logTo test if the service is working:
- Start the service
- Modify the config to use a shorter interval (e.g., 1 minute):
{
"break_interval_minutes": 1,
...
}- Restart the service
- Use your computer actively for 1 minute
- You should see a notification
- Change the config back to your preferred interval
- Check if Python 3 is installed:
python3 --version - Verify the script path in the service file matches your installation
- Check logs:
journalctl --user -u forty-five-break.service -e
- Ensure
notify-sendis installed:which notify-send - Test notification manually:
notify-send "Test" "This is a test" - Check if DISPLAY and DBUS_SESSION_BUS_ADDRESS are set correctly
- Install xprintidle:
sudo apt-get install xprintidle - Test it:
xprintidle(should show milliseconds since last input)
- Enable lingering:
loginctl enable-linger $USER
To remove Forty-Five Break:
# Stop and disable the service
systemctl --user stop forty-five-break.service
systemctl --user disable forty-five-break.service
# Remove service file
rm ~/.config/systemd/user/forty-five-break.service
systemctl --user daemon-reload
# Remove config and logs (optional)
rm -rf ~/.config/forty_five_break
rm -rf ~/.local/share/forty_five_break
# Remove the project directory
rm -rf ~/Documents/forty_five_breakFeel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is open source and available under the MIT License.
Taking regular breaks can:
- Reduce eye strain and prevent computer vision syndrome
- Decrease risk of repetitive strain injuries
- Improve focus and productivity
- Reduce stress and mental fatigue
- Promote better posture and physical health
Remember: Your health is more important than any deadline! π
Q: Can I change the break interval?
A: Yes! Edit ~/.config/forty_five_break/config.json and change break_interval_minutes.
Q: Will it drain my battery?
A: No. The service is designed with minimal resource usage (CPU limited to 5%, memory capped at 50MB).
Q: What happens if I lock my screen?
A: The timer pauses automatically and resets when you lock your screen or become idle.
Q: Can I use this on non-Ubuntu Linux?
A: Yes, any Debian-based distribution should work. Other distros may work with minor adjustments.
Q: Does it work on Wayland?
A: This version is designed for X11. Wayland support may require modifications to the idle detection code.
Made with β€οΈ for healthier computing habits