zoukankan      html  css  js  c++  java
  • 划词翻译软件

    项目主页

    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, 保证一次性填完,不要修改,否则命令内容会消失

    • 保存出到主界面后再修改快捷键

    缺点

    只能取词,不能整段翻译, 只有词库中的有的单词才会出现翻译框, 划无意义的字母组合不会有弹窗

  • 相关阅读:
    Best Time to Buy and Sell Stock
    Remove Nth Node From End of List
    Unique Paths
    Swap Nodes in Pairs
    Convert Sorted Array to Binary Search Tree
    Populating Next Right Pointers in Each Node
    Maximum Subarray
    Climbing Stairs
    Unique Binary Search Trees
    Remove Duplicates from Sorted Array
  • 原文地址:https://www.cnblogs.com/JohnRain/p/10249537.html
Copyright © 2011-2022 走看看