summaryrefslogtreecommitdiffstats
path: root/roles/ddcutil/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-02-09 19:00:45 +0100
committerAhmed Abdelhalim <[email protected]>2026-02-09 19:03:37 +0100
commit89773438b6583dd1dcaf33ad6d581eee697246f2 (patch)
tree7cfdc647507af97bcb29f6907c87eaadba476882 /roles/ddcutil/tasks
parentdc8f42e5666e9d498bd19b323f5e1c3b9440ba3f (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/tasks')
-rw-r--r--roles/ddcutil/tasks/main.yml38
1 files changed, 38 insertions, 0 deletions
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"