From ab13d2cb99a828e616a1b681ea77f869199978ee Mon Sep 17 00:00:00 2001 From: TimL20 Date: Fri, 28 May 2021 11:27:12 +0200 Subject: [PATCH] Attempt to fix issue #21 In gnome_shell role Add tasks to find out keymap Set keymap if var is not empty --- roles/gnome_shell/tasks/main.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/roles/gnome_shell/tasks/main.yml b/roles/gnome_shell/tasks/main.yml index e8d3bc9..bb426e5 100644 --- a/roles/gnome_shell/tasks/main.yml +++ b/roles/gnome_shell/tasks/main.yml @@ -18,11 +18,30 @@ tags: - gnome_shell +- name: Try to find out host keymap + command: localectl status + delegate_to: localhost + failed_when: false + changed_when: false + when: keymap|default('', true)|length == 0 + register: localectl_status + tags: + - gnome_shell + - keymap + +- name: Store found host keymap + set_fact: + keymap: "{{ localectl_status.stdout | regex_search('Keymap:\\s*(.*)$', '\\1', multiline=True) | first }}" + when: (keymap | default('', true) | length == 0) and (localectl_status.rc == 0) + tags: + - gnome_shell + - keymap + - name: Set gnome keyboard layout dconf: key: "/org/gnome/desktop/input-sources/sources" value: "[('xkb', '{{ keymap }}')]" - when: keymap|default('', true)|length == 0 + when: keymap|default('', true)|length != 0 tags: - gnome_shell - keymap