aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2017-11-28 21:56:34 +0000
committerHarry Jeffery <harry@exec64.co.uk>2017-11-28 21:59:16 +0000
commit11e52cb5d877520de730f56d9725c93fcc7bf3c5 (patch)
tree31dc3295fd1a8a371c11beb58303902d62f1f149
parent86b7b1bf49605f2d301e4a81658a39c0e8b40caa (diff)
downloadimv-11e52cb5d877520de730f56d9725c93fcc7bf3c5.tar.gz
Tweak config option names & capitalisation
-rw-r--r--files/imv_config63
-rw-r--r--src/binds.c4
-rw-r--r--src/imv.c56
3 files changed, 71 insertions, 52 deletions
diff --git a/files/imv_config b/files/imv_config
index 75d84d2..49fffdf 100644
--- a/files/imv_config
+++ b/files/imv_config
@@ -8,8 +8,8 @@
# Start with overlay visible
# overlay = true
-# Use nearest_neighbour interpolation for pixel art
-# sampling = nearest_neighbour
+# Method used for upscaling images. Can be 'linear' or 'nearest_neighbour'
+# upscaling_method = linear
# Recurse into subdirectories when opening a path
# recursive = true
@@ -21,58 +21,73 @@
# list_at_exit = true
# Scaling mode, one of: none, shrink, and full
-# scaling = none
+# scaling_mode = none
# Background, either a hex colour code or 'checks'
# background = 000000
# Change to the next image automatically after 3 seconds
-# slideshow = 3
+# slideshow_duration = 3
# Font to use for the overlay
# overlay_font = Monospace:24
# Disable imv's builtin binds so they don't conflict with the ones in this config
-default_binds = false
+suppress_default_binds = true
[binds]
-Q = quit
+# Some keys have special names:
+# < -> Less
+# > -> Greater
+# [ -> LeftSquareBracket
+# ] -> RightSquareBracket
+# = -> Equals
+# Left arrow key -> Left
+# Up arrow key -> Up
+# Right arrow key -> Right
+# Down arrow key -> Down
+
+# Keys can have the modifiers 'Ctrl+' 'Meta+' and 'Shift+' in front of them,
+# in that order. Keys with special names, or with a modifier are enclosed in
+# '<' and '>'.
+
+q = quit
# Image navigation
<Left> = select_rel -1
<LeftSquareBracket> = select_rel -1
<Right> = select_rel 1
<RightSquareBracket> = select_rel 1
-GG = select_abs 0
-<Shift+G> = select_abs -1
+gg = select_abs 0
+<Shift+g> = select_abs -1
# Panning
-J = pan 0 -50
-K = pan 0 50
-H = pan 50 0
-L = pan -50 0
+j = pan 0 -50
+k = pan 0 50
+h = pan 50 0
+l = pan -50 0
# Zooming
<Up> = zoom 1
-I = zoom 1
+i = zoom 1
<Down> = zoom -1
-O = zoom -1
+o = zoom -1
# Other commands
-X = remove
-F = fullscreen
-D = overlay
-P = exec echo $imv_path
-C = center
-S = scaling_mode next
-A = zoom actual
-R = reset
+x = remove
+f = fullscreen
+d = overlay
+p = exec echo $imv_path
+c = center
+s = scaling_mode next
+a = zoom actual
+r = reset
# Gif playback
. = next_frame
<Space> = toggle_playing
# Slideshow control
-T = slideshow_duration +1
-<Shift+T> = slideshow_duration -1
+t = slideshow_duration +1
+<Shift+t> = slideshow_duration -1
diff --git a/src/binds.c b/src/binds.c
index e0426e6..384d6ee 100644
--- a/src/binds.c
+++ b/src/binds.c
@@ -188,6 +188,7 @@ static int print_event(char *buf, size_t len, const SDL_Event *event)
/* Try plain old character input */
const char *keyname = SDL_GetKeyName(kevent->keysym.sym);
+ char singlekey[2] = {0};
/* Because '<' and '>' have special meaning in our syntax, and '=', '[', and
* ']' are restricted within ini files, we rename these. */
@@ -201,6 +202,9 @@ static int print_event(char *buf, size_t len, const SDL_Event *event)
keyname = "LeftSquareBracket";
} else if(!strcmp(keyname, "]")) {
keyname = "RightSquareBracket";
+ } else if(isalpha(*keyname)) {
+ singlekey[0] = tolower(*keyname);
+ keyname = &singlekey[0];
}
return snprintf(buf, len, "%s%s", prefix, keyname);
diff --git a/src/imv.c b/src/imv.c
index efad1f7..2e1119d 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -183,36 +183,36 @@ struct imv *imv_create(void)
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, "<q>", "quit");
add_bind(imv, "<Left>", "select_rel -1");
- add_bind(imv, "<[>", "select_rel -1");
+ add_bind(imv, "<LeftSquareBracket>", "select_rel -1");
add_bind(imv, "<Right>", "select_rel 1");
- add_bind(imv, "<]>", "select_rel 1");
- add_bind(imv, "<G><G>", "select_abs 0");
- add_bind(imv, "<Shift+G>", "select_abs -1");
- add_bind(imv, "<J>", "pan 0 -50");
- add_bind(imv, "<K>", "pan 0 50");
- add_bind(imv, "<H>", "pan 50 0");
- add_bind(imv, "<L>", "pan -50 0");
- add_bind(imv, "<X>", "remove");
- add_bind(imv, "<F>", "fullscreen");
- add_bind(imv, "<D>", "overlay");
- add_bind(imv, "<P>", "exec echo $imv_path");
+ add_bind(imv, "<RightSquareBracket>", "select_rel 1");
+ add_bind(imv, "<g><g>", "select_abs 0");
+ add_bind(imv, "<Shift+g>", "select_abs -1");
+ add_bind(imv, "<j>", "pan 0 -50");
+ add_bind(imv, "<k>", "pan 0 50");
+ add_bind(imv, "<h>", "pan 50 0");
+ add_bind(imv, "<l>", "pan -50 0");
+ add_bind(imv, "<x>", "remove");
+ add_bind(imv, "<f>", "fullscreen");
+ add_bind(imv, "<d>", "overlay");
+ add_bind(imv, "<p>", "exec echo $imv_path");
add_bind(imv, "<Equals>", "zoom 1");
add_bind(imv, "<Up>", "zoom 1");
add_bind(imv, "<+>", "zoom 1");
- add_bind(imv, "<I>", "zoom 1");
+ add_bind(imv, "<i>", "zoom 1");
add_bind(imv, "<Down>", "zoom -1");
add_bind(imv, "<->", "zoom -1");
- add_bind(imv, "<O>", "zoom -1");
- add_bind(imv, "<C>", "center");
- add_bind(imv, "<S>", "scaling_mode next");
- add_bind(imv, "<A>", "zoom actual");
- add_bind(imv, "<R>", "reset");
+ add_bind(imv, "<o>", "zoom -1");
+ add_bind(imv, "<c>", "center");
+ add_bind(imv, "<s>", "scaling_mode next");
+ add_bind(imv, "<a>", "zoom actual");
+ add_bind(imv, "<r>", "reset");
add_bind(imv, "<.>", "next_frame");
add_bind(imv, "<Space>", "toggle_playing");
- add_bind(imv, "<T>", "slideshow_duration +1");
- add_bind(imv, "<Shift+T>", "slideshow_duration -1");
+ add_bind(imv, "<t>", "slideshow_duration +1");
+ add_bind(imv, "<Shift+t>", "slideshow_duration -1");
return imv;
}
@@ -290,7 +290,7 @@ static bool parse_slideshow_duration(struct imv *imv, const char *duration)
}
}
if (imv->slideshow_image_duration == ULONG_MAX) {
- fprintf(stderr, "Wrong slideshow delay '%s'. Aborting.\n", optarg);
+ fprintf(stderr, "Wrong slideshow duration '%s'. Aborting.\n", optarg);
return false;
}
return true;
@@ -893,7 +893,7 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
- if(!strcmp(name, "sampling")) {
+ if(!strcmp(name, "upscaling_method")) {
imv->nearest_neighbour = !strcmp(value, "nearest_neighbour");
return 1;
}
@@ -913,7 +913,7 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
- if(!strcmp(name, "scaling")) {
+ if(!strcmp(name, "scaling_mode")) {
if(!strcmp(value, "none")) {
imv->scaling_mode = SCALING_NONE;
} else if(!strcmp(value, "shrink")) {
@@ -931,7 +931,7 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
- if(!strcmp(name, "slideshow")) {
+ if(!strcmp(name, "slideshow_duration")) {
if(!parse_slideshow_duration(imv, value)) {
return false;
}
@@ -944,9 +944,9 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
- if(!strcmp(name, "default_binds")) {
- const bool default_binds = parse_bool(value);
- if(!default_binds) {
+ if(!strcmp(name, "suppress_default_binds")) {
+ const bool suppress_default_binds = parse_bool(value);
+ if(suppress_default_binds) {
/* clear out any default binds if requested */
imv_binds_clear(imv->binds);
}