Giter VIP home page Giter VIP logo

keyboard's Introduction

Keyboard

Build Status GitHub release License

Master of keyboard is master of automation.

Installation

$ brew cask install creasty/tools/keyboard

List of actions

+ denotes a key sequence in the 'super key' mode which is activated by pressing and holding the first letter with no modifier keys.

Window/space navigation

Key Description
S+H Move to left space
S+L Move to right space
S+J Switch to next application
S+K Switch to previous application
S+N Switch to next window
S+B Switch to previous window
S+M Mission control
Requirements

Open "System Preferences" and set the following shortcuts.

  • Mission Control > Move left a space Ctrl-LeftArrow
  • Mission Control > Move right a space Ctrl-RightArrow
  • Keyboard > Move focus to next window Cmd-F1
1 2

Window resizing/positioning

Key Description
S+D+F Full screen
S+D+H Left half
S+D+J Bottom half
S+D+K Top half
S+D+L Right half

Emacs mode

Key Description Shift allowed
Ctrl-C Escape NO
Ctrl-D Forward delete NO
Ctrl-H Backspace NO
Ctrl-J Enter NO
Ctrl-P ⬆️ YES
Ctrl-N ⬇️ YES
Ctrl-B ⬅️ YES
Ctrl-F ➡️ YES
Ctrl-A Beginning of line YES
Ctrl-E End of line YES

Word motions

Key Description
A+D Delete word after cursor
A+H Delete word before cursor
A+B Move cursor backward by word
A+F Move cursor forward by word

Mouse keys

Mouse button:

Key Description
C+M Left click
C+, Right click

Cursor pointer:

Key Description
Parallel movements (10px)
C+H ⬅️
C+J ⬇️
C+K ⬆️
C+L ➡️
Parallel movements (10%)
C+S+H ⬅️
C+S+J ⬇️
C+S+K ⬆️
C+S+L ➡️
Diagonal movements (10px)
C+H+J
C+J+L
C+K+L
C+H+K ↖️
Diagonal movements (10%)
C+S+H+J
C+S+J+L
C+S+K+L
C+S+H+K ↖️
Quick jump actions (Highlight enabled)
C+Y Top-left corner
C+U Bottom-left corner
C+I Top-right corner
C+O Bottom-right corner
C+U+I Center of screen

Scroll:

Key Description
C+X+H ⬅️
C+X+J ⬇️
C+X+K ⬆️
C+X+L ➡️

Highlight:

Key Description
C+Space Highlight the location of the mouse pointer

Switch input source

Key Description
Ctrl-; Selects next source in the input menu

Switch input source with Escape key

Change the input source to English as you leave 'insert mode' in Vim with Escape key so it can prevent IME from capturing key strokes in 'normal mode'.

Key Description
Ctrl-C Invokes EISUU, Ctrl-C
Escape Invokes EISUU, Escape

Switch between apps

Key App Bundle ID URL
;+F Finder com.apple.finder N/A
;+M Alacritty io.alacritty https://github.com/jwilm/alacritty
;+T Things com.culturedcode.ThingsMac https://culturedcode.com/things
;+N Bear net.shinyfrog.bear https://bear.app

Fool-safe "Quit Application"

Prevents Cmd-Q from quiting applications.

Key Description
Cmd-Q No-op
Cmd-Q, Cmd-Q Invokes Cmd-Q. Quits application

keyboard's People

Contributors

creasty 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

Watchers

 avatar  avatar  avatar  avatar

keyboard's Issues

Capture Magic Mouse tap gestures

Hi and thanks for open sourcing this awesome tool!

Question: Is it possible to capture Magic Mouse tap gestures (e.g. to simulate tap-to-click)? I´ve tried adding a "print(action)" on line 39 on EventManager.swift, and it seems only keyboard actions trigger anything to the output terminal. Please advise.

Thanks again and best regards.

Sensitivity issue with compound-prefix super keys

Why

S+D+H is handled as prefix: S, keys: {D, H}. Therefore, the order of key events should be either S>D>H or S>H>D. Other inputs like D>S>H will not activate the super key.

Since S and D adjacent to each other in a qwerty layout and are usually typed in with the same side of hands, it’s slightly difficult to hit these keys in a correct order.

What

Register both S and D as a prefix and accept D+S+ as well as S+D+

curious about `passRetained` in event tap callback

func handle(proxy: CGEventTapProxy, cgEvent: CGEvent) -> Unmanaged<CGEvent>? {

quite noob to macOS development here. been through some coding and loads of documentation in the past few weeks, and i don't get why passRetained is used in your event tap callback rather than passUnretained. i'm pretty sure you're correct, but i can't reason why. from the doc (https://developer.apple.com/documentation/coregraphics/cgeventtapcallback#) it appears the event is owned by the caller. if you modify it, wouldn't you pass it without retaining it? if you use passRetained, then when do you release it?

[WIP] Rebuilding the app revokes Accessibility permission

Why

Rebuilding the app does change the signature, and therefore needs to be trusted again.

What

Don't wanna manually trust the app each time.
I'd like to automate the process in development.

  • ~/Library/Application Support/com.apple.TCC/TCC.db — no affect
  • /Library/Application Support/com.apple.TCC/TCC.db — no permission to write to

↓ DOESN'T WORK!!

#!/usr/bin/env bash

set -eu
set -o pipefail

BUNDLE_ID='com.creasty.keyboard-dev'

DB="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
DB="/Library/Application Support/com.apple.TCC/TCC.db"

# CREATE TABLE IF NOT EXISTS "access" (
#   service                         TEXT        NOT NULL,
#   client                          TEXT        NOT NULL,
#   client_type                     INTEGER     NOT NULL,
#   allowed                         INTEGER     NOT NULL,
#   prompt_count                    INTEGER     NOT NULL,
#   csreq                           BLOB,
#   policy_id                       INTEGER,
#   indirect_object_identifier_type INTEGER,
#   indirect_object_identifier      TEXT DEFAULT 'UNUSED',
#   indirect_object_code_identity   BLOB,
#   flags                           INTEGER,
#   last_modified                   INTEGER     NOT NULL DEFAULT (CAST(strftime('%s', 'now') AS INTEGER)),
#   PRIMARY                         KEY (service, client, client_type, indirect_object_identifier),
#   FOREIGN KEY (policy_id) REFERENCES policies(id) ON DELETE CASCADE ON UPDATE CASCADE
# );

sqlite3 "$DB" '.schema access'
sqlite3 "$DB" -header -column "select * from access where client = '$BUNDLE_ID';"

cat << SQL | sqlite3 "$DB"
insert or replace into access(
  service,
  client,
  client_type,
  allowed,
  prompt_count,
  csreq,
  policy_id,
  indirect_object_identifier_type,
  indirect_object_identifier,
  indirect_object_code_identity,
  flags,
  last_modified
) values (
  'kTCCServicePostEvent',                -- service,
  '$BUNDLE_ID',                          -- client,
  0,                                     -- client_type,
  1,                                     -- allowed,
  1,                                     -- prompt_count,
  NULL,                                  -- csreq,
  NULL,                                  -- policy_id,
  NULL,                                  -- indirect_object_identifier_type,
  'UNUSED',                              -- indirect_object_identifier,
  NULL,                                  -- indirect_object_code_identity,
  0,                                     -- flags,
  cast(strftime('%s', 'now') as integer) -- last_modified
), (
  'kTCCServiceAccessibility',            -- service,
  '$BUNDLE_ID',                          -- client,
  0,                                     -- client_type,
  1,                                     -- allowed,
  1,                                     -- prompt_count,
  NULL,                                  -- csreq,
  NULL,                                  -- policy_id,
  NULL,                                  -- indirect_object_identifier_type,
  'UNUSED',                              -- indirect_object_identifier,
  NULL,                                  -- indirect_object_code_identity,
  0,                                     -- flags,
  cast(strftime('%s', 'now') as integer) -- last_modified
);
SQL

sqlite3 "$DB" -header -column "select * from access where client = '$BUNDLE_ID';"

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.