{"id":16342570,"url":"https://github.com/bianjp/popup-dict","last_synced_at":"2025-03-16T15:30:41.373Z","repository":{"id":57454187,"uuid":"114064121","full_name":"bianjp/popup-dict","owner":"bianjp","description":"Linux 下的划词翻译小工具","archived":false,"fork":false,"pushed_at":"2019-03-01T06:48:33.000Z","size":155,"stargazers_count":74,"open_issues_count":8,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-18T03:15:15.594Z","etag":null,"topics":["dict","gui","youdao"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bianjp.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-13T02:35:48.000Z","updated_at":"2024-07-12T06:13:21.000Z","dependencies_parsed_at":"2022-09-04T23:22:20.552Z","dependency_job_id":null,"html_url":"https://github.com/bianjp/popup-dict","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bianjp%2Fpopup-dict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bianjp%2Fpopup-dict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bianjp%2Fpopup-dict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bianjp%2Fpopup-dict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bianjp","download_url":"https://codeload.github.com/bianjp/popup-dict/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665169,"owners_count":16860186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dict","gui","youdao"],"created_at":"2024-10-11T00:02:54.725Z","updated_at":"2024-10-27T10:49:09.604Z","avatar_url":"https://github.com/bianjp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# popup-dict\n\nLinux 下的划词翻译工具，支持使用有道等多种翻译服务。\n\n使用 Python 3 + Gtk+ 3 编写，适用于 Gnome 桌面环境。\n\n![screenshots](./screenshots/popup.png)\n\n功能特点：\n\n* 目前只支持英文-\u003e中文翻译，支持单词和短语\n* 主要针对 Gnome 桌面环境，不保证其它环境下的正常使用\n* 鼠标划词翻译，弹窗显示\n* 智能处理选中内容（去除两端非英文字符、压缩空白字符、删除换行符等）\n* 弹窗显示一段时间后自动关闭。若鼠标在弹窗中，延迟关闭\n* 点击弹窗中链接可打开有道词典网页版\n\n本工具主要受 [@idning](https://github.com/idning/) 的 [youdao-dict-for-ubuntu](https://github.com/idning/youdao-dict-for-ubuntu/) 启发。\n\n## 依赖\n\n* Python 3.6+\n* Gtk+ 3\n* GStreamer\n* [PyGObject](https://pygobject.readthedocs.io/en/latest/)\n* Python packages:\n    * [psutil](https://github.com/giampaolo/psutil)\n    * [requests](https://github.com/requests/requests/)\n\n## 安装\n\n确保已安装 [PyGObject](https://pygobject.readthedocs.io/en/latest/getting_started.html)\n\n__PyPI:__\n\n```bash\nsudo pip install popupdict\n```\n\n## 运行\n\n```bash\npopup-dict\n\n# 查看帮助\npopup-dict -h\n```\n\n可使用 Gnome Shell Extension [popup-dict-switcher](https://github.com/bianjp/popup-dict-switcher) 一键打开/关闭 `popup-dict`\n\n## 配置\n\n应用默认加载以下位置中第一个存在的配置文件：\n\n* `~/.config/popup-dict/config.ini`\n* `/etc/popup-dict/config.ini`\n\n也可通过命令参数指定配置文件位置。\n\n__注意：有道智云 API 是付费的，请自行注册账号、创建应用并配置 app_id, app_secret。参考[官方文档](http://ai.youdao.com/doc.s#guide)__\n\n默认配置：\n\n```ini\n[global]\n# 弹窗显示时间。单位：秒；类型：float\npopup_timeout = 3\n# 是否使用 Gtk Global Dark Theme。不设置或设为空则使用系统默认设置。类型: boolean\nprefer_dark_theme =\n# 调试模式\ndebug = false\n# 缓存翻译结果和音频文件\ncache = true\n# 最大缓存条目数，仅针对单个查询客户端或发音下载器\nmax_cache_items = 1000\n\n# 查询客户端配置\n[query]\n# 查询客户端 id\nclient = youdao-zhiyun\n\n# 发音配置\n[speech]\n# 启用发音\nenabled = true\n# 自动播放\nauto_play = true\n# 发音客户端 id\nclient = youdao\n\n# 各查询客户端的默认配置，可在各客户端的配置中覆盖\n[query-client]\n# 请求超时时间。单位：秒；类型：float\nrequest_timeout = 3\n\n# 各发音下载器的默认配置\n[speech-client]\nrequest_timeout = 5\n\n\n##### 各查询客户端配置 ######\n\n# 有道词典网页版\n[query:youdao-web]\n\n# 有道智云\n# http://ai.youdao.com/doc.s#guide\n[query:youdao-zhiyun]\napp_id =\napp_secret =\n\n\n##### 各发音客户端配置 ######\n[speech:youdao]\n```\n\n## Todo\n\n* 实现有道词典网页版查询客户端\n* 根据选中文本位置而非鼠标位置定位弹窗（应对不用鼠标选中文本的情况；避免遮盖选中文本）\n* 支持 Wayland\n* 支持多显示器\n* 展示某些错误提示（比如 API 授权错误）\n* test\n* 进程退出时删除 pid 文件\n* 打包到 [AUR](https://aur.archlinux.org/)\n* 版本更新提示\n* 实现 status, start, stop, restart 命令\n* 解决偶现的弹窗中列表显示异常\n* 选中内容在连字符（\"-\"）处换行时，区分是一个单词被断开还是本来就包含连字符的合成词\n* 生词本\n\n## 类似工具\n\nGUI:\n\n* https://github.com/idning/youdao-dict-for-ubuntu/\n* https://github.com/FindHao/ciba\n* https://github.com/jiffies/GouYong\n\nConsole:\n\n* https://github.com/longcw/youdao\n* https://github.com/felixonmars/ydcv\n* https://github.com/farseerfc/ydcv-rs\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbianjp%2Fpopup-dict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbianjp%2Fpopup-dict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbianjp%2Fpopup-dict/lists"}