mirror of
https://gitee.com/spark-store-project/spark-wine
synced 2025-12-18 21:11:39 +08:00
wmctrl
This commit is contained in:
@@ -25,7 +25,7 @@ Version: $version
|
|||||||
Architecture: all
|
Architecture: all
|
||||||
Maintainer: shenmo <shenmo@spark-app.store>
|
Maintainer: shenmo <shenmo@spark-app.store>
|
||||||
Installed-Size: $SIZE
|
Installed-Size: $SIZE
|
||||||
Depends: zenity, p7zip-legacy (>= 16.02+dfsg-8+Mejituu-2024022216) | p7zip-full (<< 16.02+transitional.1), fonts-noto-cjk, transhell, python3
|
Depends: zenity, p7zip-legacy (>= 16.02+dfsg-8+Mejituu-2024022216) | p7zip-full (<< 16.02+transitional.1), fonts-noto-cjk, transhell, python3, wmctrl
|
||||||
Section: utils
|
Section: utils
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Multi-Arch: foreign
|
Multi-Arch: foreign
|
||||||
@@ -83,6 +83,7 @@ Architecture: all
|
|||||||
Maintainer: shenmo <shenmo@spark-app.store>
|
Maintainer: shenmo <shenmo@spark-app.store>
|
||||||
Installed-Size: $SIZE
|
Installed-Size: $SIZE
|
||||||
Depends: zenity, p7zip-legacy (>= 16.02+dfsg-8+Mejituu-2024022216) | p7zip-full (<< 16.02+transitional.1), fonts-noto-cjk, transhell, python3
|
Depends: zenity, p7zip-legacy (>= 16.02+dfsg-8+Mejituu-2024022216) | p7zip-full (<< 16.02+transitional.1), fonts-noto-cjk, transhell, python3
|
||||||
|
Recommends: wmctrl
|
||||||
Section: utils
|
Section: utils
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Provides: spark-dwine-helper(=$version)
|
Provides: spark-dwine-helper(=$version)
|
||||||
|
|||||||
43
spark-dwine-helper/s-wine-helper/opt/deepinwine/tools/spark-wine-banner
Executable file
43
spark-dwine-helper/s-wine-helper/opt/deepinwine/tools/spark-wine-banner
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -z "$WAYLAND_DISPLAY" ]; then
|
||||||
|
echo "Wayland detected. Do not check wmclass"
|
||||||
|
zenity --progress --title="星火Windows应用兼容助手" --text="正在为您启动以下应用:$WINE_APP_NAME" --pulsate --width=400 --auto-close --no-cancel --timeout=3
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$(which wmctrl)" ]; then
|
||||||
|
echo "No wmctrl installed. Do not check wmclass"
|
||||||
|
zenity --progress --title="星火Windows应用兼容助手" --text="正在为您启动以下应用:$WINE_APP_NAME" --pulsate --width=400 --auto-close --no-cancel --timeout=3
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
target_wmclass=$WINE_WMCLASS
|
||||||
|
|
||||||
|
|
||||||
|
function check_window() {
|
||||||
|
# 使用 wmctrl 命令列出所有窗口,并使用 grep 过滤出特定的 WMCLASS
|
||||||
|
windows=$(wmctrl -lx | grep "$target_wmclass")
|
||||||
|
|
||||||
|
# 如果窗口存在,则关闭提示
|
||||||
|
if [ -n "$windows" ]; then
|
||||||
|
# 提取窗口ID
|
||||||
|
window_id=$(echo "$windows" | awk '{print $1}')
|
||||||
|
|
||||||
|
echo "Window with WMCLASS '$target_wmclass' found"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
echo "Window with WMCLASS '$target_wmclass' not found."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_wmclass(){
|
||||||
|
# 递归检测窗口是否存在的函数
|
||||||
|
|
||||||
|
# 每隔一段时间检测一次窗口是否存在
|
||||||
|
while true; do
|
||||||
|
check_window
|
||||||
|
# 等待一段时间后再次检测
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
check_wmclass | zenity --progress --title="星火Windows应用兼容助手" --text="正在为您启动以下应用:$WINE_APP_NAME" --pulsate --width=400 --auto-close --no-cancel
|
||||||
@@ -13,7 +13,21 @@
|
|||||||
source /opt/durapps/transhell/transhell.sh
|
source /opt/durapps/transhell/transhell.sh
|
||||||
load_transhell_debug
|
load_transhell_debug
|
||||||
source $(dirname $0)/log-function.bashimport
|
source $(dirname $0)/log-function.bashimport
|
||||||
|
#########Preload functions
|
||||||
|
function get_app_name() {
|
||||||
|
local app_name_orig=$(grep -m 1 '^Name=' "/usr/share/applications/$1.desktop" | cut -d '=' -f 2)
|
||||||
|
local app_name_i18n=$(grep -m 1 "^Name\[$LANGUAGE\]\=" "/usr/share/applications/$1.desktop" | cut -d '=' -f 2)
|
||||||
|
local app_name=""
|
||||||
|
|
||||||
|
if [ -z "$app_name_i18n" ]; then
|
||||||
|
app_name="$app_name_orig"
|
||||||
|
else
|
||||||
|
app_name="$app_name_i18n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$app_name"
|
||||||
|
}
|
||||||
|
######### Vars
|
||||||
BOTTLENAME="$1"
|
BOTTLENAME="$1"
|
||||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||||
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
|
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
|
||||||
@@ -24,6 +38,13 @@ WINE_CMD="deepin-wine"
|
|||||||
#这里会被后续覆盖
|
#这里会被后续覆盖
|
||||||
LOG_FILE=$0
|
LOG_FILE=$0
|
||||||
PUBLIC_DIR="/var/public"
|
PUBLIC_DIR="/var/public"
|
||||||
|
if [ -z "$WINE_WMCLASS" ]; then
|
||||||
|
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
||||||
|
fi
|
||||||
|
export WINE_APP_NAME=$(get_app_name ${DEB_PACKAGE_NAME})
|
||||||
|
if [ -z "$WINE_APP_NAME" ];then
|
||||||
|
export WINE_APP_NAME=$BOTTLENAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +65,9 @@ fi
|
|||||||
if [ $APPRUN_CMD ]; then
|
if [ $APPRUN_CMD ]; then
|
||||||
WINE_CMD=$APPRUN_CMD
|
WINE_CMD=$APPRUN_CMD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
if [ "$WINE_CMD" = "deepin-wine8-stable" ] && [ "$(arch)" != "x86_64" ];then
|
if [ "$WINE_CMD" = "deepin-wine8-stable" ] && [ "$(arch)" != "x86_64" ];then
|
||||||
|
|
||||||
WINE_CMD="/opt/durapps/spark-dwine-helper/deepin-wine8-stable-wrapper/deepin-wine8-stable"
|
WINE_CMD="/opt/durapps/spark-dwine-helper/deepin-wine8-stable-wrapper/deepin-wine8-stable"
|
||||||
@@ -57,7 +80,7 @@ if [ $SPECIFY_SHELL_DIR ]; then
|
|||||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##################### Functions
|
||||||
progressbar()
|
progressbar()
|
||||||
{
|
{
|
||||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||||
@@ -296,6 +319,8 @@ fi
|
|||||||
}
|
}
|
||||||
ExtractApp()
|
ExtractApp()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
local tmp_log=$(mktemp)
|
local tmp_log=$(mktemp)
|
||||||
mkdir -p "$1"
|
mkdir -p "$1"
|
||||||
(${UNPACK_CMD} x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)&
|
(${UNPACK_CMD} x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)&
|
||||||
@@ -304,7 +329,7 @@ local tmp_log=$(mktemp)
|
|||||||
(while kill -0 $cmd_pid 2> /dev/null; do
|
(while kill -0 $cmd_pid 2> /dev/null; do
|
||||||
tail -n 1 "${tmp_log}"
|
tail -n 1 "${tmp_log}"
|
||||||
sleep 1
|
sleep 1
|
||||||
done)| zenity --progress --title="${TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL}" --text="${TRANSHELL_CONTENT_UNPACKING} $BOTTLENAME..." --width=600 --auto-close --no-cancel
|
done)| zenity --progress --title="${TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL}" --text="${TRANSHELL_CONTENT_UNPACKING} $WINE_APP_NAME..." --width=600 --auto-close --no-cancel
|
||||||
rm $tmp_log
|
rm $tmp_log
|
||||||
|
|
||||||
|
|
||||||
@@ -367,6 +392,8 @@ UpdateApp()
|
|||||||
}
|
}
|
||||||
RunApp()
|
RunApp()
|
||||||
{
|
{
|
||||||
|
$SHELL_DIR/spark-wine-banner
|
||||||
|
|
||||||
progpid=$(ps -ef | grep "zenity --progress --title=${BOTTLENAME}" | grep -v grep)
|
progpid=$(ps -ef | grep "zenity --progress --title=${BOTTLENAME}" | grep -v grep)
|
||||||
debug_log "run ${BOTTLENAME} progress pid $progpid"
|
debug_log "run ${BOTTLENAME} progress pid $progpid"
|
||||||
if [ -n "$progpid" ]; then
|
if [ -n "$progpid" ]; then
|
||||||
@@ -432,9 +459,6 @@ fi
|
|||||||
|
|
||||||
debug_log "Run $*"
|
debug_log "Run $*"
|
||||||
|
|
||||||
if [ -z "$WINE_WMCLASS" ]; then
|
|
||||||
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#执行lnk文件通过判断第5个参数是否是“/Unix”来判断
|
#执行lnk文件通过判断第5个参数是否是“/Unix”来判断
|
||||||
if [ "$4" == "/Unix" ];then
|
if [ "$4" == "/Unix" ];then
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
TRANSHELL_CONTENT_UNPACKING="正在为您准备以下应用:"
|
TRANSHELL_CONTENT_UNPACKING="正在为您准备以下应用:"
|
||||||
TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL="星火Windows应用兼容助手"
|
TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL="星火Windows应用兼容助手"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user