Skip to content

Idle daemon with conditional timeouts and built in audio inhibitor

License

Notifications You must be signed in to change notification settings

unixpariah/moxidle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 timeouts
  • Extends beyond default org.freedesktop.SessionManager protocol by implementing additional features available in kscreenlocker

Configuration

Moxidle's configuration is written in Lua and is located at $XDG_CONFIG_HOME/moxidle/config.lua or ~/.config/moxidle/config.lua. The format is heavily inspired by hypridle

Example Configuration

return {
  general = {
    lock_cmd = "pidof hyprlock || hyprlock", -- Command to lock the session
    unlock_cmd = "notify-send 'Unlocking'", -- Command to run on unlock
    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
  },
  timeouts = {
    {
      conditions = { "on_battery", { battery_below = 20 } }, -- Conditions needed to be fullfilled 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!'",
    },
  },
}

You can define multiple timeout rules. If on_timeout or on_resume is omitted, those events will be ignored.

Run man 5 moxidle for more information

Dependencies

  • Lua 5.4
  • 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

Command-line Flags

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

About

Idle daemon with conditional timeouts and built in audio inhibitor

Resources

License

Stars

Watchers

Forks

Packages

No packages published