diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-02-09 19:00:45 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-02-09 19:03:37 +0100 |
| commit | 89773438b6583dd1dcaf33ad6d581eee697246f2 (patch) | |
| tree | 7cfdc647507af97bcb29f6907c87eaadba476882 /roles/ddcutil | |
| parent | dc8f42e5666e9d498bd19b323f5e1c3b9440ba3f (diff) | |
Add brightness control using ddcutil to hyprland
The ddcutil is really slow by design and needing to wait the recommended
40-200ms after each request to get the response according to the ddc
protocol specifications.
For now this is a working draft, might switch to ddccontrol which is
much faster but limited to communicate over /dev/<id> which can't be
figured automatically or correlated with hyprctl monitors command
Diffstat (limited to 'roles/ddcutil')
| -rw-r--r-- | roles/ddcutil/handlers/main.yml | 12 | ||||
| -rw-r--r-- | roles/ddcutil/meta/argument_specs.yml | 6 | ||||
| -rw-r--r-- | roles/ddcutil/meta/main.yml | 17 | ||||
| -rw-r--r-- | roles/ddcutil/tasks/main.yml | 38 |
4 files changed, 73 insertions, 0 deletions
diff --git a/roles/ddcutil/handlers/main.yml b/roles/ddcutil/handlers/main.yml new file mode 100644 index 00000000..85720137 --- /dev/null +++ b/roles/ddcutil/handlers/main.yml @@ -0,0 +1,12 @@ +--- +- name: "Reload rules" + become: true + ansible.builtin.command: + cmd: "udevadm control --reload-rules" + changed_when: true + +- name: "Trigger rules" + become: true + ansible.builtin.command: + cmd: "udevadm trigger" + changed_when: true diff --git a/roles/ddcutil/meta/argument_specs.yml b/roles/ddcutil/meta/argument_specs.yml new file mode 100644 index 00000000..09847b93 --- /dev/null +++ b/roles/ddcutil/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + main: + short_description: "Install ddcutil on Linux distribution" + description: "Install ddcutil on Linux distribution" + options: {} diff --git a/roles/ddcutil/meta/main.yml b/roles/ddcutil/meta/main.yml new file mode 100644 index 00000000..025d3e11 --- /dev/null +++ b/roles/ddcutil/meta/main.yml @@ -0,0 +1,17 @@ +--- +dependencies: [] +galaxy_info: + author: "a14m" + description: "Install ddcutil" + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" + - name: "Ubuntu" + versions: + - "noble" + - name: "Debian" + versions: + - "bookworm" diff --git a/roles/ddcutil/tasks/main.yml b/roles/ddcutil/tasks/main.yml new file mode 100644 index 00000000..feef8683 --- /dev/null +++ b/roles/ddcutil/tasks/main.yml @@ -0,0 +1,38 @@ +--- +- name: "Ensure ddcutil is installed" + become: true + ansible.builtin.package: + name: "ddcutil" + state: "present" + +- name: "Ensure kernel module is loaded on boot" + become: true + ansible.builtin.copy: + dest: "/etc/modules-load.d/i2c.conf" + mode: "0644" + content: | + i2c-dev + +- name: "Ensure i2c group is created" + become: true + ansible.builtin.group: + name: "i2c" + state: "present" + +- name: "Ensure $USER is added to i2c group" + become: true + ansible.builtin.user: + name: "{{ ansible_facts['env']['USER'] }}" + groups: "i2c" + append: true + +- name: "Create udev rule for i2c device permissions" + become: true + ansible.builtin.copy: + dest: "/etc/udev/rules.d/99-i2c.rules" + mode: "0644" + content: | + KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" + notify: + - "Reload rules" + - "Trigger rules" |
