Ubuntu22.04 下安装企业微信
由于官方不提供linux版本的企业微信,所以linux上面只能使用windows版本的企业微信 https://work.weixin.qq.com/#indexDownload
安装wine
到wine官网按照步骤安装即可 https://wiki.winehq.org/Ubuntu_zhcn
Ubuntu 20.04 libc6 版本较低,无法安装新版本的wine
libc6升级风险很大
安装wine版本的企业微信
推荐这个开源项目:https://github.com/zq1997/deepin-wine
添加仓库
首次使用时,你需要运行如下一条命令将移植仓库添加到系统中。
bash
wget -O- https://deepin-wine.i-m.dev/setup.sh | sh
企业微信应用安装
bash
sudo apt-get install com.qq.weixin.work.deepin
用python脚本解决一些问题
- 一个窗口外边框, 看着巨难受
- 窗口一直处于最前, 目前只找到关闭height=28的窗口方法屏蔽, 会导致最小化最大化和关闭按钮消失
python
#!/usr/bin/env python3
import time
import os
while True:
time.sleep(5)
exist = os.popen("ps -ef | grep WXWorkWeb.exe")
e = exist.readlines()
if len(e) < 3:
print(e)
print("wxwork not started. Exit...")
continue
output = os.popen("""
wmctrl -l -G -p -x | grep wxwork.exe.Wine
""")
s = output.readlines()
for i in s:
print(i)
print("==========================================")
# 0x07c00009 1 166096 1994 722 1016 650 wxwork.exe.Wine xx 企业微信
# 0x07c00010 1 166096 1736 686 1052 686 wxwork.exe.Wine xx
if list(filter(lambda it: "MainWnd" in it, s)):
continue
c = list(filter(lambda it: "企业微信" in it, s))
if not c:
continue
wx = c[0]
width, height = wx.split()[5], wx.split()[6]
def find_similar_size_window(width, height, tar_width, tar_height) -> bool:
width, height, tar_width, tar_height = int(width), int(height), int(tar_width), int(tar_height)
# 在窗口列表中查找与目标大小相似的窗口
threshold = 50 # 设置一个阈值,表示窗口大小相似的范围
if abs(width - tar_width) < threshold and abs(height - tar_height) < threshold:
return True
if tar_width == width and tar_height == 28:
return True
return False
fs = filter(lambda it: "企业微信" not in it and "MainWnd" not in it, s)
similar_size_window = filter(lambda x: find_similar_size_window(width, height, x.split()[5], x.split()[6]), fs)
ids = list(map(lambda item: item.split()[0], similar_size_window))
output.close()
for wid in ids:
print("kill id : ", wid)
os.system("xdotool windowunmap " + wid)
else:
print("wxwork not display yet.")