注:使用的wine为deepin-wine5(新版),优化更好。当然老版本的deepin-wine可以仍然能够使用,但是官方仓库中被移除了。

经典的前情提要:

昨天看见了pamac(manjaro的可视化包管理器)的更新提示。居然提示我deepin.com.qq.office(aur)更新了(不知为啥,archlinuxcn源里现在已经找不到了)。更新后,不出所料,启动不了了。于是卸载tim,deepin-wine,准备重装tim。

然后就发现以前的deepin-wine也被移除了,于是就开始了新的折腾之旅。

在亿些神奇的尝试后,歪打正着找到了这样一个包deepin-wine-tim(实际是因为我忘记了包名)

不管了,直接步入正题吧。

一、安装deepin-wine-tim

(由于文章会过时)强烈建议同时参考Github页面:deepin-wine-tim-arch

以下的安装建议全都用yay安装,因为,至少目前(本文发布时)archlinuxcn里没有完整的依赖包,极其容易出现依赖不全的情况。

另外注意:deepin-wine-tim(aur)目前被标记为(过时的),因为原来的启动脚本适配的是deepin-wine(被删除),打包者还没有做deepin-wine5的适配和重新打包。但是问题不大,下面的教程可以手动适配deepin-wine5。

deepin-wine-tim默认的依赖为wine5.22(非deepin版),实测可以安装,但无法启动。

安装deepin-wine5

1
$yay -S deepin-wine5

安装deepin-wine-tim

1
$yay -S deepin-wine-tim

安装完成后不要启动!!!(还未配置)

二、配置启动脚本

启动脚本位于:/opt/deepinwine/apps/Deepin-TIM/run.sh

为了简便一些,这里直接贴出适配后的脚本(其实就是把deepin-wine替换为deepin-wine5):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/sh

# Copyright (C) 2016 Deepin, Inc.
#
# Author: Li LongYu <lilongyu@linuxdeepin.com>
# Peng Hao <penghao@linuxdeepin.com>

# Codist <countstarlight@gmail.com>

WINEPREFIX="$HOME/.deepinwine/Deepin-TIM"
APPDIR="/opt/deepinwine/apps/Deepin-TIM"
APPVER="3.2.0.21856"
APPTAR="files.7z"
PACKAGENAME="com.qq.tim"
WINE_CMD="wine"

HelpApp()
{
echo " Extra Commands:"
echo " -r/--reset Reset app to fix errors"
echo " -e/--remove Remove deployed app files"
echo " -d/--deepin Switch to 'deepin-wine'"
echo " -h/--help Show program help info"
}
CallApp()
{
if [ ! -f "$WINEPREFIX/reinstalled" ]
then
touch $WINEPREFIX/reinstalled
env WINEPREFIX="$WINEPREFIX" $WINE_CMD $APPDIR/TIM$APPVER.exe
else
#disable Tencent MiniBrowser
#_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"

#Support use native file dialog
export ATTACH_FILE_DIALOG=1

env WINEPREFIX="$WINEPREFIX" WINEDEBUG=-msvcrt $WINE_CMD "c:\\Program Files\\Tencent\\TIM\\Bin\\TIM.exe" &
fi
}
ExtractApp()
{
mkdir -p "$1"
7z x "$APPDIR/$APPTAR" -o"$1"
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
sed -i "s#@current_user@#$USER#" $1/*.reg
}
DeployApp()
{
ExtractApp "$WINEPREFIX"
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
}
RemoveApp()
{
rm -rf "$WINEPREFIX"
}
ResetApp()
{
echo "Reset $PACKAGENAME....."
read -p "*Are you sure?(Y/N)" ANSWER
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
EvacuateApp
DeployApp
CallApp
fi
}
UpdateApp()
{
if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
return
fi
if [ -d "${WINEPREFIX}.tmpdir" ]; then
rm -rf "${WINEPREFIX}.tmpdir"
fi
ExtractApp "${WINEPREFIX}.tmpdir"
/opt/deepinwine/tools/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
rm -rf "${WINEPREFIX}.tmpdir"
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
}
RunApp()
{
if [ -d "$WINEPREFIX" ]; then
UpdateApp
else
DeployApp
fi
CallApp
}

CreateBottle()
{
if [ -d "$WINEPREFIX" ]; then
UpdateApp
else
DeployApp
fi
}

msg()
{
ECHO_LEVEL=("\033[1;32m==> " "\033[1;31m==> ERROR: ")
echo -e "${ECHO_LEVEL[$1]}\033[1;37m$2\033[0m"
}

SwitchToDeepinWine()
{
PACKAGE_MANAGER="yay"
DEEPIN_WINE_DEPENDS="deepin-wine5"
if ! [ -x "$(command -v yay)" ]; then
if ! [ -x "$(command -v yaourt)" ]; then
msg 1 "Need to install 'yay' or 'yaourt' first." >&2
exit 1
else
$PACKAGE_MANAGER="yaourt"
fi
fi
if [[ -z "$(ps -e grep -o gsd-xsettings)" ]]; then
DEEPIN_WINE_DEPENDS="${DEEPIN_WINE_DEPENDS} xsettingsd"
fi
if [ "$XDG_CURRENT_DESKTOP" = "Deepin" ]; then
DEEPIN_WINE_DEPENDS="${DEEPIN_WINE_DEPENDS} lib32-freetype2-infinality-ultimate"
fi
for p in ${DEEPIN_WINE_DEPENDS}; do
if pacman -Qs $p > /dev/null ; then
msg 0 "$p is installed, skip ..."
else
msg 0 "Installing dependency: $p ..."
$PACKAGE_MANAGER -S $p
fi
done
msg 0 "Redeploying app ..."
if [ -d "$WINEPREFIX" ]; then
RemoveApp
fi
DeployApp
msg 0 "Reversing the patch ..."
patch -p1 -R -d ${WINEPREFIX} < $APPDIR/reg.patch
msg 0 "Creating flag file '$WINEPREFIX/deepin' ..."
touch -f $WINEPREFIX/deepin
msg 0 "Done."
exit 0
}

# Init
if [ -f "$WINEPREFIX/deepin" ]; then
WINE_CMD="deepin-wine5"
if [[ -z "$(ps -e grep -o gsd-xsettings)" ]] && [[ -z "$(ps -e grep -o xsettingsd)" ]]; then
if [[ ! -f "$HOME/.xsettingsd" ]] && [[ ! -f "$HOME/.config/xsettingsd/xsettingsd.conf" ]] && [[ ! -f "/etc/xsettingsd/xsettingsd.conf" ]]; then
mkdir -p "$HOME/.config/xsettingsd" && touch "$HOME/.config/xsettingsd/xsettingsd.conf"
fi
/usr/bin/xsettingsd &
fi
fi

if [ -z $1 ]; then
RunApp
exit 0
fi
case $1 in
"-r" "--reset")
ResetApp
;;
"-c" "--create")
CreateBottle
;;
"-e" "--remove")
RemoveApp
;;
"-d" "--deepin")
SwitchToDeepinWine
;;
"-u" "--uri")
RunApp $2
;;
"-h" "--help")
HelpApp
;;
*)
echo "Invalid option: $1"
echo "Use -h--help to get help"
exit 1
;;
esac
exit 0

更改、保存后,需要先用/opt/deepinwine/apps/Deepin-TIM/run.sh -d 命令自动切换到deepin-wine模式(默认为wine模式)。

然后执行 /opt/deepinwine/apps/Deepin-TIM/run.sh -u 运行(第一次运行为TIM安装程序)

注意:安装路径保持默认不要更改,如需更改,请参考github文档。

等待安装程序结束后,再次启动TIM(自动启动)。不出意外,就能启动成功。

以后可以直接用应用程序中的TIM启动,与运行执行脚本等效。

另外,此wine-TIM允许自动更新,并且能够开启表情漫游,终于Linux上也能体验到最新版的TIM了。

三、解决一些小问题

遇到问题建议直接看Github Issues。这里只做一小部分的问题搬运。

退出TIM

由于wine-TIM无法使用自身的退出按钮退出,于是需要手动执行killall -TIM.exe 命令,才能完全退出。

头像与表情包无法显示、漫游记录打不开

在原生wine下的确存在这个问题,禁用ipv6的确可以解决,但如果本身自己要用ipv6就比较麻烦,建议像另一个issue 里这样做一个本地代理。然后登录tim的时候右上角设置,选择对应的代理(看不见选项可以按tab或者上下左右键)。目前自己使用非常稳定

Core00077 commented on 15 Apr

我用的是“另一个issue” 里的办法。本地搭建一个代理,让TIM的流量通过代理。

TIM的代理配置位于登录界面的设置

搬运一下v2的配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
"inbounds" : [
{
"listen" : "127.0.0.1",
"port" : 1099,
"protocol" : "http",
"tag" : "TIM",
"settings" : {
"timeout" : 0
}
}
],
"outbounds" : [
{
"protocol" : "freedom",
"tag" : "direct"
}
],
"routing" : {
"domainStrategy" : "AsIs",
"rules" : [
{
"type" : "field",
"inboundTag" : "TIM",
"outboundTag" : "direct"
}
]
}
}

注:v2ray安装yay -S v2ray

可以把这个JSON配置保存到本地的一个配置文件中

于是运行命令为:~$ v2ray --config .v2ray.conf

# EOF