划词翻译软件
2019-01-10 13:43 JohnRain 阅读(272) 评论(0) 编辑 收藏 举报项目主页
https://github.com/bianjp/popup-dict/
安装:
sudo apt-get install popup-dict
绑定快捷键命令
#!/bin/sh
PS_KEYWORD=popup-dict
PS_KEYWORD0=python3
PROCESS=/usr/local/bin/popup-dict
case $1 in
start)
ps aux |grep -v grep | grep ${PS_KEYWORD} | grep ${PS_KEYWORD0} -q
if [ $? -ne 0 ]; then
${PROCESS} 2>&1 > /dev/null &
export DISPLAY=:0.0 && /usr/bin/notify-send -i accessories-dictionary "On" "popup-dict on"
fi
;;
stop)
for pid in `pidof ${PS_KEYWORD0}`;do
grep -q ${PS_KEYWORD} /proc/${pid}/cmdline
if [ $? -eq 0 ]; then
export DISPLAY=:0.0 && /usr/bin/notify-send -i accessories-dictionary "Off" "popup-dict off"
kill ${pid}
fi
done;
;;
switch)
ps aux |grep -v grep | grep ${PS_KEYWORD} | grep ${PS_KEYWORD0} -q
if [ $? -ne 0 ]; then
#if offline, turn it on
$0 start
else
#else online, turn it off
$0 stop
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
esac
exit 0
deepin 快捷键绑定有bug
快捷键配置文件: ~/.config/deepin/dde-daemon/keybinding/custom.ini
- 填写命令界面内设置快捷用复杂的快捷键,例如: ctrl+alt+shift+e, 保证一次性填完,不要修改,否则命令内容会消失
- 保存出到主界面后再修改快捷键
缺点
只能取词,不能整段翻译, 只有词库中的有的单词才会出现翻译框, 划无意义的字母组合不会有弹窗