summaryrefslogtreecommitdiffstats
path: root/roles/hyprland
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-02-23 20:53:22 +0100
committerAhmed Abdelhalim <[email protected]>2026-02-23 20:53:22 +0100
commit504d28be8865b1fd00d87271bd84c546696ba5c5 (patch)
tree7357433e72ed9ecbd44c56e662ae191273072abc /roles/hyprland
parent554c308f52abc1057efa3c77416ba0ef79b7d3c4 (diff)
Refactor hyprland configuration to follow recommendations
Co-Authored-By: Claude.ai
Diffstat (limited to 'roles/hyprland')
-rw-r--r--roles/hyprland/tasks/main.yml26
-rw-r--r--roles/hyprland/templates/envs.conf.j231
-rw-r--r--roles/hyprland/templates/hyprland.conf.j21
-rw-r--r--roles/hyprland/templates/portals.conf.j22
-rw-r--r--roles/hyprland/templates/uwsm-env-hyprland.j26
-rw-r--r--roles/hyprland/templates/uwsm-env.j223
6 files changed, 39 insertions, 50 deletions
diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml
index 6bd6eb82..c8096d13 100644
--- a/roles/hyprland/tasks/main.yml
+++ b/roles/hyprland/tasks/main.yml
@@ -50,6 +50,8 @@
loop:
- "/etc/hypr"
- "/etc/hypr/scripts"
+ - "/etc/xdg/uwsm"
+ - "/etc/xdg/xdg-desktop-portal"
- "{{ ansible_facts['env']['HOME'] }}/.config/hypr"
- name: "Configure system defaults"
@@ -67,8 +69,6 @@
dest: "/etc/hypr/input.conf"
- src: "bindings.conf.j2"
dest: "/etc/hypr/bindings.conf"
- - src: "envs.conf.j2"
- dest: "/etc/hypr/envs.conf"
- src: "looknfeel.conf.j2"
dest: "/etc/hypr/looknfeel.conf"
- src: "rules.conf.j2"
@@ -79,6 +79,12 @@
dest: "/etc/hypr/hypridle.conf"
- src: "hyprland.conf.j2"
dest: "/etc/hypr/hyprland.conf"
+ - src: "uwsm-env.j2"
+ dest: "/etc/xdg/uwsm/env"
+ - src: "uwsm-env-hyprland.j2"
+ dest: "/etc/xdg/uwsm/env-hyprland"
+ - src: "portals.conf.j2"
+ dest: "/etc/xdg/xdg-desktop-portal/portals.conf"
- name: "Configure user defaults"
block:
@@ -104,22 +110,6 @@
# System defaults
source = /etc/hypr/hypridle.conf
-- name: "Configure xdg-desktop-portal for Hyprland"
- block:
- - name: "Create xdg-desktop-portal config directory"
- ansible.builtin.file:
- path: "{{ ansible_facts['env']['HOME'] }}/.config/xdg-desktop-portal"
- state: "directory"
- mode: "0755"
-
- - name: "Configure portal backends"
- ansible.builtin.copy:
- dest: "{{ ansible_facts['env']['HOME'] }}/.config/xdg-desktop-portal/portals.conf"
- mode: "0644"
- content: |
- [preferred]
- default=hyprland;gnome
-
- name: "Copy hyprland scripts"
become: true
ansible.builtin.copy:
diff --git a/roles/hyprland/templates/envs.conf.j2 b/roles/hyprland/templates/envs.conf.j2
deleted file mode 100644
index 8278ba95..00000000
--- a/roles/hyprland/templates/envs.conf.j2
+++ /dev/null
@@ -1,31 +0,0 @@
-# vim: set filetype=hyprlang.ansible :
-
-# Configure Hyprland Environment Variables
-# See https://wiki.hypr.land/Configuring/Environment-variables/
-
-env = XCURSOR_SIZE,24
-env = HYPRCURSOR_SIZE,24
-
-# Force all apps to use Wayland
-env = GDK_BACKEND,wayland,x11,*
-env = QT_QPA_PLATFORM,wayland;xcb
-env = QT_STYLE_OVERRIDE,kvantum
-env = SDL_VIDEODRIVER,wayland
-# env = SDL_VIDEODRIVER,wayland,x11,windows
-env = MOZ_ENABLE_WAYLAND,1
-env = ELECTRON_OZONE_PLATFORM_HINT,wayland
-env = OZONE_PLATFORM,wayland
-env = XDG_SESSION_TYPE,wayland
-
-# Allow better support for screen sharing (Google Meet, Discord, etc)
-env = XDG_CURRENT_DESKTOP,Hyprland
-env = XDG_SESSION_DESKTOP,Hyprland
-env = XDG_SESSION_TYPE,wayland
-
-{% if hyprland_nvidia %}
-# NVIDIA Wayland support
-env = LIBVA_DRIVER_NAME,nvidia
-env = GBM_BACKEND,,nvidia-drm
-env = __GLX_VENDOR_LIBRARY_NAME,nvidia
-env = NVD_BACKEND,direct
-{% endif %}
diff --git a/roles/hyprland/templates/hyprland.conf.j2 b/roles/hyprland/templates/hyprland.conf.j2
index 6f10fe0f..5affafeb 100644
--- a/roles/hyprland/templates/hyprland.conf.j2
+++ b/roles/hyprland/templates/hyprland.conf.j2
@@ -8,6 +8,5 @@ source = /etc/hypr/autostart.conf
source = /etc/hypr/monitors.conf
source = /etc/hypr/input.conf
source = /etc/hypr/bindings.conf
-source = /etc/hypr/envs.conf
source = /etc/hypr/looknfeel.conf
source = /etc/hypr/rules.conf
diff --git a/roles/hyprland/templates/portals.conf.j2 b/roles/hyprland/templates/portals.conf.j2
new file mode 100644
index 00000000..21946d90
--- /dev/null
+++ b/roles/hyprland/templates/portals.conf.j2
@@ -0,0 +1,2 @@
+[preferred]
+default=hyprland;gnome
diff --git a/roles/hyprland/templates/uwsm-env-hyprland.j2 b/roles/hyprland/templates/uwsm-env-hyprland.j2
new file mode 100644
index 00000000..ac2febbb
--- /dev/null
+++ b/roles/hyprland/templates/uwsm-env-hyprland.j2
@@ -0,0 +1,6 @@
+# vim: set filetype=sh :
+
+# UWSM environment variables specific to Hyprland (HYPR* and AQ_*)
+# See https://wiki.hypr.land/Configuring/Environment-variables/
+
+export HYPRCURSOR_SIZE=24
diff --git a/roles/hyprland/templates/uwsm-env.j2 b/roles/hyprland/templates/uwsm-env.j2
new file mode 100644
index 00000000..41a9d5a5
--- /dev/null
+++ b/roles/hyprland/templates/uwsm-env.j2
@@ -0,0 +1,23 @@
+# vim: set filetype=sh :
+
+# UWSM environment variables for Hyprland
+# See https://wiki.hypr.land/Configuring/Environment-variables/
+
+export XCURSOR_SIZE=24
+
+# Force all apps to use Wayland
+export GDK_BACKEND="wayland,x11,*"
+export QT_QPA_PLATFORM="wayland;xcb"
+export QT_STYLE_OVERRIDE=kvantum
+export SDL_VIDEODRIVER=wayland
+export MOZ_ENABLE_WAYLAND=1
+export ELECTRON_OZONE_PLATFORM_HINT=wayland
+export OZONE_PLATFORM=wayland
+
+{% if hyprland_nvidia %}
+# NVIDIA Wayland support
+export LIBVA_DRIVER_NAME=nvidia
+export GBM_BACKEND=nvidia-drm
+export __GLX_VENDOR_LIBRARY_NAME=nvidia
+export NVD_BACKEND=direct
+{% endif %}