#!/usr/bin/env bash #shellcheck disable=SC2155,SC2034,SC1135 #shellcheck source=/dev/null # usr/share/bigbashview/bcc/apps/biglinux-config/index.sh.htm # Description: Restore Settings to help usage of BigLinux # # Created: 2020/09/01 # Altered: 2023/08/12 # # Copyright (c) 2023-2023, Vilmar Catafesta # 2020-2023, Bruno Gonçalves # 2020-2023, Rafael Ruscher # 2020-2023, eltonff # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APP="${0##*/}" _VERSION_="1.0.0-20230812" LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'} export BOOTLOG="/tmp/bigcontrolcenter-$USER-$(date +"%d%m%Y").log" export LOGGER='/dev/tty8' [[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh" [[ -f "${LIBRARY}/bcfglib.sh" ]] && source "${LIBRARY}/bcfglib.sh" function sh_config { #Translation export TEXTDOMAINDIR="/usr/share/locale" export TEXTDOMAIN=biglinux-config declare -gA aMenu=([TITLE]=$(gettext $"Restaurar Configurações") [Principais]=$(gettext $"Principais") [Internet]=$(gettext $"Internet") [Multimidia]=$(gettext $"Multimídia") [Graficos]=$(gettext $"Gráficos") [Escritorio]=$(gettext $"Escritório") [Sistema]=$(gettext $"Sistema") [Musicas]=$(gettext $"Músicas") [Restaurar_padrao_programa]=$(gettext $"Restaurar o aplicativo no modo padrão do programa") [Restaurar_padrao_distro]=$(gettext $"Restaurar o aplicativo no modo padrão da distribuição") [Restaurar_padrao_biglinux]=$(gettext $"Restaurar o aplicativo no modo padrão da distribuição BigLinux") [Sim]=$(gettext $"Sim") [Nao]=$(gettext $"Não") [OK]=$(gettext $"OK") [Cancelar]=$(gettext $"Cancelar") [Restaurar_modo]=$(gettext $"Em qual modo você deseja restaurar?") [Pesquisar]=$(gettext $"Pesquisar aplicativo") [Confirma]=$(gettext $"Você tem certeza que deseja restaurar todas as configurações?") ) declare -gA Afinish=([sucesso]=$(gettext $"As configurações foram restauradas com sucesso!") [sucesso_KDE]=$(gettext $"As configurações do BigLinux KDE foram restauradas com sucesso!") [sucesso_XFCE]=$(gettext $"As configurações do BigLinux XFCE foram restauradas com sucesso!") [reiniciar_sessao]=$(gettext $"É necessário reiniciar a sessão para concluir a restauração!") [sair_sessao]=$(gettext $"Sair da sessão") [app_em_execucao]=$(gettext $"Atenção! O programa está em execução!") [app_on_close]=$(gettext $"Será fechado para que a restauração seja concluída.") [erase_all]=$(gettext $"Isso apagará todas as costumizações feitas por ") ) # O array associa o nome do aplicativo a uma série de informações/campos separadas por | (barra vertical). # [brave]="Star|/usr/lib/brave-browser/brave|icons/brave.png|modal_1|Brave|sh_reset_brave" # Vou desmembrar as informações/campos: # [brave]: Chave do array associativo, indicando o nome do aplicativo. # Valor associado à chave "brave": # "Star|/usr/lib/brave-browser/brave|icons/brave.png|modal_1|Brave|sh_reset_brave" # Este valor contém várias informações separadas por |. # campo1 - classe : Classe do aplicativo. # campo2 - /usr/lib/brave-browser/brave : Caminho para o executável do aplicativo Brave. # campo3 - icons/brave.png : Caminho para o ícone do aplicativo. # campo4 - modal_1 : informação relacionada a um modal. # campo5 - Brave : Nome do aplicativo. # campo6 - sh_reset_brave : Nome de um arquivo ou script sh associado. # campo7 - Texto (opcional) : Subtitulo (se houver). declare -gA AFullNameApp=( [firefox1]="Star|/usr/lib/firefox/firefox|icons/firefox.png|modal_11|Firefox|sh_reset_firefox" [dolphin1]="Star|/usr/bin/dolphin|icons/dolphin.png|modal_3|Dolphin|sh_reset_dolphin" [brave1]="Star|/usr/lib/brave-browser/brave|icons/brave.png|modal_1|Brave|sh_reset_brave" [kate1]="Star|/usr/bin/kate|icons/kate.png|modal_4|Kate|sh_reset_kate" [brave2]="Internet|/usr/lib/brave-browser/brave|icons/brave.png|modal_1|Brave|sh_reset_brave" [firefox2]="Internet|/usr/lib/firefox/firefox|icons/firefox.png|modal_2|Firefox|sh_reset_firefox" [chromium]="Internet|/usr/lib/chromium/chromium|icons/chromium.png|modal_7|Chromium|sh_reset_chromium" [qbittorrent]="Internet|/usr/bin/qbittorrent|icons/qbittorrent.png|modal_19|qBittorrent|sh_reset_qbittorrent" [chrome]="Internet|/opt/google/chrome/google-chrome|icons/chrome.png|modal_13|Google Chrome|sh_reset_chrome" [dolphin2]="System|/usr/bin/dolphin|icons/dolphin.png|modal_10|Dolphin|sh_reset_dolphin" [kate2]="Office|/usr/bin/kate|icons/kate.png|modal_4|Kate|sh_reset_kate" [lowriter]="Office|/usr/bin/lowriter|icons/libreoffice.png|modal_17|LibreOffice|sh_reset_libreoffice" [okular]="Office|/usr/bin/true|icons/okular.png|modal_18|Okular|sh_reset_okular" [smplayer]="Multimedia|/usr/bin/smplayer|icons/smplayer.png|modal_20|$(gettext $"Vídeos")|sh_reset_smplayer|(Smplayer)" [mystiq]="Multimedia|/usr/bin/mystiq|icons/mystiq.png|modal_22|$(gettext $"Conversor de áudio e vídeo")|sh_reset_mystiq|(MystiQ)" [vokoscreenNG]="Multimedia|/usr/bin/vokoscreenNG|icons/vokoscreen.png|modal_9|$(gettext $"Gravador de Tela")|sh_reset_vokoscreenNG|(vokoscreenNG)" [clementine]="Multimedia|/usr/bin/clementine|icons/clementine.png|modal_8|$(gettext $"Músicas")|sh_reset_clementine|(clementine)" [vlc]="Multimedia|/usr/bin/vlc|icons/vlc.png|modal_23|vlc|sh_reset_vlc" [inkscape]="Graphic|/usr/bin/inkscape|icons/inkscape.png|modal_21|Inkscape|sh_reset_inkscape" [ksnip]="Graphic|/usr/bin/ksnip|icons/ksnip.png|modal_16|Ksnip|sh_reset_ksnip" [gimp]="Graphic|/usr/bin/gimp|icons/gimp.png|modal_12|Gimp|sh_reset_gimp" [gwenview]="Graphic|/usr/bin/gwenview|icons/gwenview.png|modal_14|Gwenview|sh_reset_gwenview" ) } function sh_bcfg_start_html { cat <<-EOF ${aMenu[TITLE]} $(sh_getbgcolor)
$(sh_div_lang)
EOF } function sh_bcfg_process_kde { local classe="$1" cat <<-EOF
${aMenu[Restaurar_padrao_biglinux]}
$(sh_finish_kde) EOF } function sh_bcfg_process_xfce { local classe="$1" cat <<-EOF
${aMenu[Restaurar_padrao_biglinux]}
$(sh_finish_xfce) EOF } function sh_bcfg_process_apps { local classe local file_path local file_icon local modal local xtitle local cmd local subxtitle local app for app in "${!AFullNameApp[@]}"; do IFS='|' read -r classe file_path file_icon modal xtitle cmd subxtitle <<< "${AFullNameApp[$app]}" if [ -e "$file_path" ]; then cat <<-EOF
${aMenu[Restaurar_padrao_biglinux]}
EOF fi done } function sh_finish_kde { cat <<-EOF EOF } function sh_finish_xfce { cat <<-EOF EOF } function sh_bcfg_finish_html { cat <<-EOF
EOF } function sh_main { local current_desktop="$(sh_get_de)" local process_function="sh_bcfg_process_kde" sh_bcfg_start_html case "${current_desktop^^}" in XFCE|XFCE4) process_function="sh_bcfg_process_xfce";; PLASMA) ;; *) ;; esac $process_function "Star" $process_function "System" sh_bcfg_process_apps sh_bcfg_finish_html } #sh_debug sh_config sh_main