0.0.37 • Published 7 years ago

copilot-core v0.0.37

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

NOTE

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

FEATURE

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

TOC

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
copilot>
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.

NOTE

a is an alias that means active

Processor

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

Action

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

Pipe

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         |
  +----------------------+

Alias

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

Dependencies

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.

Processors

list

namedescription
buildin.apps.listlist all applications
buildin.apps.launchadd run to app items
buildin.dict.icibaA dictionary
buildin.dict.oxfordoxford dictionary
buildin.file.openOpen a file
buildin.filter.grepfilter by regexp
buildin.filter.searchuse fuse.js search
buildin.process.listlist all process
buildin.process.killkill process
buildin.sys.suspendSuspend system
buildin.sys.rebootReboot system
buildin.sys.wifitoggle WiFi on/off
buildin.sys.iplist ip address
buildin.tldr.listlist cmds ,integrate tldr
buildin.tldr.showshow short usage info
buildin.tools.headoutput first n items
buildin.tools.tailoutput last n items
buildin.tools.countcount
buildin.tools.nowshow time
buildin.tools.toPipeconvert cmd arguments to IResult
buildin.tools.calcA math express calculator
buildin.tools.echoCmd to IResult
buildin.tools.timeoutTo do something after specified time out
buildin.tools.notifySend a notification
buildin.tools.copychange IResult's field to copy
buildin.tools.cmdExcutate cmd by shell
buildin.win.listlist all windows
buildin.win.activeactive window
buildin.win.closeclose window
buildin.win.movemove window
buildin.chrome.*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.

external.processor:
  js:
    path:
      - ~/.config/copilot/processors/js
  script:
    path:
      - ~/.config/copilot/processors/script

For example: For the below dir structure:

js
  --qianba
    -- hello.js
    -- demo.js
    -- config.yaml
  -- foo
    -- bar.js
script
  --qianba
    -- hello.sh
    -- 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)

NOTE

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
0.0.37

7 years ago

0.0.36

7 years ago

0.0.34

7 years ago

0.0.33

7 years ago

0.0.32

7 years ago

0.0.31

7 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.22

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago