summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands.c10
-rw-r--r--commands.h1
-rw-r--r--config.def.h1
-rw-r--r--main.c2
4 files changed, 14 insertions, 0 deletions
diff --git a/commands.c b/commands.c
index 8868091..e742016 100644
--- a/commands.c
+++ b/commands.c
@@ -46,6 +46,7 @@ extern win_t win;
extern fileinfo_t *files;
extern int filecnt, fileidx;
+extern int alternate;
extern int prefix;
@@ -155,6 +156,15 @@ bool i_navigate(arg_t a) {
return false;
}
+bool i_alternate(arg_t a) {
+ if (mode == MODE_IMAGE) {
+ load_image(alternate);
+ return true;
+ } else {
+ return false;
+ }
+}
+
bool it_first(arg_t a) {
if (mode == MODE_IMAGE && fileidx != 0) {
load_image(0);
diff --git a/commands.h b/commands.h
index 0e324c8..3c00718 100644
--- a/commands.h
+++ b/commands.h
@@ -49,6 +49,7 @@ bool t_reload_all(arg_t);
bool it_reload_image(arg_t);
bool it_remove_image(arg_t);
bool i_navigate(arg_t);
+bool i_alternate(arg_t);
bool it_first(arg_t);
bool it_n_or_last(arg_t);
bool i_navigate_frame(arg_t);
diff --git a/config.def.h b/config.def.h
index 49dac49..42e1774 100644
--- a/config.def.h
+++ b/config.def.h
@@ -73,6 +73,7 @@ static const keymap_t keys[] = {
{ false, XK_BackSpace, i_navigate, (arg_t) -1 },
{ false, XK_bracketright, i_navigate, (arg_t) +10 },
{ false, XK_bracketleft, i_navigate, (arg_t) -10 },
+ { true, XK_6, i_alternate, (arg_t) None },
{ false, XK_g, it_first, (arg_t) None },
{ false, XK_G, it_n_or_last, (arg_t) None },
diff --git a/main.c b/main.c
index 2483d10..5f8a0ca 100644
--- a/main.c
+++ b/main.c
@@ -62,6 +62,7 @@ win_t win;
fileinfo_t *files;
int filecnt, fileidx;
+int alternate;
size_t filesize;
int prefix;
@@ -217,6 +218,7 @@ void load_image(int new) {
}
files[new].loaded = true;
+ alternate = fileidx;
fileidx = new;
if (stat(files[new].path, &fstats) == 0)
filesize = fstats.st_size;