You are not logged in.

#201 2019-11-15 08:36:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 14,001

Re: mimeo: open files by mimetype or file name

You have to rebuild mimeo against python 3.8 explicitly, or wait for xyne to rebuild if you got it from their repo. The latest release is 2019.07 so doesn't look deprecated to me

Last edited by V1del (2019-11-15 08:37:20)

Offline

#202 2019-11-18 22:57:52

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

Re: mimeo: open files by mimetype or file name

Follow the discussion about rebuilding for Python 3.8 here. If it's not done by tomorrow night, nag me about it there smile


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

Offline

#203 2021-02-11 00:13:28

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

I realized xdg-open can "run" desktop files directly, and it seem like mimeo don't. This is what I got from running a desktop file generated by my web browser

WARNING: failed to determine command precursor for /home/tleydxdy/Desktop/some.desktop
WARNING: failed to determine command(s) for /home/tleydxdy/Desktop/some.desktop

is there some way to fix this?

Last edited by tleydxdy (2021-02-11 00:14:06)

Offline

#204 2021-02-11 12:30:28

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

Re: mimeo: open files by mimetype or file name

I've added an "--exec" option to run the "Exec" field of desktop file arguments, e.g. "mimeo --exec vlc.desktop" will open vlc. If you want to make this the default behavior, create a custom desktop file and make it the default for the desktop MIME-type:

mimeo --create exec_desktop.desktop 'Desktop Runner' 'mimeo --exec %F' 'application/x-desktop' noterm
mimeo --prefer 'application/x-desktop' exec_desktop.desktop

edit: @all
While adding the above option I also addressed the numerous pylint errors and warnings. Almost all of the changes are transparent for users of the command-line utility but several keyword arguments have been renamed internally to conform to naming conventions. Anyone who uses the module directly will need to update their code.

The only command-line change is the fifth argument to the "--create" command, which should now be "term" for terminal applications and anything else for non-terminal applications.

The executable is also a proper python script too now instead of a bash wrapper.

Last edited by Xyne (2021-02-11 12:36:07)


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

Offline

#205 2021-02-12 01:45:45

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

much thanks!

Offline

#206 2021-02-12 02:53:19

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

the change is not quite working. firstly, /usr/bin/mimeo produces a error, changing the shebang line for /usr/bin/mimeo to the usual fixed it

#!/usr/bin/env python3

secondly, when I do

mimeo --exec the.desktop

it just exits and nothing happens, when I run the Exec= line in the file manually it launches correctly. This I have no clue, I tried to add some echo lines to the command it invokes but there still is no output

Offline

#207 2021-02-12 04:19:52

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: mimeo: open files by mimetype or file name

package ()
{
  cd "$srcdir/$pkgname-$pkgver"
  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
  install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
}

Installing the script file is redundant since "python setup.py install" handles that; furthermore, it overwrites the version of the script that setup.py installed. This is problematic since "#!python" relies on setup.py adjusting the shebang for you, to point at the python interpreter which invoked setup.py.

The manual install -Dm755 line appears to be a legacy leftover from before "The executable is also a proper python script too now instead of a bash wrapper." An oversight...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#208 2021-02-12 07:13:32

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

Re: mimeo: open files by mimetype or file name

eschwartz wrote:

An oversight...

Yep, sorry. The fix will be uploaded in a few minutes.


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

Offline

#209 2021-02-12 08:24:00

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

okay, so this is really strange, the desktop file will launch successfully with one filename, but if I rename it it won't launch again

Offline

#210 2021-02-12 10:13:14

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

Re: mimeo: open files by mimetype or file name

"I changed something and now it no longer works" isn't enough information for me to help you.

Did you change the .desktop extension? If so, why? Does "mimeo -m /path/to/renamed/file" still detect the MIME-type as "application/x-desktop"? If not, either fix the extension or add the new MIME-type to the generated desktop file above.

Mimeo uses Python's standard mimetypes module for MIME-type detection so there isn't much that I can do to improve that. MIME-type detection is basically guesswork and a lot of it relies on things like standard file extensions.


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

Offline

#211 2021-02-12 12:01:15

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

yes I renamed it but preserved .desktop, mimeo detects both as application/x-desktop.

Offline

#212 2021-02-13 13:15:03

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

Re: mimeo: open files by mimetype or file name

Post the output of

mimeo -m /path/to/desktop/file
mimeo -c /path/to/desktop/file
mimeo --exec -c /path/to/desktop/file

for both the original and renamed desktop file.

edit
If both report the same MIME-type then the behavior should be the same. Are you running the commands as different users (e.g. with sudo)? If so then you will need to set the preferences for the other user too.

Last edited by Xyne (2021-02-13 13:17:50)


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

Offline

#213 2021-02-14 06:30:51

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

$ mimeo -m ~/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop
/home/tleydxdy/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop
  application/x-desktop
$ mimeo -m ~/Desktop/element.desktop
/home/tleydxdy/Desktop/element.desktop
  application/x-desktop
$ mimeo -c ~/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop
/usr/bin/mimeo --exec /home/tleydxdy/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop
$ mimeo -c ~/Desktop/element.desktop
/usr/bin/mimeo --exec /home/tleydxdy/Desktop/element.desktop
$ mimeo --exec -c ~/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop
/usr/lib/brave-bin/brave --user-data-dir=/home/tleydxdy/.config/BraveSoftware/Brave-Browser/Main --profile-directory=Profile --app-id=ppkpacoaenkjhabjboajcamojdgbjdgd
$ mimeo --exec -c ~/Desktop/element.desktop
$ diff ~/Desktop/brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop ~/Desktop/element.desktop
$

Offline

#214 2021-02-14 20:28:23

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

Re: mimeo: open files by mimetype or file name

Can you post the contents of the desktop files? It seems that element.desktop contains the path to brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile.desktop so I suspect that one is not a copy of the other.
Also post the output of the following files if you have them:

  • /home/tmp/xyne/.config/mimeo/associations.txt

  • /etc/xdg/mimeo/associations.txt


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

Offline

#215 2021-02-15 06:33:38

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

The two file are the same, which is what I was trying to show with the diff command

I think I have figured out what is causing it, but I am still unsure of the why. So when I installed the PWA, the browser added copies of the desktop files to

~/.local/share/applications/
~/.gnome/apps/
~/Desktop/

One would think they are independent, but somehow they are not. specifically the ~/Desktop version will only run when the corresponding ~/.local version is present. This is what caused element.desktop to not work, once I copied element.desktop to ~/.local they both will work correctly.

note:
~/.Desktop version have this line at the top and is set to executable, the ~/.local one does not and is not executable (this doesn't effect the bug tho (I have xdg-open symlinked to mimeo))

#!/usr/bin/env xdg-open

Offline

#216 2021-02-15 16:21:03

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

Re: mimeo: open files by mimetype or file name

The diff command in the output immediately followed the "mimeo --exec -c" command so I thought it was the output, which I found very confusing.

I've just tested mimeo with executable desktop files and the shebang #!/usr/bin/env mimeo and it works as expected after creating the custom desktop and preference as in my previous post. Aside from the use of the custom desktop file to handle the application/x-desktop MIME-type, it should be completely independent of the target desktop's location. There must be something in the desktop files under ~/Desktop beyond the shebang that differs from their counterparts in $XDG_DATA_HOME.

Without the contents of the desktop files I cannot reproduce or debug this.


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

Offline

#217 2021-02-20 01:42:46

tleydxdy
Member
Registered: 2017-10-11
Posts: 18

Re: mimeo: open files by mimetype or file name

Here's my current working setup

$ diff ~/Desktop/element.desktop ~/.local/share/applications/element.desktop
1d0
< #!/usr/bin/env xdg-open
$ cat ~/Desktop/element.desktop
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Element
Exec=/usr/lib/brave-bin/brave --user-data-dir=/home/tleydxdy/.config/BraveSoftware/Brave-Browser/Main --profile-directory=Profile --app-id=ppkpacoaenkjhabjboajcamojdgbjdgd
Icon=brave-ppkpacoaenkjhabjboajcamojdgbjdgd-Profile
StartupWMClass=crx_ppkpacoaenkjhabjboajcamojdgbjdgd

I think it's best if you use your browser to install a PWA, this will obviously not run on your machine.

Offline

Board footer

Powered by FluxBB