From 2090fd6dbf8467fedc35bb381fdcc2827d911ac5 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 24 Feb 2021 17:12:09 +0000 Subject: [PATCH] Add gnome setup script --- roles/home-gui/files/gnome-setup.sh | 36 +++++++++++++++++++++++++++++ roles/home-gui/tasks/gnome.yml | 20 ++++++++++++++++ roles/home-gui/tasks/main.yml | 1 + 3 files changed, 57 insertions(+) create mode 100644 roles/home-gui/files/gnome-setup.sh create mode 100644 roles/home-gui/tasks/gnome.yml diff --git a/roles/home-gui/files/gnome-setup.sh b/roles/home-gui/files/gnome-setup.sh new file mode 100644 index 0000000..9b7bbcd --- /dev/null +++ b/roles/home-gui/files/gnome-setup.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +test -x /usr/bin/gsettings || (echo "gsettings not found" && exit 1) + +set_favorites_bar () { + local firefox + if [ -r /usr/share/applications/firefox-esr.desktop ] && [ ! -r /usr/share/applications/firefox.desktop ] + then + firefox=firefox-esr + else + firefox=firefox + fi + gsettings set org.gnome.shell favorite-apps "['org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', '$firefox.desktop']" +} +set_favorites_bar + +set_keyboard_and_language () { + local us="('xkb', 'us')" + local ca="('xkb', 'ca+multix')" + local layouts + if [ "$(echo $LANG | sed 's/_.*//')" = "fr" ] + then + layouts="[$ca, $us]" + else + layouts="[$us, $ca]" + fi + gsettings set org.gnome.desktop.input-sources sources "$layouts" +} +set_keyboard_and_language + +set_nautilus_preferences () { + gsettings set org.gnome.nautilus.list-view default-zoom-level 'small' + gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view' + gsettings set org.gtk.Settings.FileChooser sort-directories-first 'true' +} +set_nautilus_preferences diff --git a/roles/home-gui/tasks/gnome.yml b/roles/home-gui/tasks/gnome.yml new file mode 100644 index 0000000..792cae6 --- /dev/null +++ b/roles/home-gui/tasks/gnome.yml @@ -0,0 +1,20 @@ +--- +# Copyright 2021 Anthony Perkins +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Copy MATE Clock reset script + ansible.builtin.copy: + src: gnome-setup.sh + dest: "{{ ansible_env.HOME }}/bin/reset-gnome-setup" + mode: '0755' diff --git a/roles/home-gui/tasks/main.yml b/roles/home-gui/tasks/main.yml index 8683a80..d7369ca 100644 --- a/roles/home-gui/tasks/main.yml +++ b/roles/home-gui/tasks/main.yml @@ -17,5 +17,6 @@ - include: dotfiles.yml - include: firefox.yml +- include: gnome.yml - include: mate.yml - include: sublimetext.yml