Skip to content

MatteoBax/power-idle-daemon

Repository files navigation

POWER-IDLE-DAEMON

Smart idle-based suspend daemon for Linux desktops


Description

POWER-IDLE-DAEMON is a lightweight Linux daemon that automatically suspends the system when the computer is truly idle.

The daemon uses DBus APIs to detect system session state and integrates resource monitoring to avoid false suspensions during background activity.

The system will suspend only when:

  • The session is locked

  • The display is turned off

  • The system is idle according to configurable thresholds:

    • CPU usage
    • Disk I/O
    • Network I/O

All behavior is fully configurable via a configuration file.


🧩 Supported Platforms

Desktop Environment

  • GNOME

Linux Distribution

  • Debian
  • Ubuntu

Compatibility & Testing

Platform compatibility is controlled via the supported_platforms.json file.

Current configuration

{
    "desktop_environment": [
        "gnome"
    ],
    
    "linux_distribution": [
        "debian",
        "ubuntu"
    ]
}

Forcing compatibility

  • If your system is not listed in supported_platforms.json, installation will be blocked by default.
  • To force execution on an unlisted platform, simply add your desktop environment and/or distribution to the JSON file and run the installation process.

This enables experimental support on untested environments.

Community testing

If POWER-IDLE-DAEMON works correctly on other platforms:

  • Please report compatibility by opening an issue
  • Include system information (DE, distro)

This helps reduce testing effort and progressively expand official platform support.


Limitations

  • Only GUI-based environments are supported.
  • CLI-only (headless) systems are not supported due to DBus and session-state dependencies.

🧠 How It Works

The daemon continuously monitors system state using DBus APIs and low-level system metrics collected via psutil (Python).

Logical Conditions

The system enters suspend only if all conditions are satisfied:

  1. Session is locked (DBus)

  2. Display is powered off (DBus)

  3. Lock state has been active for at least IDLE_BEFORE_MONITORING_SEC

  4. System activity is below thresholds:

    • CPU usage < CPU_UTILIZATION_THRESHOLD
    • Disk I/O < DISK_IO_THRESHOLD_BYTES_PER_MEASURE_INTERVAL
    • Network I/O < NET_IO_THRESHOLD_BYTES_PER_MEASURE_INTERVAL

⚙️ Configuration

The daemon is configured via a single configuration file (/etc/power_idle_daemon/power-idle-daemon.conf).


📘 Configuration Parameters

Parameter Description
SUSPENSION_MODE System suspend mode (e.g. deep, s2idle)
CPU_UTILIZATION_THRESHOLD CPU usage (%) above which the system is considered active
DISK_IO_THRESHOLD_BYTES_PER_MEASURE_INTERVAL Disk I/O (bytes) above which the system is considered active
NET_IO_THRESHOLD_BYTES_PER_MEASURE_INTERVAL Network I/O (bytes) above which the system is considered active
IDLE_BEFORE_MONITORING_SEC Time in lockscreen before monitoring
RESOURCE_USAGE_MEASURE_TIME_SEC Resource sampling interval

🔐 Security Model

  • Resource monitoring runs with root privileges

  • Display power state (on/off) monitoring runs in user space

  • Privileged access is required for:

    • Disk I/O monitoring
    • Network I/O monitoring
    • CPU usage monitoring
    • Suspend execution

Reliability Design

POWER-IDLE-DAEMON prevents suspend during active system usage, including:

  • Network transfers
  • Disk operations
  • CPU usage operations

This is achieved through:

  • Multi-metric verification
  • Time-based validation
  • State machine logic

Installation

See INSTALL.md for detailed installation and uninstallation instructions.


📜 License

GPL-2.0 License


🤝 Contributing

Contributions are welcome.

Areas of interest:

  • Desktop environment support
  • Linux distribution support
  • New features
  • Performance optimization
  • Packaging

About

Linux daemon that automatically suspends the system when idle and the screen is locked.

Resources

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
LICENSE
Unknown
COPYING

Stars

Watchers

Forks

Packages

 
 
 

Contributors