Skip to content

Commit

Permalink
Fix translation and get image from Waydroid and not AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbruno committed Aug 15, 2023
1 parent a2b6d2c commit 72e6773
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 71 deletions.
4 changes: 2 additions & 2 deletions bigcontrolcenter/usr/bin/waydroid-gui-big
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export LOGGER='/dev/tty8'
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"

sh_main {
cmdlogger cd /usr/share/bigbashview/bcc/apps/waydroid/ || return 1
function sh_main {
cd /usr/share/bigbashview/bcc/apps/waydroid/
bigbashview index.sh.htm -i icon.png -s 780x640
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"

export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=bigcontrolcenter


function sh_config {
#Translation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=bigcontrolcenter
# Don't group windows
xprop -id "$(xprop -root '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)" -f WM_CLASS 8s -set WM_CLASS "$$"
declare -g FOLDER_CONFIG="$HOME/.config/waydroid"
Expand Down Expand Up @@ -72,7 +74,9 @@
<head>
<meta charset="UTF-8">
<title>
$"Waydroid"
EOF
echo $"Waydroid"
cat <<-EOF
</title>
<script type="text/javascript" src="/usr/share/bigbashview/bcc/materialize/js/jquery.js"></script>
<link rel="stylesheet" href="./style2.css">
Expand All @@ -99,30 +103,27 @@ <h2><img src="icon.png" style="width: 48px;"><br>
<!-- INICIO TABS CONTENT LIST -->
<div id="list-tab-content" class="fc-card active">
<div id="desc">
$"Utilize programas para Android no BigLinux."
<br><br>
EOF
echo $"Utilize programas para Android no BigLinux."
echo '<br><br>'
if ! test -e '/usr/bin/waydroid-big'; then
INSTALL_WAYDROID=$"Instalar o Waydroid"
INSTALL_WAYDROID_WITH_GAPPS=$"Instalar o Waydroid com Google Apps"
#echo $"Waydroid permite executar ou instalar aplicativos Android no formato .apk diretamente do gerenciador de arquivos.<br><br>"
cat <<-EOF
<div id="img-waydroid"><img src="big-waydroid.svg" class="img-waydroid"></div>
<b style="font-size:16px;">
$"O download tem aproximadamente 1 GB, dependendo da sua conexão pode demorar."
</b>
<br><br>
echo '<div id="img-waydroid"><img src="big-waydroid.svg" class="img-waydroid"></div>
<b style="font-size:16px;">'
echo $"O download tem aproximadamente 1 GB, dependendo da sua conexão pode demorar."
echo '</b><br><br>
<div class="apps-card" style="margin-left: 10px; margin-right: 10px; display: inline-flex;">
<div class="app-card">
<a class="content-button status-button" style="margin-left: 10px; margin-right: 10px;" href="make.sh.htm?install_with_gapps=1">$INSTALL_WAYDROID_WITH_GAPPS</a>
<a class="content-button status-button" style="margin-left: 10px; margin-right: 10px;" href="make.sh.htm?install_with_gapps=1">' "$INSTALL_WAYDROID_WITH_GAPPS" '</a>
</div>
<div class="app-card">
<a class="content-button status-button" style="margin-left: 10px; margin-right: 10px;" href="make.sh.htm?install=1">$INSTALL_WAYDROID</a>
<a class="content-button status-button" style="margin-left: 10px; margin-right: 10px;" href="make.sh.htm?install=1">' "$INSTALL_WAYDROID" '</a>
</div>
</div>
<div class="help-action">
<p style='font-size:14px;'>
EOF
' "<p style='font-size:14px;'>"
else
# Open to verify if /run/waydroid-lxc/dnsmasq.pid exist using http status, 200 ok, 500 not exist
################################################################################################
Expand Down Expand Up @@ -164,10 +165,9 @@ <h2><img src="icon.png" style="width: 48px;"><br>
<svg viewBox="0 0 576 512" class="svg-inline--fa fa-chrome fa-w-16 fa-3x">
<path fill="currentColor" d="M528 0h-480C21.5 0 0 21.5 0 48v320C0 394.5 21.5 416 48 416h192L224 464H152C138.8 464 128 474.8 128 488S138.8 512 152 512h272c13.25 0 24-10.75 24-24s-10.75-24-24-24H352L336 416h192c26.5 0 48-21.5 48-48v-320C576 21.5 554.5 0 528 0zM512 352H64V64h448V352z"></path>
</svg>
Resolução
</div>
<div class="button-wrapper">
EOF
EOF
echo $"Resolução"
echo '</div><div class="button-wrapper">'

# Resolução
###########
Expand Down Expand Up @@ -216,9 +216,10 @@ <h2><img src="icon.png" style="width: 48px;"><br>
<div class="products">
<svg viewBox="0 0 512 512">
<path fill="currentColor" d="M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"></path></svg>
Aceleração 3D
</div>
EOF
EOF
echo $"Aceleração 3D"
echo '</div>'

ENABLE_GPU=$"Desativado"
DISABLE_GPU=$"Ativado"
tooltiprun=$"O Waydroid também pode ser iniciado utilizando o menu do sistema"
Expand Down Expand Up @@ -248,15 +249,18 @@ <h2><img src="icon.png" style="width: 48px;"><br>
cat <<-EOF
</li>
EOF
if pacman -Qq waydroid-image-gapps >/dev/null 2>&- ; then
if pacman -Qq waydroid-image-gapps >/dev/null 2>&- || grep -q GAPPS /var/lib/waydroid/waydroid.cfg; then
if [[ "$(waydroid status | grep Session | grep RUNNING)" != "" ]] || [[ "$(ps -e | grep waydroid-big)" != "" ]]; then
SHOW_ID=$"Exibir ID do Android"
ACTIVATE=$"Ativar Google Apps"
cat <<-EOF
<li>
<div class="products">
<svg viewBox="0 0 512 512"><path fill="currentColor" d="M325.3 234.3L104.6 13l280.8 161.2-60.1 60.1zM47 0C34 6.8 25.3 19.2 25.3 35.3v441.3c0 16.1 8.7 28.5 21.7 35.3l256.6-256L47 0zm425.2 225.6l-58.9-34.1-65.7 64.5 65.7 64.5 60.1-34.1c18-14.3 18-46.5-1.2-60.8zM104.6 499l280.8-161.2-60.1-60.1L104.6 499z"></path></svg>
PlayStore
EOF

echo $"PlayStore"
cat <<-EOF
</div>
<div class="txt">
<a href="#" class="status-remove"><svg viewBox="0 0 512 512" style="width: 16px; border-radius: 0px; margin: 0px; position: relative; top: -11px;"><path fill="currentcolor" d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 400c-18 0-32-14-32-32s13.1-32 32-32c17.1 0 32 14 32 32S273.1 400 256 400zM325.1 258L280 286V288c0 13-11 24-24 24S232 301 232 288V272c0-8 4-16 12-21l57-34C308 213 312 206 312 198C312 186 301.1 176 289.1 176h-51.1C225.1 176 216 186 216 198c0 13-11 24-24 24s-24-11-24-24C168 159 199 128 237.1 128h51.1C329 128 360 159 360 198C360 222 347 245 325.1 258z"/></svg></a>
Expand All @@ -276,7 +280,7 @@ <h2><img src="icon.png" style="width: 48px;"><br>
</div>
<div class="pop-up__subtitle" style="text-align: justify;">
EOF
echo $'Para ativar a PlayStore é necessário clicar em (Exibir ID do Android) e copiar o ID do Android, em seguida clique em (Ativar Google Apps) para abrir a página de Registro do dispositivo, precisa estar logado na sua conta Google, insira seu ID do Android e faça o registro. Pode demorar alguns minutos para ativar no seu Waydroid. Feche e abra novamente. Pronto!'
echo $"Para ativar a PlayStore é necessário clicar em (Exibir ID do Android) e copiar o ID do Android, em seguida clique em (Ativar Google Apps) para abrir a página de Registro do dispositivo, precisa estar logado na sua conta Google, insira seu ID do Android e faça o registro. Pode demorar alguns minutos para ativar no seu Waydroid. Feche e abra novamente. Pronto!"
cat <<-EOF
</div>
</div>
Expand Down
84 changes: 49 additions & 35 deletions bigcontrolcenter/usr/share/bigbashview/bcc/apps/waydroid/install.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,58 @@
#!/usr/bin/env bash

#Install
pamac-installer --build $1 &
# #Install
# pamac-installer --build $1 &
#
# # Fix installation in BBV window
# PID="$!"
# [[ "$PID" = "" ]] && exit
#
# CONTADOR=0
# while [ $CONTADOR -lt 100 ]; do
# if [ "$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ")" != "" ]; then
# xsetprop -id=$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") --atom WM_TRANSIENT_FOR --value $(wmctrl -p -l -x | grep Waydroid$ | cut -f1 -d" ") -f 32x
# wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b add,skip_pager,skip_taskbar
# wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b toggle,modal
# break
# fi
# sleep 0.1
# let CONTADOR=CONTADOR+1
# done
# wait

# Fix installation in BBV window
PID="$!"
[[ "$PID" = "" ]] && exit
if [ "$ACTION" = "install" ]; then
systemctl stop waydroid-container
grep sys.use_memfd=true /var/lib/waydroid/waydroid_base.prop || echo sys.use_memfd=true | tee -a /var/lib/waydroid/waydroid_base.prop
waydroid init
systemctl start waydroid-container
elif [ "$ACTION" = "install_gapps" ]; then
systemctl stop waydroid-container
grep sys.use_memfd=true /var/lib/waydroid/waydroid_base.prop || echo sys.use_memfd=true | tee -a /var/lib/waydroid/waydroid_base.prop
waydroid init -s GAPPS -c https://ota.waydro.id/system -v https://ota.waydro.id/vendor -f
systemctl start waydroid-container
else

CONTADOR=0
while [ $CONTADOR -lt 100 ]; do
if [ "$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ")" != "" ]; then
xsetprop -id=$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") --atom WM_TRANSIENT_FOR --value $(wmctrl -p -l -x | grep Waydroid$ | cut -f1 -d" ") -f 32x
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b add,skip_pager,skip_taskbar
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b toggle,modal
break
fi
sleep 0.1
let CONTADOR=CONTADOR+1
done
wait
pamac-installer waydroid waydroid-meta-x11 python-pyclip xclip wl-clipboard &
PID="$!"
[[ "$PID" = "" ]] && exit

pamac-installer waydroid waydroid-meta-x11 &
PID="$!"
[[ "$PID" = "" ]] && exit
CONTADOR=0
while [ $CONTADOR -lt 100 ]; do
if [ "$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ")" != "" ]; then
xsetprop -id=$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") --atom WM_TRANSIENT_FOR --value $(wmctrl -p -l -x | grep Waydroid$ | cut -f1 -d" ") -f 32x
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b add,skip_pager,skip_taskbar
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b toggle,modal
break
fi
sleep 0.1
let CONTADOR=CONTADOR+1
done
wait

CONTADOR=0
while [ $CONTADOR -lt 100 ]; do
if [ "$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ")" != "" ]; then
xsetprop -id=$(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") --atom WM_TRANSIENT_FOR --value $(wmctrl -p -l -x | grep Waydroid$ | cut -f1 -d" ") -f 32x
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b add,skip_pager,skip_taskbar
wmctrl -i -r $(wmctrl -p -l | grep -m1 " $PID " | cut -f1 -d" ") -b toggle,modal
break
if [[ "$(lsmod | grep nvidia_drm)" != "" ]]; then
waydroid-big-3d 0
else
waydroid-big-3d 1
fi
sleep 0.1
let CONTADOR=CONTADOR+1
done
wait

if [[ "$(lsmod | grep nvidia_drm)" != "" ]]; then
waydroid-big-3d 0
else
waydroid-big-3d 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
#shellcheck disable=SC2155,SC2034
#shellcheck source=/dev/null

# /usr/share/bigbashview/bcc/apps/big-store/install_terminal.sh
# Description: Big Store installing programs for BigLinux
#
# Created: 2022/01/11
# Altered: 2023/08/13
#
# 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.

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

OIFS=$IFS
IFS=$'\n'

MARGIN_TOP_MOVE="-90" WINDOW_HEIGHT=20 PID_BIG_DEB_INSTALLER="$$" WINDOW_ID="$WINDOW_ID" ./install_terminal_resize.sh &

case "$ACTION" in
"install")
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true ACTION=install /usr/share/bigbashview/bcc/apps/waydroid/install.sh
kdialog --msgbox "ok"
;;
"install_gapps")
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true ACTION=install_gapps /usr/share/bigbashview/bcc/apps/waydroid/install.sh
;;
esac


if [ "$(xwininfo -id $WINDOW_ID 2>&1 | grep -i "No such window")" != "" ]; then
kill -9 $PID_BIG_DEB_INSTALLER
exit 0
fi

IFS=$OIFS
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
##################################
# Author Create: Bruno Gonçalves (www.biglinux.com.br)
# Author Modify: Rafael Ruscher (rruscher@gmail.com)
# Create Date: 2020/01/11
# Modify Date: 2022/05/09
#
# Description: Big Store installing programs for BigLinux
#
# Licensed by GPL V2 or greater
##################################
#Install .deb packages

STOP=0
while [ "$STOP" = "0" ]; do
WINDOW_HEIGHT_DETECT="$(xwininfo -id $WINDOW_ID | grep Height: | sed 's|.* ||g')"
WINDOW_WIDTH="$(xwininfo -id $WINDOW_ID | grep Width: | sed 's|.* ||g')"
WIDTH_TERMINAL="$(echo "$WINDOW_WIDTH * 0.8 / 10" | bc | cut -f1 -d".")"
MARGIN_LEFT="$(echo "$WINDOW_WIDTH * 0.15" | bc | cut -f1 -d".")"
MARGIN_TOP="$(echo "$WINDOW_HEIGHT_DETECT * 0.5" $MARGIN_TOP_MOVE | bc | cut -f1 -d".")"
xtermset -geom ${WIDTH_TERMINAL}x${WINDOW_HEIGHT}+${MARGIN_LEFT}+${MARGIN_TOP}
sleep 1
# if close bigbashview window, kill terminal too
if [ "$(xwininfo -id $WINDOW_ID 2>&1 | grep -i "No such window")" != "" ]; then
kill -9 $PID_TERM_BIG_STORE
exit 0
fi
done
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,26 @@
}

function sh_instalar_waydroid {
./install.sh waydroid-image
./install.sh
ACTION="install" \
WINDOW_ID="$(xprop -root '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)" \
urxvt +sb -internalBorder 1 -borderColor rgb:00/22/40 -depth 32 -fg rgb:00/ff/ff -bg rgb:00/22/40 -fn "xft:Ubuntu Mono:pixelsize=18" -embed $(xprop -root '\t$0' _NET_ACTIVE_WINDOW |
cut -f 2) -sr -bc -e ./install_terminal.sh
}

function sh_instalar_waydroid_com_gapps {
./install.sh waydroid-image-gapps
./install.sh

ACTION="install_gapps" \
WINDOW_ID="$(xprop -root '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)" \
urxvt +sb -internalBorder 1 -borderColor rgb:00/22/40 -depth 32 -fg rgb:00/ff/ff -bg rgb:00/22/40 -fn "xft:Ubuntu Mono:pixelsize=18" -embed $(xprop -root '\t$0' _NET_ACTIVE_WINDOW |
cut -f 2) -sr -bc -e ./install_terminal.sh
}

function sh_desinstalar_waydroid {
sh_remover_configuracoes

if pacman -Q waydroid-image-gapps &>/dev/null; then
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-image-gapps waydroid-biglinux libgbinder python-gbinder
elif pacman -Q waydroid-image &>/dev/null; then
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-image-gapps waydroid-biglinux libgbinder python-gbinder
else
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-biglinux libgbinder python-gbinder
fi
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true /usr/share/bigbashview/bcc/apps/waydroid/remove.sh
}

function sh_habilitar_desabilitar_3d {
Expand Down
13 changes: 13 additions & 0 deletions bigcontrolcenter/usr/share/bigbashview/bcc/apps/waydroid/remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

if pacman -Q waydroid-image-gapps &>/dev/null; then
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-image-gapps waydroid-biglinux libgbinder python-gbinder
elif pacman -Q waydroid-image &>/dev/null; then
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-image waydroid-biglinux libgbinder python-gbinder
else
pamac-installer --remove waydroid waydroid-meta-x11 waydroid-biglinux libgbinder python-gbinder
fi
# Remove images
rm -R /var/lib/waydroid/images/
rm /var/lib/waydroid/waydroid*
kill $(ps -aux | grep waydroid | grep container | awk '{print $2}')

0 comments on commit 72e6773

Please sign in to comment.