#include "defines.h" #include "interactions.h" static mimetype mimetype_default_cmd[] = { /* mimetype shell command * ^ substring of "file --mime-type -b ./hovered" * this does mean that this list is checked for completely linear. * Example: * file --mime-type -b ./image.gif * gives us "image/gif", thusly if we want to open gif in mpv rather than feh, * we need to define "gif" before "image" */ { "text", "$EDITOR" }, { "gif", "mpv --loop-file=\"inf\"" }, { "image", "feh" }, { "video", "mpv" }, { "audio", "mpv" } }; static binding key_binding[] = { /*key action comment*/ /*you cannot add bindings that include other bindings in its entirety * possible: mk, mf * not possible: gg, ggg * trying to use ggg will always fail as it will execute gg first instead, resetting the input buffer, thus never reaching ggg */ { "q", quit_program, "quit" }, { " ", toggle_selection, "toggle file selection" }, /* on hovered file/directory */ { "e", update, "rerun all backend" }, /* executes the entire backend and redrawing of the screen */ { "/", not_implemented, "search" }, { "h", move_right, "move right" }, /* moves one dir up */ { "t", move_down, "move down" }, { "n", move_up, "move up" }, { "s", move_left, "move left" }, /* if a dir is hovered, cd into it, if a file is selected, see mimetype_default_cmd */ { "\n", open_with, "open \"open with\" dialog" }, /* opens the hovered file with an arbitrary command */ { "r", rename_hovered, "rename hovered file" }, /* renames currently hovered file/directory */ { "d", delete, "delete file" }, /* deletes currently hovered OR selected file/directory * this means that it does not delete the hovered files if files are already selected */ { "G", jump_bottom, "jump to last file in dir" }, { "gg", jump_top, "jump to file 0" }, { "gh", not_implemented, "jump to ~/" }, { "gd", not_implemented, "jump to /dev" }, { "ge", not_implemented, "jump to /etc" }, { "gm", not_implemented, "jump to /mnt" }, { "go", not_implemented, "jump to /opt" }, { "gt", not_implemented, "jump to /tmp" }, { "gv", not_implemented, "jump to /var" }, { "u7", not_implemented, "unzip 7z" }, { "ub", not_implemented, "unzip bz2" }, { "ur", not_implemented, "unzip rar" }, { "ut", not_implemented, "unzip tar" }, { "ut", not_implemented, "unzip gzip" }, { "uz", not_implemented, "unzip zip" }, { "on", not_implemented, "order natural" }, { "or", not_implemented, "order reverse" }, { "oe", not_implemented, "order extension" }, { "os", not_implemented, "order size" }, { "ot", not_implemented, "order type" }, { "oz", not_implemented, "order random" }, { "mk", makedir, "create directory" }, { "mf", makefile, "create file" }, { "a", toggle_hidden_files, "toggle hidden files" }, }; static unsigned long binding_count = sizeof(key_binding) / sizeof(binding); static unsigned long mimetype_default_count = sizeof(mimetype_default_cmd) / sizeof(mimetype);