Compare commits
	
		
			2 Commits
		
	
	
		
			cce2b6ba51
			...
			a6560509d9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a6560509d9 | |||
| 44c28f00d6 | 
| @ -26,6 +26,15 @@ the _User Guide_. | |||||||
| 
 | 
 | ||||||
| Options | Options | ||||||
| ------- | ------- | ||||||
|  | *--browse*:: | ||||||
|  | 	When an image is passed, start in browsing mode, and preselect that | ||||||
|  | 	image in its containing directory.  This is used by *fiv*'s inode/directory | ||||||
|  | 	handler to implement the "Open Containing Folder" feature of certain | ||||||
|  | 	applications. | ||||||
|  | 
 | ||||||
|  | *--help-all*:: | ||||||
|  | 	Show the full list of options, including those provided by GTK+. | ||||||
|  | 
 | ||||||
| *--invalidate-cache*:: | *--invalidate-cache*:: | ||||||
| 	Invalidate the wide thumbnail cache, removing thumbnails for files that can | 	Invalidate the wide thumbnail cache, removing thumbnails for files that can | ||||||
| 	no longer be found. | 	no longer be found. | ||||||
| @ -35,18 +44,11 @@ Options | |||||||
| 	the list of MIME types within *fiv*'s desktop file when the list | 	the list of MIME types within *fiv*'s desktop file when the list | ||||||
| 	of GdkPixbuf loaders changes. | 	of GdkPixbuf loaders changes. | ||||||
| 
 | 
 | ||||||
| *--browse*:: | *-V*, *--version*:: | ||||||
| 	When an image is passed, start in browsing mode, and preselect that | 	Output version information and exit. | ||||||
| 	image in its containing directory.  This is used by *fiv*'s inode/directory |  | ||||||
| 	handler to implement the "Open Containing Folder" feature of certain |  | ||||||
| 	applications. |  | ||||||
| 
 |  | ||||||
| *--thumbnail*=_SIZE_:: |  | ||||||
| 	Generate thumbnails for the first argument, in all sizes not exceeding |  | ||||||
| 	_SIZE_, and present the largest of them on the standard output |  | ||||||
| 	in an application-specific bitmap format.  Available sizes follow directory |  | ||||||
| 	names in the _Thumbnail Managing Standard_. |  | ||||||
| 
 | 
 | ||||||
|  | Internal options | ||||||
|  | ~~~~~~~~~~~~~~~~ | ||||||
| *--extract-thumbnail*:: | *--extract-thumbnail*:: | ||||||
| 	Present any embedded thumbnail of the first argument on the standard output | 	Present any embedded thumbnail of the first argument on the standard output | ||||||
| 	in an application-specific bitmap format.  When both *--thumbnail* | 	in an application-specific bitmap format.  When both *--thumbnail* | ||||||
| @ -54,11 +56,16 @@ Options | |||||||
| 	exiting early if successful.  This is used to enhance responsivity | 	exiting early if successful.  This is used to enhance responsivity | ||||||
| 	of thumbnail procurement. | 	of thumbnail procurement. | ||||||
| 
 | 
 | ||||||
| *-V*, *--version*:: | *--thumbnail*=_SIZE_:: | ||||||
| 	Output version information and exit. | 	Generate wide thumbnails for the first argument, in all sizes not exceeding | ||||||
|  | 	_SIZE_, and present the largest of them on the standard output | ||||||
|  | 	in an application-specific bitmap format.  Available sizes follow directory | ||||||
|  | 	names in the _Thumbnail Managing Standard_. | ||||||
| 
 | 
 | ||||||
| *--help-all*:: | *--thumbnail-for-search*=_SIZE_:: | ||||||
| 	Show the full list of options, including those provided by GTK+. | 	Transform the first argument to a widely supported image file format, | ||||||
|  | 	and present it on the standard output.  The image will be downscaled as | ||||||
|  | 	necessary so as to not exceed _SIZE_ (see *--thumbnail*). | ||||||
| 
 | 
 | ||||||
| Reporting bugs | Reporting bugs | ||||||
| -------------- | -------------- | ||||||
|  | |||||||
| @ -17,9 +17,9 @@ q:lang(en):after { content: "’"; } | |||||||
| <span id="author">Přemysl Eric Janouch</span><br> | <span id="author">Přemysl Eric Janouch</span><br> | ||||||
| <span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br> | <span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br> | ||||||
| <span id="revnumber">version 0.0.0,</span> | <span id="revnumber">version 0.0.0,</span> | ||||||
| <span id="revdate">2022-07-31</span> | <span id="revdate">2023-04-17</span> | ||||||
| 
 | 
 | ||||||
| <p class="figure"><img src="fiv.webp" alt="fiv's browser and viewer"> | <p class="figure"><img src="fiv.webp" alt="fiv in browser and viewer modes"> | ||||||
| 
 | 
 | ||||||
| <h2>Introduction</h2> | <h2>Introduction</h2> | ||||||
| 
 | 
 | ||||||
| @ -33,30 +33,31 @@ and page up/down buttons in mind, such as SteelSeries Sensei series. Ozone Neon | |||||||
| series may also be mapped this way. Your experience may be degraded with other | series may also be mapped this way. Your experience may be degraded with other | ||||||
| kinds of devices. | kinds of devices. | ||||||
| 
 | 
 | ||||||
| <p>Controls should generally be accessible through the keyboard. Pressing Ctrl+? | <p>Controls should generally be accessible through the keyboard. Pressing | ||||||
| will give you a convenient overview of all shortcuts. In addition to these, | <kbd>Ctrl</kbd> + <kbd>?</kbd> will give you a convenient overview | ||||||
| remember that you may often use Ctrl+Tab and F6 to navigate to different groups | of all shortcuts. In addition to these, remember that you may often use | ||||||
| of widgets. | <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and <kbd>F6</kbd> to navigate to | ||||||
|  | different groups of widgets. | ||||||
| 
 | 
 | ||||||
| <h2>Browser</h2> | <h2>Browser</h2> | ||||||
| 
 | 
 | ||||||
| <p><i>fiv</i> normally starts in a file browser view. On the left side of the | <p><i>fiv</i> normally starts in a file browser view. On the left side of the | ||||||
| window, you'll find your GTK+ bookmarks, mounted locations as recognized by | window, you'll find your GTK+ bookmarks, mounted locations as recognized by | ||||||
| GVfs, an item for entering arbitrary filesystem paths or URIs, view controls, | GVfs, an item for entering arbitrary filesystem paths or URIs, and finally | ||||||
| and finally breadcrumbs leading to the currently opened directory, as well as | breadcrumbs leading to the currently opened directory, as well as descendants | ||||||
| its descendants. | of it.  At the top, there is a toolbar with view controls. | ||||||
| 
 | 
 | ||||||
| <p>You can open items in a new window either by middle clicking on them either | <p>You can open items in a new window either by middle clicking on them, or with | ||||||
| directly, or with the Ctrl key pressed down. Right clicking the directory view | the left mouse button while holding the <kbd>Ctrl</kbd> key. | ||||||
| offers a context menu for opening files, or even the directory itself, | Right clicking the directory view offers a context menu for opening files, | ||||||
| in a different application. | or even the directory itself, in a different application. | ||||||
| 
 | 
 | ||||||
| <h2>Viewer</h2> | <h2>Viewer</h2> | ||||||
| 
 | 
 | ||||||
| <p>The image viewer may be both entered (so long as you have a file selected) | <p>The image viewer may be both entered (so long as you have a file selected) | ||||||
| and exited using the Enter key. This way you may easily switch between the two | and exited using the <kbd>Enter</kbd> key. This way you may easily switch | ||||||
| modes. When using the mouse, the forwards and backwards buttons will fulfill | between the two modes. When using the mouse, the forwards and backwards buttons | ||||||
| the same function. | will fulfill the same function. | ||||||
| 
 | 
 | ||||||
| <p>Double clicking the image switches full-screen view, and the mouse wheel | <p>Double clicking the image switches full-screen view, and the mouse wheel | ||||||
| adjusts the zoom level. | adjusts the zoom level. | ||||||
| @ -96,8 +97,8 @@ rm -rf ~/.cache/thumbnails/wide-* | |||||||
| 
 | 
 | ||||||
| <p>The few configuration options <i>fiv</i> has can be adjusted using | <p>The few configuration options <i>fiv</i> has can be adjusted using | ||||||
| <i>dconf-editor</i>, which can be launched in the appropriate location from | <i>dconf-editor</i>, which can be launched in the appropriate location from | ||||||
| within the application by pressing Ctrl+,. For command line usage, there is | within the application by pressing <kbd>Ctrl</kbd> + <kbd>,</kbd>. | ||||||
| the <i>gsettings</i> utility: | For command line usage, there is the <i>gsettings</i> utility: | ||||||
| 
 | 
 | ||||||
| <pre> | <pre> | ||||||
| gsettings list-recursively name.janouch.fiv | gsettings list-recursively name.janouch.fiv | ||||||
|  | |||||||
| @ -5,4 +5,5 @@ h2 { padding-top: .67em; border-top: 1px solid silver; } | |||||||
| p { line-height: 1.5; } .figure { text-align: center; } img { max-width: 100%; } | p { line-height: 1.5; } .figure { text-align: center; } img { max-width: 100%; } | ||||||
| q { font-style: normal; } .details { border-bottom: 1px solid silver; } | q { font-style: normal; } .details { border-bottom: 1px solid silver; } | ||||||
| .details br { display: none; } .details br + span:before { content: " — "; } | .details br { display: none; } .details br + span:before { content: " — "; } | ||||||
| pre { padding: 0 1em; } | pre { padding: 0 1em; } kbd { border: solid #ccc; border-radius: .25em; | ||||||
|  | 	border-width: 1px 2px 2px 1px; padding: 0 .25em; font-family: inherit; } | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								fiv-io.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								fiv-io.c
									
									
									
									
									
								
							| @ -121,23 +121,28 @@ const char *fiv_io_supported_media_types[] = { | |||||||
| gchar ** | gchar ** | ||||||
| fiv_io_all_supported_media_types(void) | fiv_io_all_supported_media_types(void) | ||||||
| { | { | ||||||
|  | 	GHashTable *unique = | ||||||
|  | 		g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | ||||||
| 	GPtrArray *types = g_ptr_array_new(); | 	GPtrArray *types = g_ptr_array_new(); | ||||||
| 	for (const char **p = fiv_io_supported_media_types; *p; p++) | 	for (const char **p = fiv_io_supported_media_types; *p; p++) | ||||||
| 		g_ptr_array_add(types, g_strdup(*p)); | 		if (g_hash_table_insert(unique, g_strdup(*p), NULL)) | ||||||
|  | 			g_ptr_array_add(types, g_strdup(*p)); | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_GDKPIXBUF | #ifdef HAVE_GDKPIXBUF | ||||||
| 	GSList *formats = gdk_pixbuf_get_formats(); | 	GSList *formats = gdk_pixbuf_get_formats(); | ||||||
| 	for (GSList *iter = formats; iter; iter = iter->next) { | 	for (GSList *iter = formats; iter; iter = iter->next) { | ||||||
| 		gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data); | 		gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data); | ||||||
| 		for (gchar **p = subtypes; *p; p++) | 		for (gchar **p = subtypes; *p; p++) | ||||||
| 			g_ptr_array_add(types, *p); | 			if (g_hash_table_insert(unique, *p, NULL)) | ||||||
|  | 				g_ptr_array_add(types, g_strdup(*p)); | ||||||
| 		g_free(subtypes); | 		g_free(subtypes); | ||||||
| 	} | 	} | ||||||
| 	g_slist_free(formats); | 	g_slist_free(formats); | ||||||
| #endif  // HAVE_GDKPIXBUF
 | #endif  // HAVE_GDKPIXBUF
 | ||||||
| 
 | 
 | ||||||
|  | 	g_hash_table_unref(unique); | ||||||
| 	g_ptr_array_add(types, NULL); | 	g_ptr_array_add(types, NULL); | ||||||
| 	return (char **) g_ptr_array_free(types, FALSE); | 	return (gchar **) g_ptr_array_free(types, FALSE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | ||||||
|  | |||||||
							
								
								
									
										48
									
								
								fiv.c
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								fiv.c
									
									
									
									
									
								
							| @ -2172,40 +2172,56 @@ main(int argc, char *argv[]) | |||||||
| 	const GOptionEntry options[] = { | 	const GOptionEntry options[] = { | ||||||
| 		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, | 		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, | ||||||
| 			NULL, "[PATH | URI]..."}, | 			NULL, "[PATH | URI]..."}, | ||||||
| 		{"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_NONE, &show_supported_media_types, |  | ||||||
| 			"Output supported media types and exit", NULL}, |  | ||||||
| 		{"browse", 0, G_OPTION_FLAG_IN_MAIN, | 		{"browse", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
| 			G_OPTION_ARG_NONE, &browse, | 			G_OPTION_ARG_NONE, &browse, | ||||||
| 			"Start in filesystem browsing mode", NULL}, | 			"Start in filesystem browsing mode", NULL}, | ||||||
| 		{"thumbnail-for-search", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_STRING, &thumbnail_size_search, |  | ||||||
| 			"Output an image file suitable for searching by content", "SIZE"}, |  | ||||||
| 		{"extract-thumbnail", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_NONE, &extract_thumbnail, |  | ||||||
| 			"Output any embedded thumbnail (superseding --thumbnail)", NULL}, |  | ||||||
| 		{"thumbnail", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_STRING, &thumbnail_size, |  | ||||||
| 			"Generate thumbnails, up to SIZE, and output that size", "SIZE"}, |  | ||||||
| 		{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN, | 		{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
| 			G_OPTION_ARG_NONE, &invalidate_cache, | 			G_OPTION_ARG_NONE, &invalidate_cache, | ||||||
| 			"Invalidate the wide thumbnail cache", NULL}, | 			"Invalidate the wide thumbnail cache", NULL}, | ||||||
|  | 		{"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_NONE, &show_supported_media_types, | ||||||
|  | 			"Output supported media types and exit", NULL}, | ||||||
| 		{"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, | 		{"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, | ||||||
| 			&show_version, "Output version information and exit", NULL}, | 			&show_version, "Output version information and exit", NULL}, | ||||||
| 		{}, | 		{}, | ||||||
| 	}; | 	}; | ||||||
|  | 	const GOptionEntry options_internal[] = { | ||||||
|  | 		{"extract-thumbnail", 0, 0, | ||||||
|  | 			G_OPTION_ARG_NONE, &extract_thumbnail, | ||||||
|  | 			"Output any embedded thumbnail (superseding --thumbnail)", NULL}, | ||||||
|  | 		{"thumbnail", 0, 0, | ||||||
|  | 			G_OPTION_ARG_STRING, &thumbnail_size, | ||||||
|  | 			"Generate thumbnails, up to SIZE, and output that size", "SIZE"}, | ||||||
|  | 		{"thumbnail-for-search", 0, 0, | ||||||
|  | 			G_OPTION_ARG_STRING, &thumbnail_size_search, | ||||||
|  | 			"Output an image file suitable for searching by content", "SIZE"}, | ||||||
|  | 		{}, | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	GOptionContext *context = | ||||||
|  | 		g_option_context_new(" - Image browser and viewer"); | ||||||
|  | 	g_option_context_add_group(context, gtk_get_option_group(TRUE)); | ||||||
|  | 	g_option_context_add_main_entries(context, options, NULL); | ||||||
|  | 
 | ||||||
|  | 	GOptionGroup *internals = g_option_group_new( | ||||||
|  | 		"internal", "Internal Options:", "Show internal options", NULL, NULL); | ||||||
|  | 	g_option_group_add_entries(internals, options_internal); | ||||||
|  | 	g_option_context_add_group(context, internals); | ||||||
| 
 | 
 | ||||||
| 	GError *error = NULL; | 	GError *error = NULL; | ||||||
| 	gboolean initialized = gtk_init_with_args( | 	gboolean initialized = | ||||||
| 		&argc, &argv, " - Image browser and viewer", options, NULL, &error); | 		g_option_context_parse(context, &argc, &argv, &error); | ||||||
|  | 	g_option_context_free(context); | ||||||
| 	if (show_version) { | 	if (show_version) { | ||||||
| 		const char *version = PROJECT_VERSION; | 		const char *version = PROJECT_VERSION; | ||||||
| 		printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']); | 		printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (show_supported_media_types) { | 	if (show_supported_media_types) { | ||||||
| 		for (char **types = fiv_io_all_supported_media_types(); *types; ) | 		char **types = fiv_io_all_supported_media_types(); | ||||||
| 			g_print("%s\n", *types++); | 		for (char **p = types; *p; p++) | ||||||
|  | 			g_print("%s\n", *p); | ||||||
|  | 		g_strfreev(types); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (invalidate_cache) { | 	if (invalidate_cache) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user