-
Notifications
You must be signed in to change notification settings - Fork 15
Helper
For now, gomu only has three modules Keybinds, Event and List. We will
add more module to the language when it is needed.
List module contains useful functions for List.
module List {
func collect(list, func(T) V)
func reduce(list, V, func(T) V)
func filter(list, func(T) bool)
}
Example:
ls = [1, 2, 3]
println(List.map(ls, func(x) { x + 100 })) // [101, 102, 103]Event module provides interface to subscribe to an event that is emitted by
gomu. With this, you can execute a function which will be called once the event
happens. Event module has two functions add_hook and run_hooks and both
accept callback function.
// execute function when you enter gomu
Event.add_hook("enter", func() {
info_popup("Welcome back !")
})
// force run all hooks of an event
Event.run_hooks("new_song")Below is the list of events that you can subscribe to.
enternew_songskipplaypauseexit
You also can use built-in REPL to test and try anko script. The REPL is bounded
to m keybind.

range with 1 argument returns list of [0..max]
range with 2 argument returns list of [min..max]
range with 3 argument returns list of [min, step..max]
keys returns keys of type map.
type_of returns type of a value. It uses reflect.ValueOf under the hood.
kind_of returns kind of a value. It uses reflect.KindOf under the hood.
defined returns true if symbol is defined.
load loads other anko script.
Same as Go's print
Same as Go's println
Same as Go's printf
Shows debug popup and log debug info. Mainly used when scripting.
Shows info popup and does not log anything. Prefer this when making simple popup.
Ask input from user and handle input string with callback.
Popup with title and description. Does not log anything.
Opens finder interface and waits for input from user. Handles result in
callback.
Execute shell command and returns stdout and stderr output.