#!/bin/sh
#
# Copyright 2009 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
chrome_config_desktop() {
  for FILENAME in /home/*; do
    if [ -f "${FILENAME}/.config/user-dirs.dirs" ]; then
      desktop=$(cat ${FILENAME}/.config/user-dirs.dirs | grep DESKTOP | tail -l | cut -d '=' -f 2 | sed 's/\"//g')
      output=$(echo ${desktop} | cut -d '/' -f 2)
      echo ${output}
      if [ -d "${HOME}/${output}" ]; then
        if [ -f /usr/share/applications/chromium.desktop ]; then
          cp -f /usr/share/applications/chromium.desktop ${HOME}/${output}
          /usr/bin/gio set ${HOME}/${output}/chromium.desktop metadata::trusted true
          # lxqt
          /usr/bin/gio set ${HOME}/${output}/chromium.desktop metadata::trust true
          chmod +x ${HOME}/${output}/chromium.desktop
        fi
      fi 
    fi
  done
}

chrome_config_desktop
