Idle daemon with conditional timeouts and built in audio inhibitor
Find a file
2025-11-16 03:22:04 +00:00
.github/workflows use tooling flake repo 2025-09-15 00:01:06 +02:00
ctl rust version update 2025-08-31 15:27:09 +02:00
daemon Weekly dependency updates: 2025-10-26 2025-10-31 22:34:57 +01:00
nix minor home-manager change 2025-10-31 22:35:27 +01:00
.envrc first commit 2025-01-18 19:32:46 +01:00
.gitignore package will work 2025-01-30 00:05:15 +01:00
.ignore improved inhibitor logging 2025-07-11 21:12:47 +02:00
Cargo.lock Weekly dependency updates: 2025-11-16 2025-11-16 03:22:04 +00:00
Cargo.toml move code to daemon directory 2025-08-24 09:07:27 +02:00
flake.lock Weekly dependency updates: 2025-11-16 2025-11-16 03:22:04 +00:00
flake.nix use tooling flake repo 2025-09-15 00:01:06 +02:00
LICENSE relicense 2025-03-19 14:53:05 +01:00
README.md rust version update 2025-08-31 15:27:09 +02:00

Moxidle

Feature-rich Wayland idle daemon.

Features

  • Implements the ext-idle-notify-v1 Wayland protocol
  • Supports loginctl commands (lock, unlock, before-sleep)
  • Handles DBus idle-inhibit (used by applications like Firefox and Steam)
  • Supports audio-based idle inhibition
  • Allows for configurable conditional listeners
  • Extends beyond default org.freedesktop.SessionManager protocol by implementing additional features available in kscreenlocker

Configuration

Moxidle's configuration is written in Nix and is located at $XDG_CONFIG_HOME/mox/moxidle.nix or $XDG_CONFIG_HOME/mox/moxidle/default.nix.

Example Configuration

{
  general = {
    # Command executed when org.freedesktop.login1.Session Lock signal is emitted
    # This signal is triggered by commands like 'loginctl lock-sessions'
    lock_cmd = "pidof hyprlock || hyprlock";

    # Command executed when org.freedesktop.login1.Session Unlock signal is emitted  
    # This signal is triggered by commands like 'loginctl unlock-sessions'
    unlock_cmd = "pkill -USR1 hyprlock";

    before_sleep_cmd = "notify-send 'Going to sleep'"; # Command executed before sleep
    after_sleep_cmd = "notify-send 'Awake!'";          # Command executed after waking up
    ignore_dbus_inhibit = false;                       # Ignore DBus idle-inhibit requests
    ignore_systemd_inhibit = false;                    # Ignore systemd idle inhibitors
    ignore_audio_inhibit = false;                      # Ignore audio activity inhibition
  };

  listeners = [
    {
      conditions = [ "on_battery" { battery_below = 20; } ]; # Conditions needed to be fulfilled for timeout to launch
      timeout = 300;                                         # Idle timeout in seconds
      on_timeout = "systemctl suspend";                      # Command executed on timeout
      on_resume = "notify-send 'Welcome back!'";             # Command executed on user activity
    }
    {
      conditions = [ "on_ac" ];
      timeout = 300;
      on_timeout = "pidof hyprlock || hyprlock";
      on_resume = "notify-send 'Welcome back!'";
    }
  ];
}

Dependencies

  • Rust
  • dbus
  • wayland
  • upower (Optional, required if battery-related conditions are set)
  • libpulseaudio (Optional, required if audio features are enabled)

Building

To build with default features:

cargo build --release

Custom Build

To disable libpulseaudio dependency, run:

cargo build --no-default-features

Feature Flags

  • audio Enables audio integration

Installation

cargo install --path .

Usage

To start Moxidle manually:

moxidle

For automatic startup, you can add it to your compositor's config or use systemd:

systemctl --user enable --now moxidle.service

You can temporarily prevent idle actions using systemd-inhibit:

systemd-inhibit \
  --who="me" \
  --what=idle \
  --why="Prevent my system from sleeping" \

Command-line Flags

-c <config_path>, --config <config_path>  Specify a custom config path (default: $XDG_CONFIG_HOME/moxidle.nix)
-q, --quiet                               Suppress output
-v, --verbose                             Enable verbose logging