Skip to content

Commit

Permalink
Merge pull request #67 from vcatafesta/main
Browse files Browse the repository at this point in the history
Refatorado
  • Loading branch information
bigbruno authored Aug 6, 2023
2 parents 85d897b + 65f4fb7 commit 7f64c37
Show file tree
Hide file tree
Showing 21 changed files with 2,515 additions and 1,660 deletions.
59 changes: 53 additions & 6 deletions bigcontrolcenter/usr/bin/big-welcome
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
#!/bin/bash
#!/usr/bin/env bash
#shellcheck disable=SC2155,SC2034
#shellcheck source=/dev/null

#Translation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=bigcontrolcenter
# usr/bin/big-welcome
# Description: Control Center to help usage of BigLinux
#
# Created: 2022/02/28
# Altered: 2023/08/05
#
# Copyright (c) 2023-2023, Vilmar Catafesta <vcatafesta@gmail.com>
# 2022-2023, Bruno Gonçalves <www.biglinux.com.br>
# 2022-2023, Rafael Ruscher <rruscher@gmail.com>
# 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.

cd /usr/share/bigbashview/bcc/apps/big-welcome/
APP="${0##*/}"
_VERSION_="1.0.0-20230805"
BOOTLOG="/tmp/bigcontrolcenter-$(date +"%d%m%Y").log"
LOGGER='/dev/tty8'
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"

bigbashview -s 1000x660 main.sh.htm -n $"Introdução ao BigLinux" -i big-logo.png
function sh_config {
#Translation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=bigcontrolcenter
}

function sh_main {
cmdlogger cd /usr/share/bigbashview/bcc/apps/big-welcome/ || return 1
bigbashview -s 1000x660 main.sh.htm -n $"Introdução ao BigLinux" -i big-logo.png
}

#sh_debug
sh_config
sh_main
80 changes: 53 additions & 27 deletions bigcontrolcenter/usr/bin/bigcontrolcenter
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#shellcheck disable=SC2155
#shellcheck source=/dev/null

# bigcontrolcenter
# /usr/bin/bigcontrolcenter
# Created: 0000/00/00
# Altered: 2023/07/22
# Altered: 2023/08/05
#
# Copyright (c) 2023-2023, Vilmar Catafesta <vcatafesta@gmail.com>
# 0000-2023, bigbruno Bruno Gonçalves <bruno@biglinux.com.br>
Expand All @@ -30,23 +30,24 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

readonly APP="${0##*/}"
readonly _VERSION_="1.0.0-20230722"
readonly LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
APP="${0##*/}"
_VERSION_="1.0.0-20230805"
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
BOOTLOG="/tmp/bigcontrolcenter-$(date +"%d%m%Y").log"
LOGGER='/dev/tty8'
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"

function sh_config {
#sets
set +o noclobber

#Translation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=bigcontrolcenter
declare -gi RELOAD=0
declare -gi PARTIAL=0
declare -g bbvpath='/usr/share/bigbashview/bcc/apps/bigcontrolcenter'
declare -g userpath="$HOME/.config/bigcontrolcenter"
declare -g custom_user_path="$HOME/.config/bcc/files"
declare -g appspath='/usr/share/applications'
declare -g TITLE=$"Central de Controle"
declare -g TITLE=$(gettext "Central de Controle")
}

function sh_checkdir {
Expand All @@ -60,7 +61,7 @@ function sh_clean_reload {
}

# Verify number of kcmshell5 changed
function verify_kcm_number {
function sh_verify_kcm_number {
local nfiles_kcm_user
local nfiles_kcm_apps

Expand All @@ -70,37 +71,40 @@ function verify_kcm_number {
if (( nfiles_kcm_apps != nfiles_kcm_user )); then
echo "$nfiles_kcm_apps" > "$userpath/kcmshell_number"
RELOAD=1
PARTIAL=0
fi
}

# Verify number of files in bigcontrolcenter applications
function verify_number_files_bcc_apps {
function sh_verify_number_files_bcc_apps {
local nfiles_bcc_user
local nfiles_bcc_apps

nfiles_bcc_user=0
nfiles_bcc_apps=$(wc -l < <(find "$appspath/bigcontrolcenter" -type f))
[[ -e "$userpath/bccapps_number" ]] && nfiles_bcc_user=$(printf "%s" "$(<"$userpath/bccapps_number")")
[[ -e "$userpath/bccapps_number" ]] && nfiles_bcc_user="$(<"$userpath/bccapps_number")"
if (( nfiles_bcc_apps != nfiles_bcc_user )); then
echo "$nfiles_bcc_apps" > "$userpath/bccapps_number"
RELOAD=1
PARTIAL=0
fi
}

# Verify language changed
function verify_user_language {
function sh_verify_user_language {
local user_lang

user_lang=''
[[ -e "$userpath/lang" ]] && user_lang=$(printf "%s" "$(<"$userpath/lang")")
[[ -e "$userpath/lang" ]] && user_lang="$(<"$userpath/lang")"
if [[ "$LANG" != "$user_lang" ]]; then
echo "$LANG" > "$userpath/lang"
RELOAD=1
PARTIAL=0
fi
}

# Verify bigcontrolcenter version
function verify_bcc_version {
function sh_verify_bcc_version {
local user_version
local bcc_version

Expand All @@ -110,26 +114,47 @@ function verify_bcc_version {
if [[ "$bcc_version" != "$user_version" ]]; then
echo "$bcc_version" > "$userpath/version"
RELOAD=1
PARTIAL=0
fi
}

# Desativar Cache
function verify_cache {
# Verify number of custom user files
function sh_verify_custom_user_files {
local ncustom_user_files
local ncustom_user_apps

ncustom_user_files=0
ncustom_user_apps=$(wc -l < <(find "$custom_user_path" -type f,l -name '*'))
[[ -e "$userpath/custom_number" ]] && ncustom_user_files=$(printf "%s" "$(<"$userpath/custom_number")")
if (( ncustom_user_apps != ncustom_user_files )); then
echo "$ncustom_user_apps" > "$userpath/custom_number"
RELOAD=1
PARTIAL=1
fi
}

function sh_main {
local cfilestart='index.sh.htm'
# RELOAD=1

# RELOAD=1 #force reload
if (( RELOAD )); then
local cfilestart='main.sh.htm'
rm -f "$userpath/cache*" >/dev/null 2>&-
rm -f "$userpath/icons/*" >/dev/null 2>&-
rm -f "$userpath/show_other" >/dev/null 2>&-
if (( PARTIAL )); then
cmdlogger rm -f "$userpath"/custom-*
else
cmdlogger rm -f "$userpath"/cache*
cmdlogger rm -f "$userpath"/icons/*
cmdlogger rm -f "$userpath"/show_other
cmdlogger rm -f "$userpath"/custom-*
fi
# Cria arquivo para ser removido dentro do loop-search e verificado no index.sh.htm quando deve prosseguir
echo '' > "$userpath/reload"
# Cria arquivo para ser removido dentro do index.sh.htm
echo '' > "$userpath/refresh"
#########################################################
# START CACHE 1
#########################################################
nice -n 15 ./loop-search.sh &
nice -n 15 ./loop-search.sh "$PARTIAL" &
fi
QT_QPA_PLATFORM=xcb\
SDL_VIDEODRIVER=x11\
Expand All @@ -142,8 +167,9 @@ function verify_cache {
sh_config
sh_checkdir
sh_clean_reload
verify_kcm_number
verify_number_files_bcc_apps
verify_user_language
verify_bcc_version
verify_cache
sh_verify_custom_user_files
sh_verify_kcm_number
sh_verify_number_files_bcc_apps
sh_verify_user_language
sh_verify_bcc_version
sh_main
18 changes: 10 additions & 8 deletions bigcontrolcenter/usr/bin/bigcontrolcenter-clean-menu
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#shellcheck disable=SC2155
#shellcheck source=/dev/null

# bigcontrolcenter-clean-menu
# /usr/bin/bigcontrolcenter-clean-menu
# Created: 0000/00/00
# Altered: 2023/07/17
# Altered: 2023/08/05
#
# Copyright (c) 2023-2023, Vilmar Catafesta <vcatafesta@gmail.com>
# 0000-2023, bigbruno Bruno Gonçalves <bruno@biglinux.com.br>
Expand All @@ -31,9 +31,11 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


readonly APP="${0##*/}"
readonly _VERSION_="1.0.0-20230722"
readonly LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
APP="${0##*/}"
_VERSION_="1.0.0-20230805"
BOOTLOG="/tmp/bigcontrolcenter-$(date +"%d%m%Y").log"
LOGGER='/dev/tty8'
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"

function sh_config {
Expand Down Expand Up @@ -104,15 +106,15 @@ function sh_config {

function sh_fix_permissions {
# Fix permissions
chmod 644 "$bigdir"/*.desktop >/dev/null 2>&-
cmdlogger chmod 644 "$bigdir"/*.desktop
}

function sh_change_file {
local cfile="$1"

#remover as entradas do KCModulee Type=Service e desocultar a categoria
sed -i 's|X-KDE-ServiceTypes=KCModule||g;s|Type=Service||g;/Categories/s/^/#/;/DBusActivatable/s/^/#/' "$cfile" >/dev/null 2>&-
mv -f "$cfile" "$bigdir/" >/dev/null 2>&-
cmdlogger sed -i 's|X-KDE-ServiceTypes=KCModule||g;s|Type=Service||g;/Categories/s/^/#/;/DBusActivatable/s/^/#/' "$cfile"
cmdlogger mv -f "$cfile" "$bigdir/"
}

function sh_init {
Expand Down
Loading

0 comments on commit 7f64c37

Please sign in to comment.