Code Monkey home page Code Monkey logo

mah's Introduction

** No longer maintained(这个项目不再维护了) **

Mah

Mah is an alternative to alfred,written in java.The project is currently under development.

Plugins

Search

<plugs>
        <name>Search</name>
</plugs>
<plug name="Search">
        <command name="GoogleSearchCommand">
            <trigger key="g" />
        </command>
</plug>

suggestion

Auto suggestion

<plugs>
        <name>AutoSuggestion</name>
</plugs>

suggestion

KeyRecorder plugin

KeyRecorder will record all key strokes with modifier such as Control+c,helping you find out those key strokes pressed most.

<plugs>
        <name>KeyRecorder</name>
</plugs>
<plug name="KeyRecorder">
    <command name="TopKeystroke">
        <trigger key="tk" />
    </command>
</plug>

github plugin

Translation plugin

First,you need to apply api pair http://fanyi.youdao.com/openapi?path=data-mode

<plugs>
        <name>translation</name>
</plugs>
<plug name="translation">
    <command name="Translation">
        <trigger key="fy" />
        <config>
            <keyfrom>{keyfrom}</keyfrom>
            <apikey>{apkey}</apikey>
        </config>
    </command>
</plug>

translation plugin

Weather plugin

<plugs>
        <name>weather</name>
</plugs>
<plug name="weather">
    <command name="QueryWeather">
        <trigger key="we" />
        <config>
            <defaultCity>beijing</defaultCity>
        </config>
    </command>
</plug>

weather plugin

github plugin

First, go to https://github.com/settings/tokens to generate a token

<plugs>
        <name>github</name>
</plugs>
<plug name="github">
    <mode name="github_mode" parent="item_mode">
        <keybind bind="M-i" action="GoGithubIssues" />
        <keybind bind="M-c" action="ClearCache" />
    </mode>
    <command name="GithubStarredList">
        <trigger key="gs" />
        <config>
            <username>{your github usename}</username>
            <!-- 2 minutes -->
            <updateRate>2</updateRate>
            <token>{your token}</token>
            <postCommand></postCommand>
        </config>
    </command>
</plug>

github plugin

More plugins

Java libraries are so powerful that it is easy to develop a plugin.

Features

Asynchronous

For example,it will take long time to synchronize github repositories you starred; you can execute other actions like translation while synchronizing.

Better keybind

You can bind as many actions as you want.There are many useful actions in Mah. The mode (input_mode) provides a action named ClearQueryText,which is used to clear text prior to command.Try to imagine that you have translated a long sentence and want to translate another sentence or word,you need to clear input and input command again.Thanks to this action,you don't need to do so.

Configurable

Configuration is the one of important features,you can configure keybind,plugin,and so on.To configure keybind,you should know what is Mode.Mode is a collection of keybinds,allowing same keybind to execute different actions.For instance,TranslationCommand will trigger translation_mode,in which CopyWord and CopyExplains actions are defined;then you can press alt+w (i defined,you can configure it freely in conf.xml) to execute CopyWord action;as a result,translated word will be copied.

Plugin support

Mah is totally based on plugin.Thinks to java ecosystem,you can develop a plugin with powerful abilities.

Getting Started

Installation

Mah doesn't provide any binary package for user as there are some efforts to do this.So to use Mah,you must compile it yourself;it is not a big deal,only tough thing is to install jdk8.Once installed,the rest is easy.

git clone https://github.com/zgqq/mah && cd mah 
./install

Configuration

Open /{home}/.config/mah/conf.xml with editor,you will see
   
     <?xml version="1.0" encoding="UTF-8"?>
      <config>
       <global>
           <globalKeybind listen="M-space" action="FocusWindow" />
       </global>
       <mode name="system_mode">
           <keybind bind="C-x C-c" action="ExitSystem" />
       </mode>
       <mode name="window_mode">
           <keybind bind="C-g" action="HideWindow" />
           <keybind bind="M-h" action="MoveWindowToLeft" />
           <keybind bind="M-l" action="MoveWindowToRight" />
           <keybind bind="M-c" action="MoveWindowToCenter" />
       </mode>
       <mode name="input_mode">
           <keybind bind="C-r" action="Redo" />
           <keybind bind="C-/" action="Undo" />
           <!-- line -->
           <keybind bind="C-a" action="BeginningOfLine" />
           <keybind bind="C-e" action="EndOfLine" />
           <keybind bind="C-u" action="KillWholeLine" />
           <keybind bind="C-k" action="KillLine" />
           <!-- char -->
           <keybind bind="backspace" action="BackwardDeleteChar" />
           <keybind bind="C-h" action="BackwardDeleteChar" />
           <keybind bind="C-d" action="DeleteChar" />
           <keybind bind="C-f" action="ForwardChar" />
           <keybind bind="C-b" action="BackwardChar" />
           <!-- word -->
           <keybind bind="C-backspace" action="BackwardKillWord" />
           <keybind bind="M-f" action="ForwardWord" />
           <keybind bind="M-b" action="BackwardWord" />
           <keybind bind="M-d" action="KillWord" />
       </mode>
       <mode name="item_mode">
               <!-- item -->
               <keybind bind="C-n" action="NextItem" />
               <keybind bind="C-p" action="PreviousItem" />
               <keybind bind="Enter" action="DefaultSelectItem" />
               <keybind bind="M-1" action="SelectItem1" />
               <keybind bind="M-2" action="SelectItem2" />
               <keybind bind="M-3" action="SelectItem3" />
               <keybind bind="M-4" action="SelectItem4" />
               <keybind bind="M-5" action="SelectItem5" />
               <keybind bind="M-6" action="SelectItem6" />
               <keybind bind="M-7" action="SelectItem7" />
               <keybind bind="M-8" action="SelectItem8" />
               <keybind bind="M-9" action="SelectItem9" />
       </mode>
       <theme>dark</theme>
    </config>

Above is most basic configuration,mah will generate it automatically,you can modify it freely. Note that you must tell mah if you change key location using tool like xmodmap

<config>
    <modifier name="Caplock" as="LControl" />
    <modifier name="LControl" as="Caplock" />
</config>

Configuration example

conf.xml

mah's People

Contributors

zgqq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mah's Issues

Plugin doesn't work.

Problem

I cloned the latest version and installed it, but it seems can't work normally like the gif.

2017-03-13 11 21 04

The input method can't work properly either.

Environment

Java 8
OS X 10.12.3

Or should I put the plug config into ~/.config/mah/conf.xml?
If there is a document or user guide, maybe it will be better.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.