├── .editorconfig ├── .gitattributes ├── .gitignore ├── .npmrc ├── .travis.yml ├── index.js ├── license ├── package.json └── readme.md /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.yml] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '12' 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const castKeys = require('macos-key-cast'); 3 | const hasPermissions = require('macos-accessibility-permissions'); 4 | 5 | const config = { 6 | size: { 7 | title: 'Size', 8 | description: 'Size of the UI.', 9 | type: 'string', 10 | enum: ['Small', 'Normal', 'Large'], 11 | default: 'Normal', 12 | required: true 13 | }, 14 | delay: { 15 | title: 'Delay', 16 | description: 'How long the UI stays on screen.', 17 | type: 'number', 18 | minimum: 0, 19 | default: 0.5, 20 | required: true 21 | }, 22 | keyCombinationsOnly: { 23 | title: 'Key Combinations Only', 24 | description: 'When enabled, the UI will only show for combinations with accelerators.', 25 | type: 'boolean', 26 | default: false 27 | }, 28 | centerInCropper: { 29 | title: 'Center in Cropper', 30 | description: 'When enabled, the UI will use the cropper area to position. Otherwise it will use the whole screen.', 31 | type: 'boolean', 32 | default: true 33 | } 34 | }; 35 | 36 | const willStartRecording = async ({state, config, apertureOptions: {screenId, cropArea}}) => { 37 | if (!hasPermissions({ask: true})) { 38 | return; 39 | } 40 | 41 | const {size, delay, keyCombinationsOnly, centerInCropper} = config.store; 42 | 43 | state.process = castKeys({ 44 | display: screenId, 45 | size: size.toLowerCase(), 46 | delay, 47 | keyCombinationsOnly, 48 | bounds: centerInCropper ? cropArea : undefined 49 | }); 50 | }; 51 | 52 | const didStopRecording = async ({state}) => { 53 | if (state.process) { 54 | state.process.cancel(); 55 | } 56 | }; 57 | 58 | const willEnable = () => { 59 | return hasPermissions({ask: true}); 60 | }; 61 | 62 | const keysPressed = { 63 | title: 'Show Pressed Keys', 64 | config, 65 | willStartRecording, 66 | didStopRecording, 67 | willEnable 68 | }; 69 | 70 | exports.recordServices = [keysPressed]; 71 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) George Karagkiaouris (https://gkaragkiaouris.tech) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kap-key-cast", 3 | "version": "1.1.5", 4 | "description": "Show keys pressed while recording in the final recording", 5 | "license": "MIT", 6 | "repository": "karaggeorge/kap-key-cast", 7 | "author": { 8 | "name": "George Karagkiaouris", 9 | "email": "gkaragkiaouris2@gmail.com", 10 | "url": "https://gkaragkiaouris.tech" 11 | }, 12 | "scripts": { 13 | "test": "xo" 14 | }, 15 | "files": [ 16 | "index.js" 17 | ], 18 | "keywords": [ 19 | "kap-plugin", 20 | "key", 21 | "cast", 22 | "log", 23 | "keyboard", 24 | "presses" 25 | ], 26 | "kapVersion": ">=3.2.0", 27 | "dependencies": { 28 | "macos-accessibility-permissions": "^1.0.1", 29 | "macos-key-cast": "^1.2.0" 30 | }, 31 | "devDependencies": { 32 | "ava": "^2.3.0", 33 | "kap-plugin-test": "^0.5.0", 34 | "xo": "^0.24.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # kap-key-cast [![Build Status](https://travis-ci.org/karaggeorge/kap-key-cast.svg?branch=master)](https://travis-ci.org/karaggeorge/kap-key-cast) 2 | 3 | > [Kap](https://github.com/wulkano/kap) plugin - Show keys pressed while recording in the final recording 4 | 5 | ## Install 6 | 7 | In the `Kap` menu, go to `Preferences…`, select the `Plugins` pane, find this plugin, and toggle it. 8 | 9 | ## Usage 10 | 11 | In the cropper or by right-clicking the tray icon, click the `…` icon, then `Plugins` and make sure `Show Pressed Keys` is enabled. 12 | --------------------------------------------------------------------------------