使用 Linux 开发的同学可能都有一个烦恼,没有好用的微信客户端,基于网页版的不少,但是也逃不了网页版的通病,比如图片会模糊啊,无法截图啊,聊天记录同步啊,所以还是 Windows 版更省心。其实,我一直使用 网页版,直到几天前网页版无法登录,这才考虑再折腾。
使用 wine 的缺点是如果卸载,那么将会有一堆的残留,所以,我优先考虑了 docker,没错,
docker wechat,这个其实很不错,就是有两个小毛病。
docker wine - X Error of failed request: BadValue (integer parameter out of range for operation)
出现这个问题呢,可以通过多加 --ipc="host" 来解决,具体来讲,启动 命令如下了:
docker run -d --name wechat --device /dev/snd \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/WeChatFiles:/WeChatFiles \
-v /home:/MyPc \
--ipc="host" \
-e DISPLAY=unix$DISPLAY \
-e XMODIFIERS=@im=fcitx \
-e QT_IM_MODULE=fcitx \
-e GTK_IM_MODULE=fcitx \
-e AUDIO_GID=`getent group audio | cut -d: -f3` \
-e GID=`id -g` \
-e UID=`id -u` \
bestwu/wechat
第四行是新增的。然后,你可能也会遇到:
wine wechat 字体模糊
这个也简单,给你的系统安装 文泉驿微米黑 字体,这里的系统是主机,不是 docker 哦,即运行 docker 的系统安装字体,而不是docker 内部哦。
最后一个问题,你一定会遇到:
wine wechat 小黑框
要解决这个问题,你需要两个工具:wmctrl 和 xdotool,具体安装我不啰嗦了,解决是这样的:
1、wmctrl -l -G -p -x
此时可能看到如下的输出
0x02e00042 0 213 0 64 1 1 wechat.exe.Wine 87a07b194048 ChatContactMenu
0x02e00044 0 213 1860 1020 60 60 wechat.exe.Wine 87a07b194048
0x02e00041 0 213 824 422 850 617 wechat.exe.Wine 87a07b194048 微信
这里,只有最后一个是有用的,其他两个应该隐藏。分别执行:xdotool windowunmap 0x02e00042 以及 xdotool windowunmap 0x02e00044 完美。
2020.01.10 更新,使用脚本隐藏小黑框:
#!/bin/bash
windowsList=$(wmctrl -l -G -p -x)
result="${windowsList}"
while read -r line
do
id=''
index=0
name='null'
title='null'
for i in ${line[@]}
do
if [ $index == 0 ]
then
id=$i
fi
if [ $index == 7 ]
then
name=$i
fi
if [ $index == 9 ]
then
title=$i;
fi
index=$((index + 1))
done
if [ $name == 'wechat.exe.Wine' ]
then
if [ $title != '微信' ]
then
echo 'id is '$id 'name is '$name 'title is '$title
xdotool windowunmap $id
fi
fi
done <<< "$result"
2020-04-22 更新,更新微信版本,解决提示版本太低
docker exec -it wechat /bin/bash
su - wechat
mkdir /tmp/wechat
cd /tmp/wechat
wget https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe
env WINEPREFIX=~/.deepinwine/Deepin-WeChat deepin-wine WeChatSetup.exe
这里,第一个命令是进入容器,其中 wechat 是容器名称,请视情况而定。
评论