You are not logged in.

#176 2016-12-30 02:41:07

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,376
Website

Re: mimeo: open files by mimetype or file name

Sorry for the delayed response.

Without an example, I do not know what you were trying to do (e.g. clear all associations for a MIME-type, all associations for a desktop file or a combination of MIME-types and a desktop file). Looking at the code I found 2 bugs that prevented clearing all associations for a given MIME-type. Those have been fixed and the following now works: "mimeo --clear foo/bar".

The default behavior for clearing a desktop's associations may be counter-intuitive: "mimeo --clear foo.desktop" will remove "foo.desktop" from all MIME-types listed in the desktop file. To completely clear "foo.desktop", use "mimeo --clear 'glob:*' foo.desktop". I have updated the help message to make this clearer. I hesitated to make this behavior the default with this update but the current behavior is coherent with the other operations and keeps the common function simple.

If neither the bug fix nor the usage clarification address your issue, please post a specific example with relevant entries from the mimeapps.list file.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#177 2017-01-27 23:46:38

Alad
Wiki Admin/IRC Op/TU
From: Bagelstan
Registered: 2014-05-04
Posts: 1,863
Website

Re: mimeo: open files by mimetype or file name

I'm having an issue when a document has a subtype of a particular mime type, i.e. image/vnd.djvu+multipage instead of image/vnd.djvu:

[archie@thinkpad ~]$ mimeo --show-all KnuthII.djvu
WARNING: failed to determine command precursor for KnuthII.djvu
WARNING: failed to determine command(s) for KnuthII.djvu
[archie@thinkpad ~]$ mimeo -m KnuthII.djvu
KnuthII.djvu
  image/vnd.djvu+multipage
[archie@thinkpad ~]$ file --mime-type KnuthII.djvu
KnuthII.djvu: image/vnd.djvu

cf. this qpdfview bug where the author decided to match all subtypes:

https://bugs.launchpad.net/qpdfview/+bug/1515018

Not sure if a given desktop file should contain subtypes of a given MIME type, or if the opener should simply count those as part of the main mime type. Also the guy who broke it:

https://mail.gnome.org/archives/commits … 07514.html


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Honest Alad's Package Emporium—Now with added bugs! (Grand reopening: December 1st 2018)

Offline

#178 2017-01-29 12:13:46

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,376
Website

Re: mimeo: open files by mimetype or file name

I was unaware that MIME-types may consist of the following:

Wikipedia wrote:
top-level type name / subtype name [ ; parameters ]
top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]

When I have the time, I will add a full MIME-type parser to handle the different components and default to using the main type if no association exists for the subtype. In the meantime, just add associations for each fully qualified type.

I may also add an option to create associations directly from a path argument.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#179 2017-01-29 14:45:45

Alad
Wiki Admin/IRC Op/TU
From: Bagelstan
Registered: 2014-05-04
Posts: 1,863
Website

Re: mimeo: open files by mimetype or file name

Nice, looking forward to the change. big_smile


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Honest Alad's Package Emporium—Now with added bugs! (Grand reopening: December 1st 2018)

Offline

#180 2017-02-09 23:51:55

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,376
Website

Re: mimeo: open files by mimetype or file name

Both changes have been implemented. If testing for filepath arguments leads to conflicts then I will revert to the previous behavior and add an option to enable this new behavior.

Usage example:

mimeo --prefer /path/to/some/movie.mkv vlc.desktop

Qualified MIME-types (e.g. foo/bar+wuz) will default to unqualified associations (e.g. foo/bar) if no qualified associations are found.

Let me know if you find a bug.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#181 2017-11-01 22:48:00

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,900
Website

Re: mimeo: open files by mimetype or file name

Hmm, mimeo does not use ~/.config/mimeo.conf for me, I have to specify it with the -a option.

Even when I try to run it with

XDG_CONFIG_HOME="$HOME/.config" mimeo foobar

it does not use the config.


**EDIT** (Reading is hard)

--filepath-help showed me the way...

 custom associations, in order:
   /home/carnager/.config/mimeo/associations.txt
   /etc/xdg/mimeo/associations.txt

Last edited by Rasi (2017-11-01 23:31:36)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#182 2018-09-17 23:42:49

Sathors
Member
Registered: 2011-02-23
Posts: 48

Re: mimeo: open files by mimetype or file name

Maybe a dumb question, but is there any way to open terminal applications (like vim) using mimeo, but in the same shell instead of opening another window?

Currently I have my default arguments set to "--term 'urxvtc -e %s'", but it creates another window with urxvt.

Offline

#183 2018-10-16 14:46:20

arnaudv6
Member
Registered: 2016-02-25
Posts: 48

Re: mimeo: open files by mimetype or file name

Sathors, could you describe a bit more what steps you are following?

Offline

#184 2018-10-31 20:04:44

Sathors
Member
Registered: 2011-02-23
Posts: 48

Re: mimeo: open files by mimetype or file name

For example, I have text/plain associated to neovim.

With my default arguments ("--term 'urxvtc -e %s'") set in .config/mimeo/default_arguments.txt, when I issue a

mimeo my_file.txt

, it opens another instance of urxvt and opens neovim there. I would like for mimeo to open neovim in the same shell, then once I quit the neovim process, get the prompt back.

I have tried many different things and I was not able to get it to work.

This problem is independant of neovim itself, I only want to open --term commands in the same shell.

Offline

#185 2018-11-04 03:16:52

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,376
Website

Re: mimeo: open files by mimetype or file name

@Sathors
The "--term" option determines how terminal applications are opened. If you set it to "urxvtc -e %s",then every time mimeo detects that a file should be opened with vim in the terminal, it will run "urxvtc -e vim ..." and launch a new urxvt window. Just omit that option to have to run vim directly in the same terminal (and return to it when vim exits).

Note that by removing that option, any non-terminal application that launches a terminal application via mimeo will not show it to the user (and will probably freeze waiting for the command to finish). I suggest leaving your current default arguments and creating a separate alias for working in a terminal.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#186 2018-11-05 16:08:28

Sathors
Member
Registered: 2011-02-23
Posts: 48

Re: mimeo: open files by mimetype or file name

@Xyne

I have removed everything from my default_arguments.

But now when I run

mimeo my_file.txt

, it does open neovim in the current shell, but hitting any key gets me back to the prompt. It seems that mimeo is not waiting for neovim to quit. The key I hit while seeing nvim interface is actually written on the prompt. The neovim session gets killed when hitting the key.

Any idea?

Offline

#187 Yesterday 00:02:53

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,376
Website

Re: mimeo: open files by mimetype or file name

Sathors wrote:

@Xyne
Any idea?


Nope. Does the same happen with regular vim?


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#188 Today 15:33:12

Sathors
Member
Registered: 2011-02-23
Posts: 48

Re: mimeo: open files by mimetype or file name

Well at least by using vim, I am beginning to see a real error.

+ ~$ mimeo --command work/gtd/retrospectives.md
vim work/gtd/retrospectives.md
+ ~$ mimeo work/gtd/retrospectives.md  
Vim: Error reading input, exiting...              
                                      
Vim: Finished.
+ ~$ vim work/gtd/retrospectives.md 

So mimeo explicitly states that it will run `vim work/gtd/retrospectives.md`. When I run mimeo (with vim instead of nvim), I get exactly the same behavior (vim terminates on first keyboard input), but at least the error gets echoed explicitly in the terminal. When I run the command myself, everything works as expected.

Just to be sure I disabled my .vimrc and my .vim directory.

Could it be something with the TERM variable that mimeo sets or something along those lines?

Last edited by Sathors (Today 15:34:40)

Offline

Board footer

Powered by FluxBB