Skip to main content

Cheat-sheets for shortcuts & commands at your fingertips.

Project description

KeyHint

Utility to display keyboard shortcuts or other hints based on the active window on Linux. (GTK 4.6+ required!)


Tests passing License: MIT Code style: black Coverage Status

Keyhint Screenshot

Prerequisites

  • Python 3.11+
  • GTK 4.6+ (shipped since Ubuntu 22.04) + dev packages:
    sudo apt-get install \
       libgirepository1.0-dev \
       libcairo2-dev \
       python3-gi \
       gobject-introspection \
       libgtk-4-dev
    

Installation

  • pipx install keyhint (recommended, requires pipx)
  • or pip install keyhint

Usage

  • Configure a global hotkey (e.g. Ctrl + F1) via your system settings to launch keyhint.
  • If KeyHint is launched via hotkey, it detects the current active application and shows the appropriate hints.

CLI Options

Application Options:
  -c, --cheatsheet=SHEET-ID                 Show cheatsheet with this ID on startup
  -d, --default-cheatsheet=SHEET-ID         Cheatsheet to show in case no cheatsheet is found for active application
  -f, --no-fullscreen                       Launch window in normal window state instead of fullscreen mode
  -s, --no-section-sort                     Do not sort sections by size, keep order from config toml file
  -o, --orientation=horizontal|vertical     Orientation and scroll direction. Default: 'vertical'
  -v, --verbose                             Verbose log output for debugging

Configuration

  • The config directory is ~/.config/keyhint/.
  • To customize existing cheatsheets, copy the corresponding .toml-file into the config directory. Make your changes in a text editor. As long as you don't change the id it will overwrite the defaults.
  • To create new cheatsheets, I suggest you also start with one of the existing .toml-file:
    • Place it in the config directory and give it a good file name.
    • Change the value id to something unique.
    • Adjust regex_process and regex_title so it will be selected based on the active window. (See Tips)
    • Add the shortcuts & label to a section.
    • If you think your cheatsheet might be useful for others, please consider opening a pull request or an issue.
  • You can always reset a configuration to the shipped version by deleting the .toml files from the config folder.
  • You can include shortcuts from other cheatsheets add include = ["<Cheatsheet ID>"]
  • You can hide a cheatsheet by add hidden = true in the top block (same level as id and title).

Tips

Cheatsheet selection:

  • The cheatsheet to be displayed on startup are selected by comparing the value of regex_process with the wm_class of the active window and the value of regex_title with the title of the active window.
  • The potential cheatsheets are processed alphabetically by filename, the first file that matches both wm_class and title are getting displayed.
  • Both of regex_ values are interpreted as case in-sensitive regular expressions.
  • Check "Debug Info" in the application menu to get insights about the active window and the selected cheatsheet file.

Available cheatsheets:

  • Check the included toml-files to see which applications are available by default.
  • Feel free submit additional toml-files for further applications.

Differentiate cheatsheets per website:

  • For showing different browser-cheatsheets depending on the current website, you might want to use a browser extension like "Add URL To Window Title" and then configure the sections in <cheatsheet>.toml to look for the URL in the window title.

KeyHint's shortcuts:

  • Ctrl+F: Start filtering
  • Ctrl+S: Focus sheet selection dropdown (press Enter to open it)
  • Esc: Exit KeyHint
  • , , l or k: scroll forward
  • , , h or j: scroll backward
  • PageDown: scroll page forward
  • PageUP: scroll page backward

Contribute

I'm happy about any contribution! Especially I would appreciate submissions to improve the shipped cheatsheets. (The current set are the cheatsheets I personally use).

Design Principles

  • Don't run as service
    It shouldn't consume resources in the background, even if this leads to slower start-up time.
  • No network connection
    Everything should run locally without any network communication.
  • Dependencies
    The fewer dependencies, the better.
  • Multi-Monitors
    Supports setups with two or more displays

Certification

WOMM

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyhint-0.4.4.tar.gz (653.9 kB view details)

Uploaded Source

Built Distribution

keyhint-0.4.4-py3-none-any.whl (654.4 kB view details)

Uploaded Python 3

File details

Details for the file keyhint-0.4.4.tar.gz.

File metadata

  • Download URL: keyhint-0.4.4.tar.gz
  • Upload date:
  • Size: 653.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for keyhint-0.4.4.tar.gz
Algorithm Hash digest
SHA256 255b0c54c702ddf3918a9c26572f2eaa19791c6f2621df0db0362e60d48490e0
MD5 f6a320dcc65e25da45a41ea8508b87cf
BLAKE2b-256 6badfc3b1da15ccd96aebd51e4702c37ecd499258c40ac7540d42a670e54135b

See more details on using hashes here.

File details

Details for the file keyhint-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: keyhint-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 654.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for keyhint-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b2c885b721da1b59af7bf1c0db1bf06c0b3e618f5610c0628acf3e20eb6c1d5e
MD5 17b5283329463c142eab5feb364773fd
BLAKE2b-256 cafc7f5e4af0d77f3ca1ceef2cd02a8dd8371769e4fbe585457d6f3c8af5084e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page