{ "info": { "author": "Esa M\u00e4\u00e4tt\u00e4", "author_email": "esa.maatta@iki.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "pyxdg-open\n==========\n\nPython xdg-open (from xdg-utils_) clone. Basically determines how to open and\nthen opens given URL using system desktop files. It features customizable search\norder, custom mime to application call or to desktop file mappings and proper\nopening of multiple files. It also supports list files (like defaults.list), so\nit should work as expected out of the box with the default config_.\n\nMotivation for this is to provide file opener which works well without a popular\ndesktop environment and still supports `Desktop Entry Specification`_. Also it's\ngood to provide something which doesn't have plethora of escaping or other input\nrelated bugs, e.g. `xdg-open: be more paranoid in escaping`_. This is much\neasier and cleaner to achieve in Python than in Bash.\n\nExample config_ file:\n\n.. code-block:: ini\n\n # Example config file, by default it should be located at:\n # ~/.config/pyxdg-open/pyxdg-open.conf\n #\n # Paths where to search for desktop files in order of preference. It's a comma\n # separated list.\n desktop_file_paths = ~/.local/share/applications/,\n /usr/share/applications/,\n /usr/local/share/applications/\n \n # List files under desktop_file_paths which are first searched for desktop\n # files. If this is empty no list files are used.\n list_files = mimeapps.list,\n defaults.list\n \n # If default terminal emulator is not specified then first desktop file with\n # TerminalEmulator as Category will be used.\n #default_terminal_emulator = urxvtc\n \n # Default search order. This means, first use list_files to find the appropriate\n # desktop file and if not found, proceed to searching desktop files from desktop\n # file paths.\n search_order = list_files,\n desktop_file_paths\n \n # An example of a custom search which can be added to the 'search_order' list,\n # in this case, with name 'my_own_mappings'.\n #\n # Matching can be done with either mime type or file name ending. Mime type can\n # be either full \"type/subtype\", or partial \"type/\" or \"/subtype\".\n #\n # Target can be either a command to which file name is appended before\n # executing, or relative, or absolute path to a desktop file. Relative paths are\n # interpreted to be relative to given desktop_file_paths.\n # There's a special command '!bashwrap' which wraps following executable with\n # bash, for more information see:\n # http://wor.github.io/bash/2013/07/26/start-bash-and-terminal-program.html\n # A command target supports also Desktop file specifiactions Exec value field\n # keys \"%f\", \"%F\", \"%u\" and \"%U\". If no field key is given \"%F\" is appended to\n # the command by default.\n #[my_own_mappings]\n #application/pdf = zathura\n #video/ = vlc %U\n #audio/ = vlc %U\n #rar = file-roller\n #text/plain = !bashwrap vim\n #tar.gz = /tmp/some_app.desktop\n #inode/directory = urxvtc.desktop\n\n\u00b4search_order\u00b4 defines the order of desktop file searches. By default the\ndesktop files are first searched from the list files located in the\n\u00b4desktop_file_paths\u00b4 (\u00b4list_files\u00b4 must be defined). Second the desktop files\nare searched normally from the defined \u00b4desktop_file_paths\u00b4.\n\npyxdg-open also support mimi_ like custom configs which can be added to the\n\u00b4search_order\u00b4 list.\n\nIf \u00b4desktop_file_paths\u00b4 are searched for the desktop file then the first desktop\nfile which has the matching mime type listed is selected. If there are many\ndesktop files which match certain mime type and one desktop file is preferred,\nthen the option is to add the mime type, desktop file pair to mimeapps.list or\ndefaults.list file. Another way is to just add own custom mappings to the config\nfile as seen from the example and add this sections name as first in the\n\u00b4search_order\u00b4 list.\n\nExamples\n--------\n\nPrint all found desktop files, which open PDF files without really opening\nanything. Useful for finding all possible desktop files, in this case for PDF:\n\n.. code-block:: bash\n\n $ pyxdg-open --dryrun --print-found some.pdf\n Found desktop files:\n /usr/share/applications/zathura.desktop [list_files]\n /usr/share/applications/zathura.desktop [desktop_file_paths]\n /home/wor/.local/share/applications/wine-extension-pdf.desktop [desktop_file_paths]\n /usr/share/applications/xpdf.desktop [desktop_file_paths]\n /usr/share/applications/zathura-pdf-poppler.desktop [desktop_file_paths]\n /usr/share/applications/gimp.desktop [desktop_file_paths]\n\n\nLet's say that I have following in my config file:\n\n.. code-block:: ini\n\n ...\n search_order = my_own_mappings,\n list_files,\n desktop_file_paths\n\n [my_own_mappings]\n application/pdf = zathura.desktop\n audio/ = vlc.desktop\n ...\n\nNow running following runs correctly vlc with two parameters, so that both audio\ntracks end up in the vlc playlist. This is because default \u00b4vlc.desktop\u00b4 file\nhas \u00b4%U\u00b4 in the `Exec key`_ value. If this had been, for example, \u00b4%u\u00b4 or \u00b4%f\u00b4,\ntwo instances of vlc would be launched simultaneously playing \u00b4track01.mp3\u00b4 and\n\u00b4track02.mp3\u00b4:\n\n.. code-block:: bash\n\n $ pyxdg-open -v1 --dryrun track01.mp3 track02.mp3\n ...\n INFO:run_exec:613: Calling exec string: /usr/bin/vlc track01.mp3 track02.mp3\n\nAs \u00b4zathura.desktop\u00b4 contains \u00b4%f\u00b4 in the Exec string, only one file is\naccepted and pyxdg-open launches two instances:\n\n.. code-block:: bash\n\n $ pyxdg-open -v1 --dryrun test0.pdf test1.pdf\n ...\n INFO:run_exec:613: Calling exec string: zathura /tmp/test0.pdf\n INFO:run_exec:613: Calling exec string: zathura /tmp/test1.pdf\n\nThis also works correctly with following, as can be seen:\n\n.. code-block:: bash\n\n $ pyxdg-open -v1 --dryrun test0.pdf test1.pdf audio.mp3 audio.flac\n ...\n INFO:run_exec:613: Calling exec string: /usr/bin/vlc audio.mp3 audio.flac\n ...\n INFO:run_exec:613: Calling exec string: zathura /tmp/test0.pdf\n INFO:run_exec:613: Calling exec string: zathura /tmp/test1.pdf\n\nEasy install\n------------\n\nExample of a simple user install:\n\n.. code-block:: bash\n\n python3 setup.py install --exec_name=\"xdg-open\" --user\n\nThe executable console script name can be controlled with the \u00b4--exec_name=\u00b4\nargument. The default is \u00b4pyxdg-open\u00b4. The executable script in this example\nis placed in \u00b4$HOME/.local/bin\u00b4 which can be added to the PATH variable if\nneeded. This also installs needed dependencies.\n\nArchlinux PKGBUILD\n------------------\n\nPKGBUILD files for pyxdg-open and it's dependencies can be found from my\n`abs-repo `_:\n`pyxdg-open-git `_\nand\n`python-desktop-file-parser-git\n`_\n\nBy default the pyxdg-open-git conflicts with xdg-utils as it uses\n--exec_name=\u00b4xdg-open\u00b4. The abs repo also contains a PKGBUILD for xdg-utils\nwhich does not have \u00b4xdg-open\u00b4:\n`xdg-utils-without-open `_\n\nDependencies\n------------\n\n* `desktop_file_parser `_\n\nOptional Dependencies\n---------------------\n\n* `file `_ >> `Arclinux AUR package for python\n magic bindings `_ >>\n `Alternative pypi package magic bindings \n `_\n\nAt the moment pyxdg-open works better with \u00b4python-magic\u00b4 than, with the default\npython mimetypes library which is used only if \u00b4python-magic\u00b4 is not found.\n\nSimilar Programs\n----------------\n\n* mimi_\n* `buskin `_\n\n`List of xdg-open replacements on Archlinux wiki`_\n\nTODO\n----\n\n* Document differences to similar programs\n* Read desktop cache files\n* Add missing xdg-open functionality\n\n.. _xdg-utils: http://cgit.freedesktop.org/xdg/xdg-utils/\n.. _config: https://github.com/wor/pyxdg-open/blob/master/pyxdg-open.conf\n.. _`Desktop Entry Specification`: http://standards.freedesktop.org/desktop-entry-spec/latest/\n.. _`Exec key`: http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html\n.. _`xdg-open: be more paranoid in escaping`: http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=2373d9b2b70652e447b413cde7939bff42fb960d\n.. _`List of xdg-open replacements on Archlinux wiki`: https://wiki.archlinux.org/index.php/Xdg-open#xdg-open_replacements\n.. _mimi: https://github.com/taylorchu/mimi", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wor/pyxdg-open", "keywords": "python library desktop", "license": "GPL3", "maintainer": null, "maintainer_email": null, "name": "pyxdg-open", "package_url": "https://pypi.org/project/pyxdg-open/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyxdg-open/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/wor/pyxdg-open" }, "release_url": "https://pypi.org/project/pyxdg-open/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Opens URL or file in user preferred application (xdg-open replacement).", "version": "0.2.1" }, "last_serial": 1183250, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "6b04274dd413de74c70a4c2d32fda4d0", "sha256": "8bef116c386aa063d4b3aab43624311426719f8ce69fb3d4a4bab03156f58677" }, "downloads": -1, "filename": "pyxdg_open-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6b04274dd413de74c70a4c2d32fda4d0", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 20909, "upload_time": "2014-08-07T19:26:53", "url": "https://files.pythonhosted.org/packages/21/c3/12e25194539d5b8d26f76f7ab6c2d045d9e2dbef49305adc2e078dfdfdf3/pyxdg_open-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "27eb3677cab3cc3c28bf7b0185387e94", "sha256": "f1fefd9c63fc3d55093158512a6dfa87d366e38b0cede08bb42bd89667469c42" }, "downloads": -1, "filename": "pyxdg-open-0.2.tar.gz", "has_sig": false, "md5_digest": "27eb3677cab3cc3c28bf7b0185387e94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29935, "upload_time": "2014-08-07T19:26:49", "url": "https://files.pythonhosted.org/packages/8b/6c/b58acc68e8ed7f090f2056f63284409362ed4bd883eda2fdd2f3bdf5eef2/pyxdg-open-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "80e2612be44c43bd51f967f4c6d5b0df", "sha256": "3b531f0ebebe5bdb77c49135f15f96babe9d7ef2856d8e3fe2644782b4de82f8" }, "downloads": -1, "filename": "pyxdg_open-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "80e2612be44c43bd51f967f4c6d5b0df", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 20993, "upload_time": "2014-08-07T19:42:25", "url": "https://files.pythonhosted.org/packages/04/8b/9493561a8b42b3ba56d2ccf41d5e2f12ab4650fa14a71eb6c0085c7a93e6/pyxdg_open-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edbb89df9c8fbcb1638b8c2302902177", "sha256": "b3681d28647368497cfe1cbc49638274d6b470b062dde303eb3ad5b75b5ef307" }, "downloads": -1, "filename": "pyxdg-open-0.2.1.tar.gz", "has_sig": false, "md5_digest": "edbb89df9c8fbcb1638b8c2302902177", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29950, "upload_time": "2014-08-07T19:42:22", "url": "https://files.pythonhosted.org/packages/9c/c9/1c96273e4d9665c12ca5893d9dd41177ad4932bebee18850c978de0ea4ba/pyxdg-open-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "80e2612be44c43bd51f967f4c6d5b0df", "sha256": "3b531f0ebebe5bdb77c49135f15f96babe9d7ef2856d8e3fe2644782b4de82f8" }, "downloads": -1, "filename": "pyxdg_open-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "80e2612be44c43bd51f967f4c6d5b0df", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 20993, "upload_time": "2014-08-07T19:42:25", "url": "https://files.pythonhosted.org/packages/04/8b/9493561a8b42b3ba56d2ccf41d5e2f12ab4650fa14a71eb6c0085c7a93e6/pyxdg_open-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edbb89df9c8fbcb1638b8c2302902177", "sha256": "b3681d28647368497cfe1cbc49638274d6b470b062dde303eb3ad5b75b5ef307" }, "downloads": -1, "filename": "pyxdg-open-0.2.1.tar.gz", "has_sig": false, "md5_digest": "edbb89df9c8fbcb1638b8c2302902177", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29950, "upload_time": "2014-08-07T19:42:22", "url": "https://files.pythonhosted.org/packages/9c/c9/1c96273e4d9665c12ca5893d9dd41177ad4932bebee18850c978de0ea4ba/pyxdg-open-0.2.1.tar.gz" } ] }