Skip to content

sde-gui/simple-file-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple File Info

A small POSIX shell script that shows a rich, human‑readable report about one or more files. It aggregates metadata from common CLI tools (mimetype, file, exiftool, mediainfo, gio) and displays the result in a GUI dialog (yad, zenity, Xdialog, xmessage, gxmessage) or prints it to stdout.

Works great with lightweight file managers that lack a built‑in “Properties / detailed metadata” view. A desktop file is included so that file managers can expose “Open With → Simple File Info”.

  • Shell: pure POSIX sh (tested on ksh “The Original AT&T Korn Shell”)
  • Lint: passes shellcheck -s sh
  • No hard dependencies; it uses whatever tools you have installed

Features

  • Collects file information from:
    • MimeInfo DB via mimetype
    • file database (file -i and description)
    • exiftool (rich metadata for many file types)
    • mediainfo (audio/video metadata, some image metadata)
    • gio info (GIO/GVFS attributes)
  • Shows the combined report in a GUI dialog using the first available backend:
    • gxmessage, yad, Xdialog, zenity, xmessage (in that default order)
  • CLI mode to print reports to stdout
  • Automatic tool detection with per‑tool overrides via environment variables
  • Desktop integration (Open With)

Installation

  1. Copy the script somewhere in your PATH and make it executable:

    # system-wide:
    install -m 0755 simple-file-info /usr/local/bin/
    # or per-user:
    cp simple-file-info ~/.local/bin/simple-file-info && chmod +x ~/.local/bin/simple-file-info
  2. Optional: install the provided .desktop file for “Open With” integration:

    # system-wide:
    simple-file-info --desktop-entry > /usr/local/share/applications/simple-file-info.desktop
    # or per-user:
    simple-file-info --desktop-entry > ~/.local/share/applications/simple-file-info.desktop

Usage

simple-file-info [command] files...

Commands:

  • --show-report Show a GUI window with the report for each file (default if no command is given)
  • --print-report Print the report to stdout
  • --show-help Show the help text in a GUI window
  • --help Print the help text to stdout and exit
  • --version Print program version and exit
  • --license Print license text and exit
  • --check-tools Print a diagnostic report about external tools
  • --desktop-entry Print the contents of the built-in desktop entry.

Examples:

# Open a GUI report window for one file
simple-file-info --show-report ./movie.mkv

# Open multiple windows (one per file)
simple-file-info file1.jpg file2.mp4 file3.pdf

# Print to stdout (no GUI required)
simple-file-info --print-report ./photo.jpg

# Troubleshoot detection of tools
simple-file-info --check-tools

Note:

  • When multiple files are given with --show-report, the script opens one window per file.

Configuration

You can control which reporting tools and which dialog backends are used, and in what order.

  • Reporting tools (defaults):
    SIMPLE_FILE_INFO_REPORT_TOOLS='MIMETYPE FILE EXIFTOOL MEDIAINFO GIO'
    
  • Dialog backends (defaults):
    SIMPLE_FILE_INFO_DIALOG_TOOLS='GXMESSAGE YAD XDIALOG ZENITY XMESSAGE'
    

Override the order or disable a tool by adjusting environment variables before running the script:

# Prefer YAD, then ZENITY, then fall back to GXMESSAGE
export SIMPLE_FILE_INFO_DIALOG_TOOLS='YAD ZENITY GXMESSAGE'

# Use only file(1) and exiftool for the report
export SIMPLE_FILE_INFO_REPORT_TOOLS='FILE EXIFTOOL'

Each tool is controlled by a few environment variables:

  • Command name/path: MIMETYPE, FILE, EXIFTOOL, MEDIAINFO, GIO, YAD, ZENITY, XDIALOG, XMESSAGE, GXMESSAGE
  • Version check option: <TOOL>_VEROPT (e.g. EXIFTOOL_VEROPT=-ver)
  • Expected exit code of the version check (rarely needed): <TOOL>_VEROPT_EXIT_CODE
  • You can also force-disable a tool by setting <TOOL>_ENABLED=f (or force-enable with t)

Examples:

# Point to a non-default exiftool binary
export EXIFTOOL=/opt/exiftool/bin/exiftool

# YAD reports its version with a non-zero exit; this is already handled by default:
# export YAD_VEROPT=--version
# export YAD_VEROPT_EXIT_CODE=252

# Completely disable mediainfo
export MEDIAINFO_ENABLED=f

The script will only include sections for tools that are detected and successfully run.


Compatibility

  • Tested on Arch Linux with “The Original AT&T Korn Shell” (http://kornshell.org/)
  • Should run on any POSIX‑compliant sh
  • Linted with shellcheck -s sh

GUI mode requires at least one dialog backend (gxmessage, yad, Xdialog, zenity, xmessage). CLI mode (--print-report) requires none of those.


Known limitations and backend quirks

  • YAD
    • Does not choose a sensible default window size/position
  • ZENITY
    • Does not choose a sensible default window size/position
    • Cannot change the window icon
    • GNOME look & feel may not match the intended style
  • Xdialog
    • --fixed-font may not work on some systems
    • May show on the “primary” monitor instead of the one with the active window
    • Cannot change the window icon
  • xmessage
    • No CLIPBOARD copy support (PRIMARY only)
    • Cannot change the window icon
    • No line wrapping for long lines
    • No Unicode support
  • gxmessage
    • Cannot change the window icon

Roadmap / TODO

  • User‑defined custom action buttons in the dialog
  • Pluggable, user‑defined report handlers inside generate_report
  • Smarter window sizing and positioning for yad/zenity

Contributions are welcome!


License

See LICENSE for details.


About

Show detailed information about files using mimetype, file, exiftool, mediainfo and gio

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages