-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are the keybindings configurable? #13
Comments
Hi! I do agree that having something like a configuration file for keybindings and layout settings and such would be more ideal, unfortunately I don't have time to add major features to this timer at the moment. So right now the only way to do this is to tweak the code. You'd need to change this function. For example, in the Idle state, if you wanted to change the keybindings from "q to quit, j or space to start" to "left shift to start, right alt to quit", you'd go from this: | Idle -> (
match key_str with
| "space" | "j" -> {
timer with
state = Timing ([||], t)
}
| "q" -> raise Stdlib.Exit
| _ -> timer
) to this: | Idle -> (
match key_str with
| "shift" -> {
timer with
state = Timing ([||], t)
}
| "alt_r" -> raise Stdlib.Exit
| _ -> timer
) So the keys for left shift, left alt etc are "shift", "alt", "ctrl", and for the right-side equivalents, they are "shift_r", "alt_r", "ctrl_r". You'd have to make similar changes for the rest of the code block I linked in the previous reply. Afterwards, you can just compile and install Flitter like normal. You can also use this script to discover which keycodes to use: import time
import sys
from pynput import keyboard
def on_press(key):
try:
t = time.time()
try:
# Alphanumeric key pressed
print('{} {}'.format(t, key.char), flush=True)
except AttributeError:
# Special key pressed
key_name = str(key)[4:] # Strip "Key."
print('{} {}'.format(t, key_name), flush=True)
except:
sys.exit(0)
# Collect events until released
with keyboard.Listener(on_press=on_press) as listener:
try:
while True:
t = time.time()
print('{} heartbeat'.format(t))
time.sleep(1)
except:
sys.exit(0)
listener.join() |
That was sufficient for me, thanks. Unfortunately most special keys are recognized as |
Interesting, I tried myself and it seems that media keys are not recognized by this library. Thanks for pointing that out. I'll leave this issue open as it's something that ideally should be fixed at some point. |
Heya alexozer, i had an idea: what about using JSON or XML as a configuration file? I'm not a OCaml programmer, but i think that, if it's possible to implement, it would be a lot easier to tweak keybindings. |
I love (and need) the global hotkeys, but the specific keys used will never work for everyone. Are they configurable?
The text was updated successfully, but these errors were encountered: