Nattily Polished Marbles
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


0.0.37 • Public • Published

A tool like Alfred on Mac

This is a core library,NOT a client with user interface, Here is a GUI program,Here is a CLI program


This project is still building, and it was tested only under Ubuntu 16.04


  • Windows management
  • System utils
  • Process management
  • Launch applications (by name)
  • Extendible
  • Alias
  • Pipe
  • Namespace


How does it work

Big Picture

User gives a input to copilot ,copilot gives a list (called IResult list) back to user, then user select an item from the list to execute a action related to this item.

If ignore how user interactive with copilot,it's GUI's business,let's use user> and copilot> to represent the communication between user and copilot

For example:

user> a google
1. google chrome
2. google earth
user> exec 1
copilot> Active google chrome

Translate it to humans' language:

User: Active a window which has a title looks like google
Copilot: Fine, there are too windows that looks satisfied your requirement.Here there are.
User: OK, active the first.


a is an alias that means active


A function which takes option and IResult list to generate a new IResult list


A mechanism to do something ,such as copy, run cmd and so on, according to an IResult item


Copilot puts a processor's output to the next processors's input to make processors work together.

For example:

buildin.apps.list | buildin.filter.grep -i chrome | buildin.apps.launch

processor buildin.apps.list generates a list of application installed in system,it is an IResult list, and buildin.filter.grep -i filter all matched items out, the last one add launch action to items.

  buildin.apps.list's output      buildin.filter.grep's output   buildin.apps.launch's output
(buildin.filter.grep's input)    (buildin.apps.launch's input)

  +----------------------+           +-------------------+        +-------------------------+
  | google chrome        |           | google chrome     |        | Active google chrome    |
  | firefox              |           | google earth      |        | Active google earth     |
  +----------------------+           +-------------------+        +-------------------------+
  | leafpad              |
  | google earth         |


Of cause it is to long to type in order to make chrome run. So I added an useful feature to copilot that is alias An alias of run a matched application

run: buildin.apps.list | buildin.filter.grep -i __arg__ | buildin.apps.launch


Some processors are dependent on some external command,if those command are missing processors will give hint text on it's output IResult

User Interface

Here is an javafx GUI

A CLI user interface is coming.



name description
buildin.apps.list list all applications
buildin.apps.launch add run to app items
buildin.dict.iciba A dictionary
buildin.dict.oxford oxford dictionary Open a file
buildin.filter.grep filter by regexp use fuse.js search
buildin.process.list list all process
buildin.process.kill kill process
buildin.sys.suspend Suspend system
buildin.sys.reboot Reboot system
buildin.sys.wifi toggle WiFi on/off
buildin.sys.ip list ip address
buildin.tldr.list list cmds ,integrate tldr show short usage info output first n items output last n items count show time convert cmd arguments to IResult A math express calculator Cmd to IResult To do something after specified time out Send a notification change IResult's field to copy Excutate cmd by shell list all windows active window close window move window* Chrome intergration

oxford dict

oxford API has a limitation related to query times per month. You'd better to register a new account to get a key to replace to default one. Oxford link

External processor

There are two types external processor at the moment,they are js processor and script processor. The js processor are written by javascript and it has the same structure of internal processor and it can use the internal services of cause. The script processor are executable scripts which output data in yaml format. Copilot put arguments to script's cmd line argument and put IResult items to script's stdin stream.

The config section external.processor tells copilot where to find external processor.

      - ~/.config/copilot/processors/js
      - ~/.config/copilot/processors/script

For example: For the below dir structure:

    -- hello.js
    -- demo.js
    -- config.yaml
  -- foo
    -- bar.js
    -- config.yaml

Copilot will try to load js processors from qianba/*.js and script processors from qianba/*.hello and it will also read all those config.yaml. The differences is that each .js many contains many processors but each script processor file just contains only one processor.

name prefix

  • js.[dir].[file].[function] for js processors (js.qianba.hello.hello)
  • spt.[dir].[file] for script processors (spt.qianba.hello)


Only processors and processorsInfo sections are approved in config.yaml on external processor dirs

Todo list

  • Ding integration
  • Notification framework
  • Improve app launch
  • Improve processor name match




npm i copilot-core

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability