Merged pull request #129
This commit is contained in:
commit
f6510b0a04
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION = git-20140115
|
VERSION = git-20140131
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
MANPREFIX = $(PREFIX)/share/man
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
|
|
@ -96,6 +96,8 @@ of small previews is displayed, making it easy to choose an image to open.
|
||||||
|
|
||||||
0-9 Prefix the next command with a number (denoted via [count])
|
0-9 Prefix the next command with a number (denoted via [count])
|
||||||
|
|
||||||
|
Ctrl-x Send the next key to the external key-handler
|
||||||
|
|
||||||
g Go to first image
|
g Go to first image
|
||||||
G Go to the last image, or image number [count]
|
G Go to the last image, or image number [count]
|
||||||
|
|
||||||
|
@ -144,6 +146,9 @@ of small previews is displayed, making it easy to choose an image to open.
|
||||||
? Rotate image by 180 degrees
|
? Rotate image by 180 degrees
|
||||||
|,_ Flip image horizontally/vertically
|
|,_ Flip image horizontally/vertically
|
||||||
|
|
||||||
|
{,} Decrease/increase gamma
|
||||||
|
Ctrl-g Reset gamma
|
||||||
|
|
||||||
s Toggle slideshow or set delay to [count] seconds
|
s Toggle slideshow or set delay to [count] seconds
|
||||||
|
|
||||||
a Toggle anti-aliasing
|
a Toggle anti-aliasing
|
||||||
|
|
|
@ -52,6 +52,7 @@ extern int filecnt, fileidx;
|
||||||
extern int alternate;
|
extern int alternate;
|
||||||
|
|
||||||
extern int prefix;
|
extern int prefix;
|
||||||
|
extern bool extprefix;
|
||||||
|
|
||||||
const int ss_delays[] = {
|
const int ss_delays[] = {
|
||||||
1, 2, 3, 5, 10, 15, 20, 30, 60, 120, 180, 300, 600
|
1, 2, 3, 5, 10, 15, 20, 30, 60, 120, 180, 300, 600
|
||||||
|
@ -119,6 +120,12 @@ cmdreturn_t it_toggle_bar(arg_t a)
|
||||||
return CMD_DIRTY;
|
return CMD_DIRTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmdreturn_t it_prefix_external(arg_t a)
|
||||||
|
{
|
||||||
|
extprefix = true;
|
||||||
|
return CMD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
cmdreturn_t t_reload_all(arg_t a)
|
cmdreturn_t t_reload_all(arg_t a)
|
||||||
{
|
{
|
||||||
if (mode == MODE_THUMB) {
|
if (mode == MODE_THUMB) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ cmdreturn_t it_quit(arg_t);
|
||||||
cmdreturn_t it_switch_mode(arg_t);
|
cmdreturn_t it_switch_mode(arg_t);
|
||||||
cmdreturn_t it_toggle_fullscreen(arg_t);
|
cmdreturn_t it_toggle_fullscreen(arg_t);
|
||||||
cmdreturn_t it_toggle_bar(arg_t);
|
cmdreturn_t it_toggle_bar(arg_t);
|
||||||
|
cmdreturn_t it_prefix_external(arg_t);
|
||||||
cmdreturn_t t_reload_all(arg_t);
|
cmdreturn_t t_reload_all(arg_t);
|
||||||
cmdreturn_t it_reload_image(arg_t);
|
cmdreturn_t it_reload_image(arg_t);
|
||||||
cmdreturn_t it_remove_image(arg_t);
|
cmdreturn_t it_remove_image(arg_t);
|
||||||
|
|
|
@ -85,6 +85,8 @@ static const keymap_t keys[] = {
|
||||||
{ 0, XK_f, it_toggle_fullscreen, (arg_t) None },
|
{ 0, XK_f, it_toggle_fullscreen, (arg_t) None },
|
||||||
{ 0, XK_b, it_toggle_bar, (arg_t) None },
|
{ 0, XK_b, it_toggle_bar, (arg_t) None },
|
||||||
|
|
||||||
|
{ ControlMask, XK_x, it_prefix_external, (arg_t) None },
|
||||||
|
|
||||||
{ 0, XK_r, it_reload_image, (arg_t) None },
|
{ 0, XK_r, it_reload_image, (arg_t) None },
|
||||||
{ 0, XK_R, t_reload_all, (arg_t) None },
|
{ 0, XK_R, t_reload_all, (arg_t) None },
|
||||||
{ 0, XK_D, it_remove_image, (arg_t) None },
|
{ 0, XK_D, it_remove_image, (arg_t) None },
|
||||||
|
@ -155,7 +157,7 @@ static const keymap_t keys[] = {
|
||||||
|
|
||||||
{ 0, XK_braceleft, i_change_gamma, (arg_t) -1 },
|
{ 0, XK_braceleft, i_change_gamma, (arg_t) -1 },
|
||||||
{ 0, XK_braceright, i_change_gamma, (arg_t) +1 },
|
{ 0, XK_braceright, i_change_gamma, (arg_t) +1 },
|
||||||
{ ControlMask, XK_G, i_change_gamma, (arg_t) 0 },
|
{ ControlMask, XK_g, i_change_gamma, (arg_t) 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mouse button mappings for image mode: */
|
/* mouse button mappings for image mode: */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Example for $XDG_CONFIG_HOME/sxiv/exec/key-handler
|
# Example for $XDG_CONFIG_HOME/sxiv/exec/key-handler
|
||||||
# Called by sxiv(1) whenever an unbound key combo is used,
|
# Called by sxiv(1) after the external prefix key (C-x by default) is pressed.
|
||||||
# with the key combo as its first argument and the path of the current image
|
# The next key combo is passed as its first argument and the path of the
|
||||||
# as its second argument.
|
# current image as its second argument.
|
||||||
# sxiv(1) blocks until this script terminates. It then checks if the image
|
# sxiv(1) blocks until this script terminates. It then checks if the image
|
||||||
# has been modified and reloads it.
|
# has been modified and reloads it.
|
||||||
|
|
||||||
|
|
19
main.c
19
main.c
|
@ -75,6 +75,7 @@ int filecnt, fileidx;
|
||||||
int alternate;
|
int alternate;
|
||||||
|
|
||||||
int prefix;
|
int prefix;
|
||||||
|
bool extprefix;
|
||||||
|
|
||||||
bool resized = false;
|
bool resized = false;
|
||||||
|
|
||||||
|
@ -522,16 +523,16 @@ void on_keypress(XKeyEvent *kev)
|
||||||
|
|
||||||
if (IsModifierKey(ksym))
|
if (IsModifierKey(ksym))
|
||||||
return;
|
return;
|
||||||
|
if (ksym == XK_Escape && MODMASK(kev->state) == 0) {
|
||||||
if ((ksym == XK_Escape && MODMASK(kev->state) == 0) ||
|
extprefix = False;
|
||||||
(key >= '0' && key <= '9'))
|
} else if (extprefix) {
|
||||||
{
|
run_key_handler(XKeysymToString(ksym), kev->state & ~sh);
|
||||||
|
extprefix = False;
|
||||||
|
} else if (key >= '0' && key <= '9') {
|
||||||
/* number prefix for commands */
|
/* number prefix for commands */
|
||||||
prefix = ksym == XK_Escape ? 0 : prefix * 10 + (int) (key - '0');
|
prefix = prefix * 10 + (int) (key - '0');
|
||||||
return;
|
return;
|
||||||
}
|
} else for (i = 0; i < ARRLEN(keys); i++) {
|
||||||
|
|
||||||
for (i = 0; i < ARRLEN(keys); i++) {
|
|
||||||
if (keys[i].ksym == ksym &&
|
if (keys[i].ksym == ksym &&
|
||||||
MODMASK(keys[i].mask | sh) == MODMASK(kev->state) &&
|
MODMASK(keys[i].mask | sh) == MODMASK(kev->state) &&
|
||||||
keys[i].cmd != NULL)
|
keys[i].cmd != NULL)
|
||||||
|
@ -545,8 +546,6 @@ void on_keypress(XKeyEvent *kev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == ARRLEN(keys))
|
|
||||||
run_key_handler(XKeysymToString(ksym), kev->state & ~sh);
|
|
||||||
prefix = 0;
|
prefix = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
sxiv.1
5
sxiv.1
|
@ -125,6 +125,9 @@ Toggle fullscreen mode.
|
||||||
.B b
|
.B b
|
||||||
Toggle visibility of info bar on bottom of window.
|
Toggle visibility of info bar on bottom of window.
|
||||||
.TP
|
.TP
|
||||||
|
.B Ctrl-x
|
||||||
|
Send the next key to the external key-handler.
|
||||||
|
.TP
|
||||||
.B A
|
.B A
|
||||||
Toggle visibility of alpha-channel, i.e. image transparency.
|
Toggle visibility of alpha-channel, i.e. image transparency.
|
||||||
.TP
|
.TP
|
||||||
|
@ -303,7 +306,7 @@ Decrease gamma.
|
||||||
.B }
|
.B }
|
||||||
Increase gamma.
|
Increase gamma.
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl-G
|
.B Ctrl-g
|
||||||
Reset gamma.
|
Reset gamma.
|
||||||
.SS Miscellaneous
|
.SS Miscellaneous
|
||||||
.TP
|
.TP
|
||||||
|
|
Loading…
Reference in a new issue