aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2017-11-28 22:06:55 +0000
committerHarry Jeffery <harry@exec64.co.uk>2017-11-28 22:06:55 +0000
commitf4bf8bc6f645f1aeb396effd17f1afdd6b909a75 (patch)
tree03e80eeb53e5b54f551fce6f5b97c31acfb4e2a3
parent11e52cb5d877520de730f56d9725c93fcc7bf3c5 (diff)
downloadimv-f4bf8bc6f645f1aeb396effd17f1afdd6b909a75.tar.gz
Allow aliases to be configured
-rw-r--r--files/imv_config9
-rw-r--r--src/imv.c11
2 files changed, 14 insertions, 6 deletions
diff --git a/files/imv_config b/files/imv_config
index 49fffdf..d7f6438 100644
--- a/files/imv_config
+++ b/files/imv_config
@@ -35,7 +35,16 @@
# Disable imv's builtin binds so they don't conflict with the ones in this config
suppress_default_binds = true
+[aliases]
+# Create some command aliases
+q = quit
+next = select_rel 1
+previous = select_rel -1
+n = select_rel 1
+p = select_rel -1
+
[binds]
+# Add some custom key bindings to imv
# Some keys have special names:
# < -> Less
diff --git a/src/imv.c b/src/imv.c
index 2e1119d..2d67bf7 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -177,12 +177,6 @@ struct imv *imv_create(void)
imv_command_register(imv->commands, "scaling_mode", &command_set_scaling_mode);
imv_command_register(imv->commands, "slideshow_duration", &command_set_slideshow_duration);
- imv_command_alias(imv->commands, "q", "quit");
- imv_command_alias(imv->commands, "next", "select_rel 1");
- imv_command_alias(imv->commands, "previous", "select_rel -1");
- imv_command_alias(imv->commands, "n", "select_rel 1");
- imv_command_alias(imv->commands, "p", "select_rel -1");
-
add_bind(imv, "<q>", "quit");
add_bind(imv, "<Left>", "select_rel -1");
add_bind(imv, "<LeftSquareBracket>", "select_rel -1");
@@ -881,6 +875,11 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
+ if (!strcmp(section, "aliases")) {
+ imv_command_alias(imv->commands, name, value);
+ return 1;
+ }
+
if (!strcmp(section, "options")) {
if(!strcmp(name, "fullscreen")) {