GithubHelp home page GithubHelp logo

surajt6 / ki Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andweeb/ki

0.0 0.0 0.0 947 KB

⌘ Work in macOS like you work in vim

License: MIT License

Shell 1.69% Lua 91.84% AppleScript 4.83% CSS 0.51% Makefile 0.75% HTML 0.39%

ki's Introduction

Ki

Build Status codecov

A proof of concept to apply the "Zen" of vi to desktop automation.

What's that?

Ki introduces a novel approach to automating macOS. Inspired by the vi text editor, Ki enables modal hotkeys to execute desktop tasks to determine whether it can be effective in a desktop environment.

The default state of macOS could be considered to be in desktop mode. Ki binds a Command Escape ⌘⎋ hotkey that transitions to normal mode, in which an extensive set of command chains can be initiated.

To view all Ki shortcuts, a cheatsheet modal can be activated with ⌘⎋⌘e?. To see all shortcuts for actions that an entity implements, an entity-specific cheatsheet modal can be activated with ⌘⎋⌘a?(entity hotkey).

Click to view example workflows and their modal keybindings with accompanying descriptions.

We can use entity, action, and select mode to achieve various common tasks from desktop mode:

Intent Keybindings Translation
Launch or focus Safari ⌘⎋⌘es ⌘⎋ enter normal mode
⌘e enter entity mode
s target the Safari application
Toggle media in frontmost Safari window ⌘⎋⌘aSpaces ⌘⎋ enter normal mode
⌘a enter action mode
Space toggle media
s target the Safari application
Focus the third Safari tab ⌘⎋⌘ss⌘3 ⌘⎋ enter normal mode
⌘s enter select mode
s target the Safari application
⌘3 target the third tab

With those semantics in mind, we can intuit other "sentences" if we know other entities g, ⇧s, and m:

Intent Keybindings Translation
Launch or focus Google Chrome ⌘⎋⌘eg ⌘⎋ enter normal mode
⌘e enter entity mode
g target the Google Chrome application
Toggle current song in Spotify ⌘⎋⌘aSpace⇧s ⌘⎋ enter normal mode
⌘a enter action mode
Space toggle current song
⇧s target the Spotify application
Focus the third Messages conversation ⌘⎋⌘sm⌘3 ⌘⎋ enter normal mode
⌘s enter select mode
m target the Messages application
⌘3 target the third conversation from the top

Combinations of the different modes can lead to even more complex workflows!

Intent Keybindings Translation
Toggle media in the fourth Chrome tab ⌘⎋⌘aSpace⌘sg⌘4 ⌘⎋ enter normal mode
⌘a enter action mode
Space toggle media
⌘s enter select mode
g target Google Chrome
⌘4 target the fourth tab
Close the second Safari tab ⌘⎋⌘aw⌘ss⌘2 ⌘⎋ enter normal mode
⌘a enter action mode
w close tab
⌘s enter select mode
s target the Safari application
⌘2 target the second tab

Ki has an ambitious goal of full automative coverage and already comes shipped with default hotkeys and actions for all native macOS applications. A number of other modes (file, url, etc.) are available for automating other aspects of macOS, and can be found in the Ki cheatsheet: ⌘⎋⌘e?.

Installation

Install Hammerspoon and extract Ki.spoon.zip to ~/.hammerspoon/Spoons.

Usage and Configuration

Load, configure, and start the plugin in ~/.hammerspoon/init.lua:

hs.loadSpoon('Ki')                 -- initialize the plugin
spoon.Ki.workflowEvents = {...}    -- configure `spoon.Ki` here
spoon.Ki:start()                   -- enable keyboard shortcuts

Nearly everything in Ki is customizable! API documentation can be found here and usage examples here.

Development

# Setup
# Requires `luarocks` and `pip`
make deps      # install local luarocks dependencies necessary for Ki
make dev-deps  # install global luarocks dev dependencies and pip requirements for the docs generator

# Development
# The target names below can be prefixed with `watch-` to monitor for file changes using `fswatch`
make docs      # generate source documentation
make lint      # run linter on source and spec files
make test      # run busted unit tests and generate coverage files
make dev       # build and symlink the Ki spoon to the system spoons directory for quick development
make           # build and create a spoon zip file in the `dist` folder

ki's People

Contributors

andweeb avatar jokajak avatar gb714us avatar

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.