37 lines
1.2 KiB
C
37 lines
1.2 KiB
C
#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 */
|
|
{ "q", quit_program },
|
|
{ "h", move_right }, /* moves one dir up */
|
|
{ "t", move_down },
|
|
{ "n", move_up },
|
|
{ "s", move_left }, /* if a dir is hovered, cd into it, if a file is selected, see mimetype_default_cmd */
|
|
|
|
{ "\n", open_with }, /* opens the hovered file with an arbitrary command */
|
|
{ "r", rename_hovered }, /* renames currently hovered file/directory */
|
|
|
|
{ "gg", jump_top },
|
|
{ "G", jump_bottom },
|
|
|
|
{ "a", 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);
|