summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inventory/host_vars/ch-equinox-t450s.yml18
-rw-r--r--inventory/host_vars/ch-equinox-ws.yml18
-rw-r--r--roles/ws/flatpak/defaults/main.yml5
-rw-r--r--roles/ws/flatpak/filter_plugins/flatpak.py28
-rw-r--r--roles/ws/flatpak/tasks/main.yml9
5 files changed, 62 insertions, 16 deletions
diff --git a/inventory/host_vars/ch-equinox-t450s.yml b/inventory/host_vars/ch-equinox-t450s.yml
index 336b0b7f..89d2fb56 100644
--- a/inventory/host_vars/ch-equinox-t450s.yml
+++ b/inventory/host_vars/ch-equinox-t450s.yml
@@ -125,7 +125,6 @@ ws_base_extra_packages:
- flac
- fldigi
- flex
- - freecad
- freerdp2-x11
- fzf
- gcc-avr
@@ -408,11 +407,20 @@ ws_minet_wpa_supplicant_conf: "{{ lookup('unvault', ([global_files_dir, 'chaos-a
ws_flatpak_apps:
- name: org.tenacityaudio.Tenacity
- link: tenacity
+ shortcuts:
+ - name: tenacity
- name: org.audacityteam.Audacity
- link: audacity
+ shortcuts:
+ - name: audacity
- name: org.pipewire.Helvum
- link: helvum
+ shortcuts:
+ - name: helvum
- name: org.localsend.localsend_app
- link: localsend
+ shortcuts:
+ - name: localsend
- name: com.st.STM32CubeIDE
+ - name: org.freecadweb.FreeCAD
+ shortcuts:
+ - name: freecad
+ - name: freecadcmd
+ command: FreeCADCmd
diff --git a/inventory/host_vars/ch-equinox-ws.yml b/inventory/host_vars/ch-equinox-ws.yml
index 18ea12a9..64a21321 100644
--- a/inventory/host_vars/ch-equinox-ws.yml
+++ b/inventory/host_vars/ch-equinox-ws.yml
@@ -135,7 +135,6 @@ ws_base_extra_packages:
- flac
- fldigi
- flex
- - freecad
- freerdp2-x11
- fzf
- gcc-avr
@@ -330,11 +329,20 @@ ws_base_xrandr_setup_script: |
ws_flatpak_apps:
- name: org.tenacityaudio.Tenacity
- link: tenacity
+ shortcuts:
+ - name: tenacity
- name: org.audacityteam.Audacity
- link: audacity
+ shortcuts:
+ - name: audacity
- name: org.pipewire.Helvum
- link: helvum
+ shortcuts:
+ - name: helvum
- name: org.localsend.localsend_app
- link: localsend
+ shortcuts:
+ - name: localsend
- name: com.st.STM32CubeIDE
+ - name: org.freecadweb.FreeCAD
+ shortcuts:
+ - name: freecad
+ - name: freecadcmd
+ command: FreeCADCmd
diff --git a/roles/ws/flatpak/defaults/main.yml b/roles/ws/flatpak/defaults/main.yml
index e66d4118..77f1f39d 100644
--- a/roles/ws/flatpak/defaults/main.yml
+++ b/roles/ws/flatpak/defaults/main.yml
@@ -6,5 +6,8 @@ ws_flatpak_apps: []
# ws_flatpak_apps:
# - name: com.example.foo
# remote: foo
-# link: foo
+# shortcuts:
+# - name: foo
+# - name: foo-blub
+# command: blub
# - name: com.example.bar
diff --git a/roles/ws/flatpak/filter_plugins/flatpak.py b/roles/ws/flatpak/filter_plugins/flatpak.py
new file mode 100644
index 00000000..0ed372ee
--- /dev/null
+++ b/roles/ws/flatpak/filter_plugins/flatpak.py
@@ -0,0 +1,28 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible import errors
+
+
+def flatpak_app_shortcuts(apps):
+ try:
+ shortcuts = []
+ for app in apps:
+ if 'shortcuts' not in app:
+ continue
+ for shortcut in app['shortcuts']:
+ shortcut['app'] = app['name']
+ shortcuts.append(shortcut)
+ return shortcuts
+ except Exception as e:
+ raise errors.AnsibleFilterError("flatpak_app_shortcuts(): %s" % str(e))
+
+
+class FilterModule(object):
+
+ filter_map = {
+ 'flatpak_app_shortcuts': flatpak_app_shortcuts,
+ }
+
+ def filters(self):
+ return self.filter_map
diff --git a/roles/ws/flatpak/tasks/main.yml b/roles/ws/flatpak/tasks/main.yml
index 5229996c..e88be377 100644
--- a/roles/ws/flatpak/tasks/main.yml
+++ b/roles/ws/flatpak/tasks/main.yml
@@ -23,13 +23,12 @@
state: present
- name: install simple run script to /usr/local/bin
- loop: "{{ ws_flatpak_apps | selectattr('link', 'defined') }}"
+ loop: "{{ ws_flatpak_apps | flatpak_app_shortcuts }}"
loop_control:
- label: "{{ item.name }}"
+ label: "{{ item.name }} -> {{ item.app }}"
copy:
content: |
#!/bin/sh
-
- exec flatpak run "{{ item.name }}"
- dest: "/usr/local/bin/{{ item.link }}"
+ exec flatpak run{% if 'command' in item %} "--command={{ item.command }}"{% endif %} "{{ item.app }}"
+ dest: "/usr/local/bin/{{ item.name }}"
mode: 0755