Sweets

FreeBSD

Run sweetidle on FreeBSD

Tested on FreeBSD 15.1 amd64 with Sweets.

sudo pkg install rust git
git clone https://github.com/naurissteins/sweetidle.git
cd sweetidle
cargo build --release --locked
mkdir -p ~/.local/bin ~/.config/sweetidle
install -m 755 target/release/sweetidle ~/.local/bin/sweetidle
cp config/freebsd.toml ~/.config/sweetidle/config.toml
~/.local/bin/sweetidle --check-config

With ~/.local/bin on your PATH, start it from your Sweets config:

sweets.exec_once({ "sweetidle" })

It needs the session's XDG_RUNTIME_DIR, WAYLAND_DISPLAY, and DBUS_SESSION_BUS_ADDRESS. Without a session bus, set ignore_dbus_inhibit = true.

Sleep hooks

before_sleep_command and after_resume_command need the rc hook:

sudo install -m 755 target/release/sweetidle /usr/local/bin/sweetidle
sudo install -m 755 freebsd/sweetidle_sleep /usr/local/etc/rc.d/sweetidle_sleep
sudo sysrc sweetidle_sleep_enable=YES
sudo sysrc sweetidle_sleep_runtime_dirs="$XDG_RUNTIME_DIR"

Add the hooks to your config and restart sweetidle.

  • With wait_before_sleep = true, the command must succeed within 4 seconds or suspend is cancelled.
  • For multiple sessions, list up to 16 runtime dirs separated by spaces.
  • If the binary is elsewhere, set sweetidle_sleep_command in rc.conf.

Limits

  • lock_command, unlock_command, and [idle_hint] need logind. They are rejected on FreeBSD. Use a listener to lock on idle.
  • systemd inhibitors are unsupported.

On this page