2 releases
Uses new Rust 2024
new 0.2.1 | May 7, 2025 |
---|---|
0.2.0 | May 7, 2025 |
#1075 in Command line utilities
27KB
547 lines
partymode
Prevents your system from idling/suspending while media is being played.
Dependencies
dbus
systemd
Installation
crates.io
cargo install partymode
Usage
partymode [OPTIONS] <COMMAND>
Commands:
daemon Run the partymode daemon
on Enable party mode
off Disable party mode
toggle Toggle party mode
status Show the current status
help Print this message or the help of the given subcommand(s)
Options:
-c, --config <PATH> Provide a custom location for the config file
-v, --verbose Enable verbose logging
-h, --help Print help
-V, --version Print version
Systemd unit
To manage the partymode daemon with systemd, you can create this user service:
[Unit]
After=dbus-broker.service
Description="partymode - Keep your system awake while playing media"
Documentation="https://github.com/peppidesu/partymode"
[Service]
Type=simple
ExecStart=/path/to/partymode daemon # change this
Restart=on-failure
[Install]
WantedBy=default.target
Configuration
partymode
will create the following config at ~/.config/partymode/config.toml
(or the directory specified with -c
) if it doesn't exist:
default-enabled = true
poll-interval = 5000
["*"]
always = false
mode = "block"
targets = ["idle"]
default-enabled
Whether to enable partymode on startup or not.
poll-interval
How often to check for player changes, in ms.
Rules
Rules allow you to specify inhibit behavior on a per-application basis. A rule looks like this:
[name]
always = false
mode = "<mode>"
targets = []
always
When true, inhibit regardless of whether partymode is enabled or not.
mode
Inhibit mode as specified by systemd-inhibit(1).
targets
What to inhibit. Can be one of "idle"
, "suspend"
or "shutdown"
.
Rule names
partymode
will use the last part of the MPRIS bus name (org.mpris.MediaPlayer2.<name>
) to match against config rules. You can get a list of these with playerctl
:
playerctl -l
Default rule
If parts of a rule are omitted or no matching rule is found, partymode
resorts to using the default rule (["*"]
).
Contribute
Feel free to report issues and PR :)
Dependencies
~12–23MB
~367K SLoC