asmvik / asmvik/skhd

Add command to list possible hotkeys for current mode

Open
#130 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
8.1k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

Given the following skhdrc:

```sh
a : echo "do this"

:: mymode
ctrl - m ; mymode
mymode < a : echo "in mymode – do this"
mymode < b : echo "in mymode – do that"
```

I'd like to be able to perform something like the following commands:

```sh
# in default mode
# `--show-options` is a new command which prints the possible hotkeys for the current state of skhd.
$ skhd --show-options
a : echo "do this"

# user presses `ctrl - m` and enters `mymode`
$ skhd --show-options
mymode < a : echo "in mymode – do this"
mymode < b : echo "in mymode – do that"
```

Let me know if the behavior is not clear and I can try to explain more.

I'm looking for this kind of command to help me write a GUI helper that shows me what commands I can invoke. I could write this as a separate application, but it seems like I would need to maintain a separate parser, and I would need to be able to track skhd's active mode to return only the relevant results.

I think my ideal output for this command would be JSON corresponding to the [`hotkey` struct](https://github.com/koekeishiya/skhd/blob/311328d8bfd001c57e135b1fda6267ea1b68df99/src/hotkey.h#L71) to avoid needing any further parsing.

Is this something you would want in skhd? I don't have a lot of C experience, so I thought I would ask before taking time to dive in.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the requested --show-options command and inspect the hotkey struct in src/hotkey.h. Trace how skhd represents the current mode and parses the skhdrc example, then determine how output should expose only active hotkeys, ideally as JSON. Done means the command reports the relevant hotkeys in default and mymode states without requiring a separate parser.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.