删除: spark-dwine-helper/pkg/opt/deepinwine/tools/spark_run_v4.sh

新文件:   spark-dwine-helper/pkg/opt/durapps/spark-dwine-helper/set-dwine5-scale.sh
	新文件:   spark-dwine-helper/pkg/opt/durapps/spark-dwine-helper/spark-get-scale.sh
This commit is contained in:
2022-05-30 14:47:59 +08:00
parent 8d124fddce
commit 517305db87
3 changed files with 151 additions and 631 deletions

View File

@@ -0,0 +1,106 @@
#!/bin/bash
help() {
cat <<EOF
用法:$0 [-h|--help] path
-h|--help 显示这个帮助
path 容器目录
这个脚本不应该用于deepin-wine6
--------------------------------------------------------------------
Usage: $0 [-h|--help] path
-h|--help Show this text
path Wine Container directory path
You shouldn't use this script with deepin-wine6
EOF
}
#########################帮助文件结束#############################
parse_args() {
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
help
exit
;;
*)
CONTAINER_PATH="$1"
break
#没有参数就读完退出
;;
esac
shift
done
}
################
parse_args "$@"
#####先看看PATH对不对
if [ ! -f "$CONTAINER_PATH/user.reg" ];then
echo "错误找不到user.reg退出。你应当在文件解压结束后调用此脚本"
echo "E: Can not find user.reg. Exit. You should use this script after the extraction"
exit 1
fi
until [ "$env_dwine_scale" != "" ];do
env_dwine_scale=`echo $DEEPIN_WINE_SCALE`
if [ "$env_dwine_scale" = "" ];then
echo "E: No DEEPIN_WINE_SCALE found. Use spark-dwine-scale-env-generator to generate"
echo "错误没有检测到DEEPIN_WINE_SCALE用spark-dwine-scale-env-generator生成"
/opt/durapps/spark-dwine-helper/spark-get-scale.sh $CONTAINER_PATH
env_dwine_scale=echo "$?"
else
echo "检测到的缩放倍数为:$env_dwine_scale"
echo "Scale is $env_dwine_scale"
fi
done
#####非deepin发行版似乎没有这个变量暂时不清楚这个变量是哪个组件做的
case "$env_dwine_scale" in
1.0)
reg_text="\"LogPixels\"=dword:00000064"
;;
1.25)
reg_text="\"LogPixels\"=dword:0000007d"
;;
1.5)
reg_text="\"LogPixels\"=dword:00000096"
;;
2.0)
reg_text="\"LogPixels\"=dword:000000C8"
;;
*)
reg_text="\"LogPixels\"=dword:00000064"
#可能不是Xorg
;;
esac
#####根据scale设置dword值
LogPixels_line=(`sed -n -e "/"LogPixels"/=" $CONTAINER_PATH/user.reg`)
#####关键词行数取得
until [ "${#LogPixels_line[@]}" = "0" ];do
line_num=${LogPixels_line[0]}
sed -i "$line_num"c\ "$reg_text" "$CONTAINER_PATH/user.reg"
LogPixels_line=(${LogPixels_line[@]:1})
done
echo "已经完成替换。位置:$CONTAINER_PATH/user.reg"
echo "在以下行数进行了替换,内容为$reg_text"
echo `sed -n -e "/"LogPixels"/=" $CONTAINER_PATH/user.reg`
echo "---------------------------------------"

View File

@@ -0,0 +1,45 @@
#/bin/bash
##### $1是容器位置
if [ "$1" = "" ];then
echo "错误没有输入容器地址。请参考set-dwine5-scale对本脚本的调用"
exit
fi
Get_Dist_Name()
{
if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
DISTRO='Deepin'
elif grep -Eqi "Uniontech" /etc/issue || grep -Eq "Uniontech" /etc/*-release; then
DISTRO='UniontechOS'
fi
}
Get_Dist_Name
if [ "$DISTRO" = "Deepin" ] || [ "$DISTRO" = "UniontechOS" ];then
return 1.0
#####就是1倍缩放
exit
fi
if [ -f "$1/scale.txt" ];then
return `cat $1/scale.txt`
exit
fi
dimensions=`xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/'`
zenity --list \
--width=700 \
--height=300 \
--title="您的分辨率是:$dimensions,请在以下选项中选择一个以运行应用" \
--column="缩放倍率" \
1.0 \
1.25 \
1.5 \
2.0
zenity --info --text="已保存!您可以随时删除$1/scale.txt来重新设置"
echo "$?" > $1/scale.txt
return $?