唤醒后台WeChat方案
metahy opened this issue · comments
扒了一遍 /opt/deepinwine/tools/sendkeys.sh
, 这个脚本里写的非常臃肿且低效,还有一些语法问题,通过这个脚本来唤醒WeChat可以通过这个命令:
/opt/deepinwine/tools/sendkeys.sh w wechat 4
但是执行时可以看到有非常多的 warning log, 其实这个脚本的最终目的是执行这个命令:
env WINEPREDLL=/opt/apps/com.qq.weixin.deepin/files/dlls WINEDLLPATH=/opt/deepin-wine6-stable/lib:/opt/deepin-wine6-stable/lib64 WINEPREFIX=/home/hyleon/.deepinwine/Deepin-WeChat deepin-wine6-stable /opt/deepinwine/tools/sendkeys.exe w
我的方案:
1. 新建脚本文件
/home/{your_name}/scripts/weakup_wechat.sh
#!/usr/bin/env bash
env WINEPREDLL=/opt/apps/com.qq.weixin.deepin/files/dlls WINEDLLPATH=/opt/deepin-wine6-stable/lib:/opt/deepin-wine6-stable/lib64 WINEPREFIX=/home/hyleon/.deepinwine/Deepin-WeChat deepin-wine6-stable /opt/deepinwine/tools/sendkeys.exe w
(其实这个命令可以精简,env 里并不需要给出那么多,只执行
env WINEPREFIX=/home/hyleon/.deepinwine/Deepin-WeChat deepin-wine6-stable /opt/deepinwine/tools/sendkeys.exe w
效果是一样的)
2. 添加执行权限
chmod +x /home/{your_name}/scripts/weakup_wechat.sh
3. 映射快捷键
具体的 DE or WM 配置方法不同,我使用的是 BSPWM + sxhkd, 所以以 sxhkd 配置快捷键为例:
/home/{your_name}/.config/sxhkd/sxhkdrc
# WeChat
ctrl + alt + w
/home/{your_name}/scripts/weakup_wechat.sh
然后就可以通过你配置的快捷键(如我配置的是 Ctrl + Alt + w
)来唤醒 WeChat 了
(注:配置好快捷键后,根据不用的 DE or WM, 可能需要一些额外的操作来使配置生效,如 sxhkd 可以通过 super + Escape
来 kill 掉 sxhkd 进程来使配置生效)