summaryrefslogtreecommitdiffstats
path: root/roles/hyprshare
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-03-06 03:09:35 +0100
committerAhmed Abdelhalim <[email protected]>2026-03-06 03:29:52 +0100
commit0be05816e70bc0cc3ab6bf812fbf5515eddd6b8e (patch)
tree9c90647cc0801a8742d7d6ea544dc6b9a3e6dc22 /roles/hyprshare
parenta38bb05301efe2fb179a8dd622e16e8fd70250cb (diff)
Refactor hyprshare and abstract role dependencies
Diffstat (limited to 'roles/hyprshare')
-rw-r--r--roles/hyprshare/defaults/main.yml2
-rw-r--r--roles/hyprshare/handlers/main.yml6
-rw-r--r--roles/hyprshare/meta/main.yml3
-rw-r--r--roles/hyprshare/tasks/main.yml8
-rw-r--r--roles/hyprshare/templates/xdph.conf.j27
5 files changed, 25 insertions, 1 deletions
diff --git a/roles/hyprshare/defaults/main.yml b/roles/hyprshare/defaults/main.yml
new file mode 100644
index 00000000..69603a29
--- /dev/null
+++ b/roles/hyprshare/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+hyprshare_install_preview: false
diff --git a/roles/hyprshare/handlers/main.yml b/roles/hyprshare/handlers/main.yml
new file mode 100644
index 00000000..d77a519b
--- /dev/null
+++ b/roles/hyprshare/handlers/main.yml
@@ -0,0 +1,6 @@
+---
+- name: "Restart xdg-desktop-portal-hyprland"
+ ansible.builtin.systemd_service:
+ name: "xdg-desktop-portal-hyprland"
+ state: "restarted"
+ scope: "user"
diff --git a/roles/hyprshare/meta/main.yml b/roles/hyprshare/meta/main.yml
index 2a1224b7..ac6ff156 100644
--- a/roles/hyprshare/meta/main.yml
+++ b/roles/hyprshare/meta/main.yml
@@ -1,5 +1,6 @@
---
-dependencies: []
+dependencies:
+ - role: "xdg-desktop-portal"
galaxy_info:
author: "a14m"
description: "Install Hyprland screensharing dependencies"
diff --git a/roles/hyprshare/tasks/main.yml b/roles/hyprshare/tasks/main.yml
index 8fd53138..68d318ae 100644
--- a/roles/hyprshare/tasks/main.yml
+++ b/roles/hyprshare/tasks/main.yml
@@ -14,6 +14,7 @@
name: "hyprland-preview-share-picker"
state: "present"
use: "yay"
+ when: hyprshare_install_preview
# This is a workaround the installation failing
# because the log file is created with aur_builder as an owner
@@ -22,4 +23,11 @@
ansible.builtin.file:
path: "/tmp/hyprland-preview-share-picker.log"
state: "absent"
+ when: hyprshare_install_preview
+- name: "Template user share picker configuration"
+ ansible.builtin.template:
+ src: "xdph.conf.j2"
+ dest: "{{ ansible_facts['env']['HOME'] }}/.config/hypr/xdph.conf"
+ mode: "0644"
+ notify: "Restart xdg-desktop-portal-hyprland"
diff --git a/roles/hyprshare/templates/xdph.conf.j2 b/roles/hyprshare/templates/xdph.conf.j2
new file mode 100644
index 00000000..317d27f7
--- /dev/null
+++ b/roles/hyprshare/templates/xdph.conf.j2
@@ -0,0 +1,7 @@
+screencopy {
+ max_fps = 60
+ allow_token_by_default = true
+{% if hyprshare_install_preview %}
+ custom_picker_binary = hyprland-preview-share-picker
+{% endif %}
+}