Skip to content

Commit

Permalink
feat: Remove the client/server architecture
Browse files Browse the repository at this point in the history
This is now longer needed thanks to the new DDC implementation that
doesn't require the available interfaces enumeration via udev.
/sys/class/drm/card*-{display_name}/i2c-* is the interface associated to
a particular display, re-use the same code as ddc_hi to initialize a ddc
display. The code now runs under 100ms for each display.
  • Loading branch information
danyspin97 committed Nov 29, 2024
1 parent f3c0e45 commit 93503f2
Show file tree
Hide file tree
Showing 16 changed files with 409 additions and 2,204 deletions.
37 changes: 10 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
[workspace]
[package]
name = "lumactld"
version = "0.1.0"
edition = "2021"

members = [
"cli",
"ipc",
"daemon",
]

resolver = "2"
[dependencies]
clap = { version = "4.5.21", features = ["derive"] }
ddc-hi = { version = "0.4.1" }
eyre = "0.6.12"
log = "0.4.22"
smithay-client-toolkit = "0.19.2"
wayland-client = "0.31.7"
xdg = "2.5.2"
serde_json = "1.0.133"
ctrlc = "3.4.5"
flexi_logger = "0.29.6"
nix = "0.29.0"
i2c-linux = { version = "0.1.2", features = ["i2c"] }
ddc-i2c = { version = "0.2.2", features = ["with-linux"] }
ddc = "0.2.2"
serde = { version = "1.0.215", features = ["derive"] }
24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Lumactl

A daemon to control the brightness on Linux. It supports both backlight brightness as well as
**lumactl** is a tool to control the brightness on Linux. It supports both backlight brightness and
external displays controlled with DDC protocol. The scope is unifying both interfaces under
one tool, making it possible to use as bridge for other tools like keybindings and bars.
one tool, making it possible to use as interface for other tools like window managers and bars.

## Features

- Supports backlight brightness
- Supports for external monitors via DDC
- Easy to use command line interface
- Supports for relative increase/decreases
- Designed to be fast (hence the client/daemon interface)
- Designed to be fast

## Getting started

Expand All @@ -20,13 +20,7 @@ To build **lumactl** local, run:
$ cargo build --release
```

Then execute the daemon in the background via:

```bash
$ lumactld --daemon
```

You can control the brightness by calling **lumactl** directly:
You can control the brightness by calling **lumactl**:

```bash
# Get the brightness in percentage for all displays
Expand All @@ -37,16 +31,6 @@ $ lumactl set 100
$ lumactl set --display DP-4 -20%
```

## Why is lumactld a daemon
The first iteration of this small tool was indeed a simple command line probing all available
DDC interfaces via `ddc_hi` crate. However, probing all of them takes 2 seconds or more on my
workstation, which means that **lumactl** took from 2 to 3 seconds every time it runs.
This is definitely not acceptable for integration into any other tool, which should expect a
result in a reasonable time. The daemon will enumerate and probe all DDC interfaces only at
startup and when a display gets connected or disconnected, making **lumactl** just send the
command as quickly as possible. It also leaves open the opportunity to further optimizations
in the future like caching the current brightness or using inotify for backlight brightness.

## License

**lumactl** is licensed under the GPL-3.0+ license.
9 changes: 0 additions & 9 deletions cli/Cargo.toml

This file was deleted.

113 changes: 0 additions & 113 deletions cli/src/main.rs

This file was deleted.

Loading

0 comments on commit 93503f2

Please sign in to comment.