Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 19 Jan 2020, 09:41
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
ROX-xdg 1.5
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [33 Posts]   Goto page: 1, 2, 3 Next
Author Message
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Tue 17 Sep 2019, 13:18    Post subject:  ROX-xdg 1.5
Subject description: file association handler plugin for rox-filer
 

For the past several years of puppy's lifespan. File associations in rox-filer was the biggest headache. When installing packages or loading sfs modules. Their file associations sometimes don't work and requires manual setting the file associations

This script will eventually fix all the problems on file association in rox-filer. This works as fallback mode. It can coexist with the old system. This will provide greater flexibility for rox-filer on its file associations.

It works on any rox-filer versions and builds.

Recent Puppy Package Manager and SFS Load can now update the mimeinfo.cache file.

Requirements:
* desktop-file-utils (latest puppy builds has desktop-file-utils installed, Also if it was not installed, the update-desktop-database script will do the job).

To find if desktop-file-utils was needed to install type this command
Code:
which update-desktop-database

If returns nothing, then you will need to install desktop-file-utils


How this works
Based from Barry's observation, if the mimetype scripts was not found on MIME-types folder of rox. It will fallback on its general mimetype. audio/*,video/*,image,text/* has no problems at all. By assigning puppy's default scripts

But what about applications/*?. They were inconsistent, so the rox-xdg steps in. This will read and parse mimeapps.list, defaults.list, and mimeinfo.cache to find the appropriate program.

More info about xdg file associations:
https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html
https://wiki.archlinux.org/index.php/XDG_MIME_Applications
rox-xdg-1.5.pet
Description  Some improvements
pet

 Download 
Filename  rox-xdg-1.5.pet 
Filesize  1.82 KB 
Downloaded  108 Time(s) 

Last edited by mistfire on Fri 20 Sep 2019, 04:44; edited 20 times in total
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Wed 18 Sep 2019, 01:01    Post subject:  

rox-xdg 1.1 released

Changes:
* Works on any kinds of rox-filer installation
* With sync-rox-icons command to synchronize rox file icons with /usr/share/icons
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14715
Location: Gatineau (Qc), Canada

PostPosted: Wed 18 Sep 2019, 01:24    Post subject:  

Hi mistfire.

Thanks for your trouble.

However, I never had a problem with jemimah's xdg-open at /usr/local/bin/xdg-open,
ever. Please see http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150.

Code:
#!/bin/ash
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150
#110115 xdg-open used to be a symlink to defaulthandler.

ROXFILER=`grep -E 'ROX-Filer|roxfiler' /usr/local/bin/defaultfilemanager | grep -v '^#'`

if [ "$ROXFILER" ] ; then
   case "$1" in
      '') exit ;;
      *://*) exec rox -U "$1" ;;
      *@*.*) exec rox -U "mailto:${1}" ;;
      magnet:*) exec defaulttorrent "$1" ;;
      *) exec rox "$1" ;;
   esac
else
   case "$1" in
      '') exit ;;
      file://*) exec defaultfilemanager "$1" ;;
      *://*)    exec defaultbrowser "$1" ;;
      magnet:*) exec defaulttorrent "$1" ;;
      *)        exec defaultfilemanager "$1" ;;
   esac
fi

### END ###

Respectfully.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Wed 18 Sep 2019, 01:44    Post subject:  

musher0 wrote:
Hi mistfire.

Thanks for your trouble.

However, I never had a problem with jemimah's xdg-open at /usr/local/bin/xdg-open,
ever. Please see http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150.

Code:
#!/bin/ash
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150
#110115 xdg-open used to be a symlink to defaulthandler.

ROXFILER=`grep -E 'ROX-Filer|roxfiler' /usr/local/bin/defaultfilemanager | grep -v '^#'`

if [ "$ROXFILER" ] ; then
   case "$1" in
      '') exit ;;
      *://*) exec rox -U "$1" ;;
      *@*.*) exec rox -U "mailto:${1}" ;;
      magnet:*) exec defaulttorrent "$1" ;;
      *) exec rox "$1" ;;
   esac
else
   case "$1" in
      '') exit ;;
      file://*) exec defaultfilemanager "$1" ;;
      *://*)    exec defaultbrowser "$1" ;;
      magnet:*) exec defaulttorrent "$1" ;;
      *)        exec defaultfilemanager "$1" ;;
   esac
fi

### END ###

Respectfully.


Thats because you have a predefined file associations stored at /root/Choices/MIME-types/ or in /root/.config/rox.sourceforge.net/MIME-types/
What if you load an sfs module which has a file association was not found in /root/Choices/MIME-types/ or in /root/.config/rox.sourceforge.net/MIME-types/? You will need to set the file associations manually which was tedious task instead of doing it automatically

Also here is what I mean.

Instead of creating scripts in every mimetype for file association in rox-filer
For example
Code:
/root/.config/rox.sourceforge.net/MIME-types/application_pet
/root/.config/rox.sourceforge.net/MIME-types/application_sb
/root/.config/rox.sourceforge.net/MIME-types/image_png
/root/.config/rox.sourceforge.net/MIME-types/image_jpg
/root/.config/rox.sourceforge.net/MIME-types/audio_mp3
/root/.config/rox.sourceforge.net/MIME-types/audio_wav
/root/.config/rox.sourceforge.net/MIME-types/audio_ogg
...


My approach will be accomplished by just 5 scripts regardless of mimetypes
For example
Code:
/root/.config/rox.sourceforge.net/MIME-types/application
/root/.config/rox.sourceforge.net/MIME-types/text
/root/.config/rox.sourceforge.net/MIME-types/image
/root/.config/rox.sourceforge.net/MIME-types/audio
/root/.config/rox.sourceforge.net/MIME-types/video


Here is the content of the 5 scripts
Code:
#!/bin/sh
exec rox-xdg-open "$@"


So the file associations will be easily manage when add/remove package or load/unload sfs modules. Because it looks for associated program at mimeapps.list and mimeinfo.cache. The files mimeapps.list and mimeinfo.cache is now always managed by PPM and sfs_load

UPDATE:
This cause a drastic problems on ROX-Filer. And based from Barry's observation. I decided to use the fallback mode. This package can act as extender for file associations

Last edited by mistfire on Thu 19 Sep 2019, 21:10; edited 2 times in total
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 13176
Location: S.C. USA

PostPosted: Wed 18 Sep 2019, 10:03    Post subject:  

Thanks for this!

This looks likes something that should be offered to Woof CE as a Pull Request.
https://github.com/puppylinux-woof-CE/woof-CE/pulls
Get this into the normal build of an Official Puppy.

mistfire,
Please offer this to Woof-CE.
Easy to do.
Go to Woof-CE on Github.
Make a personal account, so you can log in to be able to post.
(same as posting on this forum)
Try to use mistfire as the username, so we know who you are from this forum.
https://github.com/join

On Woof-CE Pull Request tab.
After you log in
Click on New Pull Request button to make a pull request of your code, to be considered for putting it into Woof-CE build system.
Give Woof-CE some help in making it better.

_________________
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
YaPI(any iso installer)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14715
Location: Gatineau (Qc), Canada

PostPosted: Wed 18 Sep 2019, 14:59    Post subject:  

Nah, mistfire,

please DO NOT offer it to the woof-CE. bigpup said that just to spite me. Wink

If you do, they'll mess with it, too.

Keep it for the pups you create if you like. jemimah's script is just fine for regular Puppies.
Has been for years.

Obviously, if someone changed the ending of an sfs to something else, it wouldn't load.

Besides the MIME-types you include in your pet, there is an awfully long list at
/usr/share/mime, natively. (A rough count of over 500 mime-types.)

Respectfully.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 9172
Location: Perth, Western Australia

PostPosted: Wed 18 Sep 2019, 22:50    Post subject:  

@mistfire
What you have done is extremely interesting.

In the latest EasyOS, which is built with Debian Buster 10 DEBs, as are BusterPup and some other pups, I looked at "gvfs" package and found that it needed 14 dependencies. Gulp.

In EasyOS, we have /usr/share/applications/mimeinfo.cache, which is created by running 'update-desktop-database' -- this is done in WoofQ and also in /usr/local/petget/installpkg.sh when a package is installed.

Easy does not have /usr/share/applications/mimeapps.list

Easy does have /usr/share/applications/defaults.list, I don't know what generates that. It looks useful.

Anyway, if 'mimeinfo.cache' exists, isn't that enough? No need for the gvfs and its deps?

_________________
https://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Wed 18 Sep 2019, 23:44    Post subject:  

BarryK wrote:
@mistfire
What you have done is extremely interesting.

In the latest EasyOS, which is built with Debian Buster 10 DEBs, as are BusterPup and some other pups, I looked at "gvfs" package and found that it needed 14 dependencies. Gulp.

In EasyOS, we have /usr/share/applications/mimeinfo.cache, which is created by running 'update-desktop-database' -- this is done in WoofQ and also in /usr/local/petget/installpkg.sh when a package is installed.

Easy does not have /usr/share/applications/mimeapps.list

Easy does have /usr/share/applications/defaults.list, I don't know what generates that. It looks useful.

Anyway, if 'mimeinfo.cache' exists, isn't that enough? No need for the gvfs and its deps?


To eliminate the gvfs dependency, we need to look for a command that finds mimetype of a file relative to /usr/share/mime
I tried file command but the output mimetype was not correct unlike in gvfs one.

Take a look at this sample terminal output. Only gvfs-info gave the correct mimetype. We need a command or script that works like gvfs-info
Code:
# file -b --mime-type ./rox-xdg-1.1.pet
application/x-gzip

# xdg-mime query filetype ./rox-xdg-1.1.pet
application/x-gzip; charset=binary

# gvfs-info -a standard::content-type "./rox-xdg-1.1.pet" | grep "content-type:"| cut -f 4 -d ':' | sed -e "s#^\ ##g" -e "s#\-#\\\-#g"
application/pet


We can add defaults.list aside from mimeapps.list for searching associated program

Here is the path sequence of searching file association in the script

Code:
/root/.local/share/applications/mimeapps.list
/root/.local/share/applications/defaults.list
/root/.local/share/applications/mimeinfo.cache
/usr/share/applications/mimeapps.list
/usr/share/applications/defaults.list
/usr/share/applications/mimeinfo.cache
/usr/local/share/applications/mimeapps.list
/usr/local/share/applications/defaults.list
/usr/local/share/applications/mimeinfo.cache


First program found wins and will executed.

Last edited by mistfire on Thu 19 Sep 2019, 00:10; edited 3 times in total
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Wed 18 Sep 2019, 23:58    Post subject:  

ROX-xdg 1.2 released

* Added defaults.list

Download was on the first post of this thread
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 9172
Location: Perth, Western Australia

PostPosted: Thu 19 Sep 2019, 02:37    Post subject:  

Rox gives the correct information:

Code:
# rox -m Easy_theme-201908111425.pet
application/pet

_________________
https://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Thu 19 Sep 2019, 02:50    Post subject:  

BarryK wrote:
Rox gives the correct information:

Code:
# rox -m Easy_theme-201908111425.pet
application/pet


That was I looking for. And it works. Thank you
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 1313
Location: PH

PostPosted: Thu 19 Sep 2019, 02:56    Post subject:  

ROX-xdg 1.3 released

* gvfs dependency was removed. (Thanks Barry)

Download was on the first post of this thread.
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 9172
Location: Perth, Western Australia

PostPosted: Thu 19 Sep 2019, 09:30    Post subject:  

I have put it into WoofQ:

http://bkhome.org/news/201909/rox-filer-dynamic-handling-of-mimetypes.html

Enough instructions there so that one of the woof-CE developers can also implement it.

However, the woof-CE developers might not want to bake it into folder 'rootfs-skeleton', if they are trying to be file-manager agnostic. But it won't do any harm having components of ROX-Filer, even if a Puppy is built with some other file-manager.

_________________
https://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0

Joined: 04 Jan 2009
Posts: 14715
Location: Gatineau (Qc), Canada

PostPosted: Thu 19 Sep 2019, 09:57    Post subject:  

Hi mistfire.

So much for the proverb: "If it works, don't fix it..."

As I said, I never had a problem with the current setting for this, whose author is former
member jemimah.

If you came up with a "solution", it means that on your Pup(s), you experienced one or
several problems with jemimah's offering. Please provide more details.

Have you checked if this or these problem(s) was (were) generalized? Or are you
declaring single-handedly that there is a general problem with rox-xdg?

For ex., you add a general video and a general audio category for rox; does it help?
What video file exactly? What audio file exactly? There are many, many types of each.
ROX itself does not play the movie or the song, it passes it to a specific player.

In any case, if the next Puppy authority after God says your "solution" is interesting
then it is. And who am I to register my dissidence or even a loyal opposition.

But I cannot help thinking that you have not described your problem enough.
Therefore I cannot help thinking that you are providing a "solution" for a "problem"
non-existent for the rest of us.

Respectfully.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
foxpup


Joined: 29 Jul 2016
Posts: 993
Location: europa near northsea

PostPosted: Thu 19 Sep 2019, 14:20    Post subject:  

musher0 wrote:
the next Puppy authority after God
"Next after God"???
Really, musher0!?
He is The Puppy Authority. God does not stand a chance here Wink

I don't have anything to say about the matter of mimetypes btw. I am a total noob. Embarassed
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [33 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0626s ][ Queries: 12 (0.0040s) ][ GZIP on ]