diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-07-14 17:24:38 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-07-14 17:24:38 +0200 |
| commit | 4f29b6dd05b4826f7a1df57d70537f2dc8d1d8f8 (patch) | |
| tree | 87a992ea9b0b83730d22194b353036a34d09d205 | |
| parent | 0e24c6583a159d1e7626cffec25e30f0656f09b8 (diff) | |
Replace hyprland_nvidia boolean with a fact from the role
This to make the role have less configurations, and less prune to human
errors
| -rw-r--r-- | host_vars/desktop.local.yml | bin | 1064 -> 1042 bytes | |||
| -rw-r--r-- | host_vars/desktop.local.yml.example | 1 | ||||
| -rw-r--r-- | host_vars/macbook.local.yml.example | 1 | ||||
| -rw-r--r-- | roles/hyprland/defaults/main.yml | 1 | ||||
| -rw-r--r-- | roles/hyprland/meta/argument_specs.yml | 4 | ||||
| -rw-r--r-- | roles/hyprland/tasks/main.yml | 7 | ||||
| -rw-r--r-- | roles/hyprland/templates/uwsm/env.j2 | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/host_vars/desktop.local.yml b/host_vars/desktop.local.yml Binary files differindex 170048d2..b722625e 100644 --- a/host_vars/desktop.local.yml +++ b/host_vars/desktop.local.yml diff --git a/host_vars/desktop.local.yml.example b/host_vars/desktop.local.yml.example index c8dd0be1..cbafb889 100644 --- a/host_vars/desktop.local.yml.example +++ b/host_vars/desktop.local.yml.example @@ -41,7 +41,6 @@ fonts_extra: - "ttf-dejavu" - "noto-fonts" -hyprland_nvidia: true hyprland_gdk_scale: 2 hyprland_kanshi_profiles: | profile home { diff --git a/host_vars/macbook.local.yml.example b/host_vars/macbook.local.yml.example index a4f87605..95b4f191 100644 --- a/host_vars/macbook.local.yml.example +++ b/host_vars/macbook.local.yml.example @@ -54,7 +54,6 @@ firefox_extra_extensions: installation_mode: "force_installed" install_url: "https://addons.mozilla.org/firefox/downloads/latest/tabby-window-tab-manager/latest.xpi" -hyprland_nvidia: false # Output criteria must be the full "make model serial" string reported by # `hyprctl monitors` (use "Unknown" for any missing field), not just the # model name — otherwise the profile silently never matches and kanshi diff --git a/roles/hyprland/defaults/main.yml b/roles/hyprland/defaults/main.yml index 3781ee44..6aec17de 100644 --- a/roles/hyprland/defaults/main.yml +++ b/roles/hyprland/defaults/main.yml @@ -1,3 +1,2 @@ --- -hyprland_nvidia: false hyprland_gdk_scale: 1 diff --git a/roles/hyprland/meta/argument_specs.yml b/roles/hyprland/meta/argument_specs.yml index d5da1e36..accae13f 100644 --- a/roles/hyprland/meta/argument_specs.yml +++ b/roles/hyprland/meta/argument_specs.yml @@ -2,10 +2,6 @@ argument_specs: main: options: - hyprland_nvidia: - type: "bool" - default: false - description: "Enable NVIDIA-specific environment variables for Wayland" hyprland_gdk_scale: type: "int" default: 1 diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml index d14b556c..4a64956e 100644 --- a/roles/hyprland/tasks/main.yml +++ b/roles/hyprland/tasks/main.yml @@ -1,4 +1,11 @@ --- +- name: "Detect NVIDIA driver" + ansible.builtin.command: + cmd: "modinfo nvidia" + register: "hyprland_nvidia_detected" + changed_when: false + failed_when: false + - name: "Ensure hyprland packages are installed" become: true ansible.builtin.package: diff --git a/roles/hyprland/templates/uwsm/env.j2 b/roles/hyprland/templates/uwsm/env.j2 index f0a03b64..f33b1565 100644 --- a/roles/hyprland/templates/uwsm/env.j2 +++ b/roles/hyprland/templates/uwsm/env.j2 @@ -17,7 +17,7 @@ export MOZ_ENABLE_WAYLAND=1 export ELECTRON_OZONE_PLATFORM_HINT=wayland export OZONE_PLATFORM=wayland -{% if hyprland_nvidia %} +{% if hyprland_nvidia_detected.rc == 0 %} # NVIDIA Wayland support export LIBVA_DRIVER_NAME=nvidia export GBM_BACKEND=nvidia-drm |
