├── .gitignore ├── .gitmodules ├── Halo Word.alfredworkflow ├── HaloWord.popclipext ├── haloword.png └── Config.plist ├── README.md ├── package.json ├── LICENSE └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | build/ 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "haloword"] 2 | path = haloword 3 | url = git@github.com:HaloWordApp/haloword.git 4 | -------------------------------------------------------------------------------- /Halo Word.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaloWordApp/haloword-desktop/HEAD/Halo Word.alfredworkflow -------------------------------------------------------------------------------- /HaloWord.popclipext/haloword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaloWordApp/haloword-desktop/HEAD/HaloWord.popclipext/haloword.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Halo Word Desktop 2 | 3 | ## URL Scheme Spec 4 | 5 | `haloword://query` 6 | 7 | ### Arguments 8 | 9 | - word: the word is querying. 10 | 11 | ### Example 12 | 13 | ``` 14 | haloword://query?word=tachyon 15 | ``` 16 | -------------------------------------------------------------------------------- /HaloWord.popclipext/Config.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Actions 6 | 7 | 8 | URL 9 | haloword://lookup?word={popclip text} 10 | Image File 11 | haloword.png 12 | Title 13 | Halo Word 14 | Regular Expression 15 | \w+ 16 | 17 | 18 | Extension Description 19 | Search a word using Halo Word. 20 | Extension Identifier 21 | is.zr.popclip.haloword 22 | Extension Name 23 | Halo Word 24 | Required Software Version 25 | 701 26 | 27 | 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HaloWord", 3 | "productName": "Halo Word", 4 | "description": "Halo Word Desktop", 5 | "homepage": "https://github.com/HaloWordApp/haloword-desktop", 6 | "version": "0.1.0", 7 | "license": "MIT", 8 | "main": "main.js", 9 | "build": { 10 | "appId": "halo-word", 11 | "protocols": { 12 | "name": "Halo Word URL Scheme", 13 | "schemes": [ 14 | "haloword" 15 | ] 16 | } 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git@github.com:HaloWordApp/haloword-desktop.git" 21 | }, 22 | "electronVersion": "1.6.2", 23 | "devDependencies": { 24 | "appdmg-tf": "^0.4.9", 25 | "electron": "^1.6.2", 26 | "electron-builder": "^7.26.0" 27 | }, 28 | "author": { 29 | "name": "Halo Word App", 30 | "url": "https://github.com/HaloWordApp", 31 | "email": "fanzeyi1994+halo@gmail.com" 32 | }, 33 | "contributors": { 34 | "name": "Zeyi Fan", 35 | "email": "fanzeyi1994@gmail.com", 36 | "url": "https://zr.is/" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2016 LIU Dongyuan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow, Menu, dialog} = require('electron'); 2 | const url = require('url'); 3 | 4 | let win = null; 5 | let word = ""; 6 | let isReady = false; 7 | 8 | function createWindow () { 9 | isReady = true; 10 | 11 | win = new BrowserWindow({ 12 | width: 800, 13 | height: 600, 14 | minWidth: 600, 15 | minHeight: 450 16 | }); 17 | 18 | win.loadURL(`file://${__dirname}/haloword/main.html#${word}`); 19 | 20 | word = ""; 21 | 22 | win.on('closed', () => { 23 | win = null 24 | }); 25 | 26 | // menu 27 | var menuTemplate = [ 28 | { 29 | label: "Halo Word", 30 | submenu: [ 31 | { 32 | label: "About Halo Word", 33 | selector: "orderFrontStandardAboutPanel:" 34 | }, 35 | { 36 | type: "separator" 37 | }, 38 | { 39 | label: "Quit", 40 | accelerator: "Command+Q", 41 | click: () => { 42 | app.quit(); 43 | } 44 | } 45 | ] 46 | }, 47 | { 48 | label: "Edit", 49 | submenu: [ 50 | { 51 | label: "Undo", 52 | accelerator: "CmdOrCtrl+Z", 53 | selector: "undo:" 54 | }, 55 | { 56 | label: "Redo", 57 | accelerator: "Shift+CmdOrCtrl+Z", 58 | selector: "redo:" 59 | }, 60 | { 61 | type: "separator" 62 | }, 63 | { 64 | label: "Cut", 65 | accelerator: "CmdOrCtrl+X", 66 | selector: "cut:" 67 | }, 68 | { 69 | label: "Copy", 70 | accelerator: "CmdOrCtrl+C", 71 | selector: "copy:" 72 | }, 73 | { 74 | label: "Paste", 75 | accelerator: "CmdOrCtrl+V", 76 | selector: "paste:" 77 | }, 78 | { 79 | label: "Select All", 80 | accelerator: "CmdOrCtrl+A", 81 | selector: "selectAll:" 82 | } 83 | ] 84 | } 85 | ]; 86 | 87 | if (process.platform !== 'darwin') { 88 | // need investigate other platform 89 | // TODO: window, help, services menu on macOS 90 | menuTemplate.shift() 91 | } else { 92 | menuTemplate.push({ 93 | role: 'window', 94 | submenu: [ 95 | { 96 | role: 'minimize' 97 | }, 98 | { 99 | role: 'close' 100 | } 101 | ] 102 | }); 103 | } 104 | 105 | Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate)); 106 | } 107 | 108 | app.on('ready', createWindow); 109 | 110 | app.on('window-all-closed', () => { 111 | if (process.platform !== 'darwin') { 112 | app.quit(); 113 | } 114 | }); 115 | 116 | app.on('activate', () => { 117 | if (win === null) { 118 | createWindow(); 119 | } 120 | }); 121 | 122 | function lookupWord(w) { 123 | if (win === null) { 124 | word = w; 125 | 126 | if (isReady) { 127 | createWindow(); 128 | } 129 | 130 | } else { 131 | win.webContents.executeJavaScript(`window.location.hash = "#${w}"`); 132 | } 133 | } 134 | 135 | app.setAsDefaultProtocolClient('haloword') 136 | 137 | app.on('open-url', (event, u) => { 138 | const parsed = url.parse(u, true); 139 | 140 | if (parsed.query["word"] !== undefined) { 141 | lookupWord(parsed.query["word"]) 142 | } 143 | 144 | event.preventDefault(); 145 | }); 146 | --------------------------------------------------------------------------------