ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.06k stars 64 forks source link

What is Rune[key] and how to add custom shortcut ? #408

Closed GunGunGun closed 3 weeks ago

GunGunGun commented 1 month ago
[keys]
focus_guilds_tree = "Ctrl+G"
focus_messages_text = "Ctrl+T"
focus_message_input = "Ctrl+P"
toggle_guild_tree = "Ctrl+B"
select_previous = "Rune[k]"
select_next = "Rune[j]"
select_first = "Rune[g]"
select_last = "Rune[G]"
copy_selected_message = "Ctrl+F"

I tried to add key to copy selected message, I pressed Ctrl+F and nothing happens.

And I don't know how to use Rune ?

Did I do anything wrong ? I'm using Lubuntu LTS.

ayn2op commented 3 weeks ago

From tcell.KeyRune:

KeyRune is special however, in that it is a place holder key indicating that a printable character was sent. The actual value of the rune will be transported in the Rune of the associated EventKey.

To put it simple, Rune[x] just means character x. For instance, Rune[j] just means character j. Furthermore, to override the default keybinding to copy the selected message, you can modify the keys.messages_text.yank value:

[keys.messages_text]
yank = "Ctrl+F" # default: Rune[y]

The DefaultConfig function in the config package (located in the internal directory) contains all of the default keybindings.