[general]
default_module = "app" # module to run when no prefix is matched
empty_module = "app" # run with an empty prompt
exec_cmd = "zsh -c" # exec command of your shell
vi_mode = false # set true to use vi keybinds, false emacs keybinds
esc_to_abort = true # useful for vi users
cheatsheet_entry = "?" # when prompted, will show a list of configured modules
cheatsheet_viewer = "less -R; clear" # command to show cheatsheet; through piping stdout
clear_screen_after_execution = false
loop_mode = false # don't quit after executing a module, useful with scratchpads; stderr is hidden in loop mode
external_editor = "nvim" # if set, press ctrl+x ctrl+ee (or v in vi normal mode) to edit prompt in the specified program
delay_startup = 0 # sometimes the otter runs too fast even before the terminal window is ready; this slows it down by milliseconds; useful when chafa image is skewed


# ANSI color codes are allowed. However, \x1b should be replaced with \u001B, because the rust toml crate cannot read \x as an escaped character
[interface]
# use three quotes to write longer codes
header = """
  \u001B[1;36m$USER@nixos\u001B[0m     \u001B[34m 
	"""
header_cmd = "" # run a command and print stdout above the header
header_cmd_trimmed_lines = 0 # remove trailing lines from header_cmd output, in case of some programs appending excessive empty lines
place_holder = "execute" # at the input field
suggestion_mode = "list" # available options: list, hint
footer = "" # add a line after suggestion list
suggestion_lines = 8 # 0 to disable suggestions and tab completion
list_prefix = "  "
selection_prefix = "\u001B[31;1m "
prefix_padding = 3 # format prefixes to have a uniformed width
default_module_message = "  \u001B[33mlaunch\u001B[0m app" # shown when the default module is in use
empty_module_message = "" # shown when the empty module is in use
customized_list_order = false # false to list modules alphabetically; true to list as per the configured order in the below [[modules]] section
indicator_with_arg_module = " * " # the sign showing whether a module should run with an argument
indicator_no_arg_module = " "
# below color options affect all modules; per-module coloring can be configured using ansi codes individually
prefix_color = "\u001B[33m"
description_color = "\u001B[39m"
place_holder_color = "\u001B[30m"
hint_color = "\u001B[30m" # suggestion color in hint mode
# move the interface rightward or downward
move_interface_right = 20
move_interface_down = 0


# overlay is a floating layer that can be printed with stdout and moved around; useful for integrating chafa images
[overlay]
overlay_cmd = """
chafa -s 20x20 ~/.config/otter-launcher/cat.png
"""
overlay_trimmed_lines = 1


# modules are defined as followed
[[modules]]
description = "google search"
prefix = "gg"
cmd = "firefox --new-window https://www.google.com/search?q='{}'"
with_argument = true # if true, {} in cmd will be replaced with user input. if not explicitly set, taken as false.
url_encode = true # should be true when calling webpages; this ensures special characters in url being readable to browsers; taken as false if not explicitly set
unbind_proc = true # run cmd in a forked shell as opposed to as a child process (simply by prepending setsid -f to the configured cmd); useful for launching gui programs; taken as false if not explicitly set

[[modules]]
description = "launch programs"
prefix = "app"
cmd = """
hyprctl dispatch resizeactive 300 500 &&
hyprctl dispatch centerwindow &&
hyprctl dispatch exec $(fsel --no-exec)
"""

[[modules]]
description = "nerd icons"
prefix = "nerd"
cmd = """
hyprctl dispatch resizeactive 300 500 &&
hyprctl dispatch centerwindow &&
hyprctl dispatch exec wl-copy $(cat ~/.config/otter-launcher/icons.json | jq -r '. | to_entries[] | "\\(.value.char)  \\(.key)"' | fzf | awk '{print $1}' | tr -d '\n')
"""

[[modules]]
description = "run command"
prefix = "sh"
cmd = """
hyprctl dispatch exec 'kitty -e zsh -c "{}"'
"""
with_argument = true
unbind_proc = true

[[modules]]
description = "notes"
prefix = "n"
cmd = """
hyprctl dispatch exec "kitty -e nvim --cmd 'cd ~/Notes/'"
"""

[[modules]]
description = "nixos wiki"
prefix = "nw"
cmd = """
hyprctl dispatch exec "firefox --new-window 'https://wiki.nixos.org/w/index.php?search={}'"
"""
with_argument = true
url_encode = true
unbind_proc = true

[[modules]]
description = "search nixpkgs"
prefix = "nix"
cmd = """
hyprctl dispatch exec "firefox --new-window 'https://search.nixos.org/packages?query={}'"
"""
with_argument = true
url_encode = true
unbind_proc = true

[[modules]]
description = "cambridge dict"
prefix = "dc"
cmd = """
hyprctl dispatch exec "firefox --new-window 'https://dictionary.cambridge.org/dictionary/english/{}'"
"""
with_argument = true
url_encode = true
unbind_proc = true

[[modules]]
description = "open dirs (yazi)"
prefix = "path"
cmd = """
hyprctl dispatch resizeactive 300 500 &&
hyprctl dispatch centerwindow &
hyprctl dispatch exec thunar $(find . -maxdepth 2 -type d | fzf)
"""

[[modules]]
description = "run music"
prefix = "jf"
cmd = """
hyprctl dispatch exec '[workspace special:music]' 'kitty --class jf-tui -e jellyfin-tui'
"""

[[modules]]
description = "open youtube"
prefix = "y"
cmd = "hyprctl dispatch exec 'firefox --new-window https://www.youtube.com'"
with_argument = false
url_encode = true
unbind_proc = true

[[modules]]
description = "open whatsapp"
prefix = "w"
cmd = "hyprctl dispatch exec 'firefox --new-window https://web.whatsapp.com'"
with_argument = false
url_encode = true
unbind_proc = true

