New key mapping: D, remove image from file list
This commit is contained in:
		
							parent
							
								
									facd7e3b42
								
							
						
					
					
						commit
						fa81707540
					
				| @ -53,7 +53,6 @@ sxiv supports the following command-line options: | |||||||
| Use the following keys to control the basic behaviour of sxiv: | Use the following keys to control the basic behaviour of sxiv: | ||||||
| 
 | 
 | ||||||
|     q            Quit sxiv |     q            Quit sxiv | ||||||
|     Escape       Quit sxiv and return an exit value of 2 (useful for scripting) |  | ||||||
|     f            Toggle fullscreen mode (requires an EWMH/NetWM compliant |     f            Toggle fullscreen mode (requires an EWMH/NetWM compliant | ||||||
|                  window manager) |                  window manager) | ||||||
| 
 | 
 | ||||||
| @ -73,6 +72,7 @@ Inside image view mode, the following key mappings are available: | |||||||
|     a            Toggle anti-aliasing |     a            Toggle anti-aliasing | ||||||
|     A            Toggle visibility of alpha-channel, i.e. transparency |     A            Toggle visibility of alpha-channel, i.e. transparency | ||||||
|     r            Reload image |     r            Reload image | ||||||
|  |     D            Remove image from file list and go to next image | ||||||
|     Return       Switch to thumbnail mode |     Return       Switch to thumbnail mode | ||||||
| 
 | 
 | ||||||
| Additionally, the image view offers the following mouse commands: | Additionally, the image view offers the following mouse commands: | ||||||
| @ -91,6 +91,7 @@ In thumbnail mode, the following key and mouse mappings are available: | |||||||
| 
 | 
 | ||||||
|     h,j,k,l      Move selection left/down/up/right (also with arrow keys) |     h,j,k,l      Move selection left/down/up/right (also with arrow keys) | ||||||
|     g/G          Move selection to first/last image |     g/G          Move selection to first/last image | ||||||
|  |     D            Remove selected image from file list and select next image | ||||||
|     Return       Open selected image |     Return       Open selected image | ||||||
| 
 | 
 | ||||||
|     Button1      Select image/open image if it is already selected |     Button1      Select image/open image if it is already selected | ||||||
|  | |||||||
							
								
								
									
										40
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								main.c
									
									
									
									
									
								
							| @ -370,7 +370,7 @@ void redraw() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void on_keypress(XKeyEvent *kev) { | void on_keypress(XKeyEvent *kev) { | ||||||
| 	int x, y; | 	int i, x, y; | ||||||
| 	unsigned int w, h; | 	unsigned int w, h; | ||||||
| 	char key; | 	char key; | ||||||
| 	KeySym ksym; | 	KeySym ksym; | ||||||
| @ -385,10 +385,10 @@ void on_keypress(XKeyEvent *kev) { | |||||||
| #ifdef EXT_COMMANDS | #ifdef EXT_COMMANDS | ||||||
| 	/* external commands from commands.h */ | 	/* external commands from commands.h */ | ||||||
| 	if (CLEANMASK(kev->state) & ControlMask) { | 	if (CLEANMASK(kev->state) & ControlMask) { | ||||||
| 		for (x = 0; x < LEN(commands); ++x) { | 		for (i = 0; i < LEN(commands); ++i) { | ||||||
| 			if (commands[x].ksym == ksym) { | 			if (commands[i].ksym == ksym) { | ||||||
| 				win_set_cursor(&win, CURSOR_WATCH); | 				win_set_cursor(&win, CURSOR_WATCH); | ||||||
| 				if (run_command(commands[x].cmdline, commands[x].reload)) { | 				if (run_command(commands[i].cmdline, commands[i].reload)) { | ||||||
| 					if (mode == MODE_NORMAL) { | 					if (mode == MODE_NORMAL) { | ||||||
| 						img_close(&img, 1); | 						img_close(&img, 1); | ||||||
| 						load_image(fileidx); | 						load_image(fileidx); | ||||||
| @ -571,6 +571,38 @@ void on_keypress(XKeyEvent *kev) { | |||||||
| 			win_toggle_fullscreen(&win); | 			win_toggle_fullscreen(&win); | ||||||
| 			/* render on next configurenotify */ | 			/* render on next configurenotify */ | ||||||
| 			break; | 			break; | ||||||
|  | 
 | ||||||
|  | 		case XK_D: | ||||||
|  | 			if (mode == MODE_THUMBS) { | ||||||
|  | 				if (tns.sel >= tns.cnt) | ||||||
|  | 					break; | ||||||
|  | 				i = tns.sel; | ||||||
|  | 			} else { | ||||||
|  | 				i = fileidx; | ||||||
|  | 			} | ||||||
|  | 			if (filecnt == 1) { | ||||||
|  | 				cleanup(); | ||||||
|  | 				exit(0); | ||||||
|  | 			} | ||||||
|  | 			if (i + 1 < filecnt) | ||||||
|  | 				memmove(filenames + i, filenames + i + 1, (filecnt - i - 1) * | ||||||
|  | 				        sizeof(const char*)); | ||||||
|  | 			else if (fileidx) | ||||||
|  | 				fileidx--; | ||||||
|  | 			if (i + 1 < tns.cnt) { | ||||||
|  | 				memmove(tns.thumbs + i, tns.thumbs + i + 1, (tns.cnt - i - 1) * | ||||||
|  | 				        sizeof(thumb_t)); | ||||||
|  | 				memset(tns.thumbs + tns.cnt - 1, 0, sizeof(thumb_t)); | ||||||
|  | 			} else if (tns.sel) { | ||||||
|  | 				tns.sel--; | ||||||
|  | 			} | ||||||
|  | 			filecnt--; | ||||||
|  | 			if (mode == MODE_NORMAL) | ||||||
|  | 				load_image(fileidx); | ||||||
|  | 			if (i < tns.cnt) | ||||||
|  | 				tns.cnt--; | ||||||
|  | 			changed = tns.dirty = 1; | ||||||
|  | 			break; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (changed) | 	if (changed) | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								sxiv.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								sxiv.1
									
									
									
									
									
								
							| @ -82,9 +82,6 @@ at startup. | |||||||
| .B q | .B q | ||||||
| Quit sxiv. | Quit sxiv. | ||||||
| .TP | .TP | ||||||
| .B Escape |  | ||||||
| Quit sxiv and return an exit value of 2. |  | ||||||
| .TP |  | ||||||
| .B Return | .B Return | ||||||
| Switch to thumbnail mode; in thumbnail mode: open selected image. | Switch to thumbnail mode; in thumbnail mode: open selected image. | ||||||
| .SS Navigate image list | .SS Navigate image list | ||||||
| @ -156,6 +153,10 @@ Toggle visibility of alpha-channel, i.e. image transparency. | |||||||
| .TP | .TP | ||||||
| .B r | .B r | ||||||
| Reload image. | Reload image. | ||||||
|  | .TP | ||||||
|  | .B D | ||||||
|  | Remove image from file list and go to next image; in thumbnail mode: remove | ||||||
|  | selected image from file list and select next image. | ||||||
| .SH MOUSE COMMANDS | .SH MOUSE COMMANDS | ||||||
| .SS Navigate image list | .SS Navigate image list | ||||||
| .TP | .TP | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert
						Bert