mimeo

2014-03-27 19:21 UTC
  • Xyne

Metadata

Description:

Open files by MIME-type or file name using regular expressions.

Latest Version:

2013.7.24

Architecture:

  • any

Dependencies:

  • python2
  • python2-xdg
  • file

Optional Dependencies:

  • MIME-types: for recognizing more MIME-types

Arch Repositories:

  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]

AUR ID:

32911

Arch Forum ID:

86855

Tags:

About

Mimeo uses MIME-type file associations to determine which application should be used to open a file. It can launch files or print information such as the command that it would use, the detected MIME-type, etc. It is also possible to use regular expressions to associate arguments with applications. The most common example is to open URLs in browsers or associate file extensions with applications irrespective of their MIME-type.

Mimeo tries to adhere to the relevant standards on freedesktop.org and should therefore be compatible with other applications that set or read MIME-type associations, e.g. PCManFM.

Please notify the author of any non-standard behavior so that it can be corrected.

See mimeo --help for options and usage information.

Editing MIME-types

Mimeo is able to update MIME-type associations (add, remove, clear) and configure defaults. It can also update MIME-cache files and check for invalid desktop entries. See "mimeo --help" for more information.

Examples

Associate shell scripts with Leafpad.

test is an extensionless Bash script.

# find Leafpad's desktop file
> mimeo --app2desk leafpad
leafpad
  leafpad.desktop  /usr/share/applications/leafpad.desktop

# determine "test" file's MIME-type
> mimeo -m test
test
  text/x-shellscript

# associate "text/x-shellscript" with Leafpad
> mimeo --add text/x-shellscript leafpad.desktop

Association File Examples

These are just a few quick examples of how to create associations using the associations file. See "mimeo --assoc-help" for more information.

Open URLs with Firefox:

/usr/bin/firefox %U
  ^http://

Open the following files with medit by extension: Perl (.pl), Python (.py), Haskell (.hs)

/usr/bin/medit %F
  \.p[ly]%
  \.hs%

Open various media files in VLC by extension:

/usr/bin/vlc --one-instance --playlist-enqueue %F
  \.mp3$
  \.flac$
  \.avi$
  \.mpg$
  \.flv$

Help Message

$ mimeo --help

usage: mimeo [options] [<arg> ...]

Open files using MIME-type associations.

positional arguments:
  <arg>

Operations:
  If no operation is specified, the commands determined by "--command" will
  be run, i.e. the passed arguments will be opened.

  -h, --help            Display this help message and exit.
  --assoc-help          Display information about the custom associations
                        file.
  --mimeman-help        Display information about managing MIME-type
                        associations.
  -c, --command         Print the full command(s) and exit.
  -d, --desktop         Print the associated desktop file names and paths and
                        exit.
  -m, --mimetype        Print the detected MIME-type(s) and exit.
  --app2desk            List desktop files that use the given executables and
                        exit.
  --purge {nothing,hide,delete}
                        Check desktop files and update associations and cache
                        files. The parameter determines the action to take for
                        invalid desktop files. "nothing": Do nothing with the
                        invalid desktop files. "hide": Insert "Hidden=True" in
                        invalid desktop files. "delete": Attempt to delete
                        invalid desktop files. "--system" can be used to
                        restrict the operation to system files when running as
                        root.
  --update              Update associations and cache files.
  --add <MIME-type matcher> [<desktop.file> ...]
                        Associate MIME-types with desktop files. See
                        "--mimeman-help" for more information.
  --remove <MIME-type matcher> [<desktop.file> ...]
                        Remove associations by adding them to the "Removed
                        Associations" section of mimeapps.list. This can
                        effectively hide system-associations for the user.
                        This does not affect default. Use "--clear" to forget
                        a user-association. See "--mimeman-help" for more
                        information.
  --clear <MIME-type matcher> [<desktop.file> ...]
                        Clear associations. If no desktop files are specified,
                        all associations for the MIME-type(s) will be cleared.
                        This affects defaults. See "--mimeman-help" for more
                        information.
  --prefer <MIME-type matcher> <desktop.file>
                        Set a default association. See "--mimeman-help" for
                        more information.
  --unprefer <MIME-type matcher> <desktop.file>
                        Unset a default association. See "--mimeman-help" for
                        more information.
  --create <desktop.file> <Name> <Exec> [<MIME-type matcher> | ""]
                        Create a minimal desktop file. Edit the created file
                        if necessary. If an empty string is passed instead of
                        a MIME-type matcher, the file will not specify any
                        MIME-type associations. See "--mimeman-help" for more
                        information.

Configuration:
  Various configuration options.

  -a <filepath>, --assoc <filepath>
                        Specify a file that associates regular expressions
                        with custom commands. This can be used for opening
                        URLs, for example. See "--assoc-help" for details.
  --system              Restrict operations to system files. This is mostly
                        useful for updating system desktop files and MIME
                        information as root.
  -q, --quiet           Suppress all output from launched applications.
  --term <cmd>          Terminal command to use when launching applications
                        with desktop files that specify "Terminal=true". If
                        the command contains the substring "%s" then it will
                        be replaced with the command, otherwise the arguments
                        will be appended to the end of the command. Example:
                        "urxvtc -e %s". If "%s" is wrapped in single quotes
                        ('%s') then the command will be quoted.

CHANGELOG

2011-04-25

  • added "--quiet" option to suppress output when running applications

2011-03-12

  • loading of desktop files in subdirectories & further standard-compliance
  • URI handling via "x-scheme-handle/*" MIME-types
  • special handling of 'file' URIs
  • new output format for some operations

2011-02-22

Mimeo subsumed Mimeman's functionality, with needed corrections. Mimeman was a dirty kludge created without any knowledge of the standard. Mimeo is now able to manage MIME-type associations and create desktop files.

Mimeo's algorithm for determing associations has also been corrected in several places.

Contact
echo xyne.archlinux.ca | sed 's/\./@/'
Feeds
Blog News
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0