cec-dpms

🔘 cec-dpms

Crates.io Crates.io

Description

This small linux tool is intended to emulate DPMS using HDMI-CEC interface. It is using the libcec library via cec-rs. This way it allows to emulate DPMS but for the TV connected to the CEC bus, as the result the TV behaves similar to a regular monitor. The user however has to run own scripts for controlling it.

Usage

cec-dpms 0.1.0
Simple program to power on/off TV by simulating DPMS feature using HDMI CEC

USAGE:
    cec-dpms [OPTIONS]

OPTIONS:
    -d, --debug            Enable debug info
    -h, --help             Print help information
    -i, --input <INPUT>    input device path/name of CEC device
    -V, --version          Print version information

The program is designed to be continuously running in background (Eg. started from systemd service).
It is listening to USR1 and USR2 signals:

Example

An example of using this tool along with Sway:
In the sway config file configure the swayidle like this:

exec swayidle \
    timeout 600 'swaymsg "output * dpms off"' \
       resume 'swaymsg "output * dpms on"' \
    timeout 600 'sudo pkill -USR2 cec-dpms' \
       resume 'sudo pkill -USR1 cec-dpms'

systemd integration

A sample service file for systemd is here:
systemd/cec-dpms.service
You need to adjust it for your needs (eg. check the binary path).
After placing the unit file in correct location and reloading systemd, the unit can be started as usual:
systemctl start cec-dpms.service