-2

How to set ALL mime types to open with the same program, like this:

xdg-mime default someprogram.desktop */*

In a single command, in others words.

xdg-mime default <my program> <ALL MIME TYPES>

Or any solution, wilcard, to set all files open with my program someprogram.desktop

  • I will try thanks, i give u my comment if it works :) – vudaluzusa Apr 3 at 6:56
  • ctrl-alt-delor Sorry, not work ".", i already try, and unfortunally all applications continue running with the default programs, not with my program :( – vudaluzusa Apr 3 at 7:02
  • Oh no, i already test with your method using (*.*), but unfortunately not works, why?, maybe because xdg-mime not use wildcard, maybe too because xdg-mime uses not a file extension(*.*), xdg-mime uses MIME Type, then if xdg-mime not use the file extension then the xdg-mime will not recognize the method (*.*) – vudaluzusa Apr 3 at 7:13
  • 1
    @ctrl-alt-delor: the examples in the question are not lines in a configuration file, but actual commands. xdg-mime(1) is a command for accessing/modifying the freedesktop.org shared MIME database. It is a collection of XML files, and the suggested standard location for it would be /usr/share/mime. – telcoM Apr 3 at 7:30
  • 1
    No, no, no, no, and no. You are not listening. When I ask a question of clarification, this is a question, not some coded statement of help. I did not “mean” anything about any file. – ctrl-alt-delor Apr 3 at 7:39
1

After a quick peek to /usr/share/mime/, it looks like this might do the trick:

xdg-mime default <my program> all/allfiles

If you want it to accept not just files, but folders too, replace all/allfiles with all/all.

  • In globs file i can add a custom mime like "custom-mime/some-mime:*.*"? – vudaluzusa Apr 3 at 7:37
  • If you edit the globs file, your edit will be overwritten as soon as some update or package installation causes update-mime-database to be executed. The right way would be to create an appropriate XML file and let update-mime-database copy the information from it to the globs file. See Freedesktop.org tutorial for adding MIME types. – telcoM Apr 3 at 7:50
  • Im writing the xml file... one sec... – vudaluzusa Apr 3 at 7:57
  • Success, i already made a xml file named "all_all.xml", Where i have to move this file? into /usr/share/mime/application or in the root directory "/usr/share/mime"? – vudaluzusa Apr 3 at 8:03
  • 1
    Note that there are two separate things in play: /usr/share/mime is the system-wide database of what the various MIME types are, how they can be recognized and what can be done with each of them. It is distinct from the determination of what is the preferred tool for any file type, which should be a per-user configurable setting (at ~/.config) with obviously some system-wide defaults (at /etc/xdg). Unfortunately, the freedesktop.org specification for this seems to be unfinished at this time, so the older desktop-environment-specific configuration methods might still apply. – telcoM Apr 3 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.