OrcaSlicer/src/platform/unix/BuildLinuxImage.sh.in
deftdawg 91db1be09e Add sigxcpu76's fix to force use of light GTK theme
When using Bambu Studio with a dark themed Linux desktop, many of the dialogs appear as white text on a white background (font's correctly invert, but dialogs remain white).

@sigxcpu76 provided a workaround for this in #12 which is to tell the app to use a light GTK theme.  This change incorporates that workaround into the AppImage making the app more usable until such time as proper dark theme support can be added to Bambu Studio.
2022-12-09 09:42:41 +08:00

72 lines
2 KiB
Bash

#!/bin/bash
export ROOT=$(echo $ROOT | grep . || pwd)
export NCORES=`nproc --all`
while getopts ":ih" opt; do
case ${opt} in
i )
export BUILD_IMAGE="1"
;;
h ) echo "Usage: ./BuildLinuxImage.sh [-i]"
echo " -i: Generate Appimage (optional)"
exit 0
;;
esac
done
echo -n "[9/9] Generating Linux app..."
#{
# create directory and copy into it
if [ -d "package" ]
then
rm -rf package/*
rm -rf package/.* 2&>/dev/null
else
mkdir package
fi
mkdir package/bin
# copy Resources
cp -Rf ../resources package/resources
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
# remove unneeded po from resources
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
# create bin
cat << EOF >@SLIC3R_APP_CMD@
#!/bin/bash
DIR=\$(readlink -f "\$0" | xargs dirname)
export LD_LIBRARY_PATH="\$DIR/bin"
# FIXME: BambuStudio segfault workarounds
# 1) BambuStudio will segfault on systems where locale info is not as expected (i.e. Holo-ISO arch-based distro)
# 2) BambuStudio will segfault with a boost logging error if ~/.config/BambuStudio doesn't exist on first run
export LC_ALL=C
# FIXME: BambuStudio doesn't respect dark mode; use GTK_THEME workaround from sigxcpu76 │
export GTK_THEME=Adwaita:light
mkdir -p \${HOME}/.config/BambuStudio/ 2> /dev/null
exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"
EOF
chmod ug+x @SLIC3R_APP_CMD@
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
pushd package
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
popd
#} &> $ROOT/Build.log # Capture all command output
echo "done"
if [[ -n "$BUILD_IMAGE" ]]
then
echo -n "Creating Appimage for distribution..."
#{
pushd package
chmod +x ../build_appimage.sh
../build_appimage.sh
popd
mv package/"@SLIC3R_APP_KEY@_ubu64.AppImage" "@SLIC3R_APP_KEY@_ubu64.AppImage"
#} &> $ROOT/Build.log # Capture all command output
echo "done"
fi