Skip to content

Keybinding

raziman edited this page Mar 18, 2021 · 3 revisions

Keybinding

New key bindings can be added through Keybinds.def_{g,p,q}. You can specify key bindings to only execute when you are in the correct scope. Scope here refers to Gomu panel, there are 3 different panel in Gomu; playlist, queue and playingbar. But you can only specify the scope to only two panels; playlist and queue.

For example you want to rebind quit to ctrl_w in playlist:

Keybinds.def_p("ctrl_w", quit)

Remember that quit is a command which is also is just a function of type func().

Visibility

Global: Keybinds.def_g

Playlist: Keybinds.def_p

Queue: Keybinds.def_q

Extending

Keybinds.def_{g,q,p} is just a function defined in module Keybinds. The function accepts two arguments which are keybind and function of type func().

For example you want to override the behaviour when you skip a song in gomu. You can do this by simply using Keybinds.def_g.

Keybinds.def_g("n", func() {
    skip()
    info_popup("Skipped a song")
})

In the above example, you simply show a popup while still able to skip a song.

Unmap

You can also unmap keybinding by simply passing nil.

Keybinds.def_g("alt_u", nil)
Clone this wiki locally