From 1a48017dde54325c5619f45f925478e7c3143ba8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 18 Nov 2018 13:11:53 +0100 Subject: [PATCH] Add gio unwrapper --- roles/init/templates/pam_environment.j2 | 3 +++ roles/tools/files/gio_unwrapper.sh | 18 ++++++++++++++++++ roles/tools/tasks/main.yml | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100755 roles/tools/files/gio_unwrapper.sh diff --git a/roles/init/templates/pam_environment.j2 b/roles/init/templates/pam_environment.j2 index 65b92e7..5bb8895 100644 --- a/roles/init/templates/pam_environment.j2 +++ b/roles/init/templates/pam_environment.j2 @@ -16,6 +16,9 @@ VISUAL DEFAULT="vim" PAGER DEFAULT="less" BROWSER DEFAULT="firefox" +# replace GIO with xdg-open, see tools/files/gio_unwrapper.sh +GIO_LAUNCH_DESKTOP DEFAULT=gio_unwrapper + # Ansible ANSIBLE_CONFIG DEFAULT="${XDG_CONFIG_HOME}/ansible/ansible.cfg" diff --git a/roles/tools/files/gio_unwrapper.sh b/roles/tools/files/gio_unwrapper.sh new file mode 100755 index 0000000..bfddc49 --- /dev/null +++ b/roles/tools/files/gio_unwrapper.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# gio is the replacement for xdg-open in gnome (and gtk) applications, +# including for instance Firefox. It makes two problems: +# First, it searches for terminals in a fixed list (which does not +# include lxterminal) +# Second, it will not use the configuration that was set using pcmanfm. + +# This unwrapper will be called by gio (in place of gio-launch-desktop) +# thanks to the GIO_LAUNCH_DESKTOP variable, will try to find the opened +# file in the arguments, and use xdg-open to open it (beware, xdg-open +# might reuse gio in turn to open the file, for instance in gnome +# environments) + +while [ -n "$1" -a "${1:0:1}" != "/" -a ! -f "$1" ]; do + shift +done +xdg-open "$1" diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index 1aef012..d8ce64f 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -144,3 +144,12 @@ template: src: ssh_config.j2 dest: $HOME/.ssh/config +- name: bin dir + file: + state: directory + path: "$HOME/.local/bin" +- name: add gio unwrapper + copy: + src: gio_unwrapper.sh + dest: $HOME/.local/bin/gio_unwrapper + mode: 0755 -- 2.41.0