ROX-xdg 1.5

Filemanagers, partitioning tools, etc.
Message
Author
mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

ROX-xdg 1.5

#1 Post by mistfire »

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: Select all

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/ ... 1.0.1.html
https://wiki.archlinux.org/index.php/XD ... plications
Attachments
rox-xdg-1.5.pet
Some improvements
(1.82 KiB) Downloaded 300 times
Last edited by mistfire on Fri 20 Sep 2019, 08:44, edited 20 times in total.

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#2 Post by mistfire »

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

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

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. ... &start=150.

Code: Select all

#!/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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#4 Post by mistfire »

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. ... &start=150.

Code: Select all

#!/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: Select all

/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: Select all

/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: Select all

#!/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 Fri 20 Sep 2019, 01:10, edited 2 times in total.

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#5 Post by bigpup »

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 :shock:
YaPI(any iso installer)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Nah, mistfire,

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

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#7 Post by BarryK »

@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?
[url]https://bkhome.org/news/[/url]

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#8 Post by mistfire »

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: Select all

# 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: Select all

/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, 04:10, edited 3 times in total.

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#9 Post by mistfire »

ROX-xdg 1.2 released

* Added defaults.list

Download was on the first post of this thread

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#10 Post by BarryK »

Rox gives the correct information:

Code: Select all

# rox -m Easy_theme-201908111425.pet 
application/pet
[url]https://bkhome.org/news/[/url]

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#11 Post by mistfire »

BarryK wrote:Rox gives the correct information:

Code: Select all

# rox -m Easy_theme-201908111425.pet 
application/pet
That was I looking for. And it works. Thank you

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#12 Post by mistfire »

ROX-xdg 1.3 released

* gvfs dependency was removed. (Thanks Barry)

Download was on the first post of this thread.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#13 Post by BarryK »

I have put it into WoofQ:

http://bkhome.org/news/201909/rox-filer ... types.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.
[url]https://bkhome.org/news/[/url]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

foxpup
Posts: 1132
Joined: Fri 29 Jul 2016, 21:08

#15 Post by foxpup »

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 ;-)

I don't have anything to say about the matter of mimetypes btw. I am a total noob. :oops:

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#16 Post by musher0 »

foxpup wrote:
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 ;-)

I don't have anything to say about the matter of mimetypes btw. I am a total noob. :oops:
Hi foxpup,

Well... BarryK described himself as the "benevolent dictator of PuppyLinux" when he
was actively involved in developing it! To me, that's pretty close to "only master on
board after God", the traditional designation of the captain of a ship! :)

You know nothing about mimetypes, but perhaps you can tell us if you ever had any
problem launching files from a ROX window? That's what this is about.

I'm all for better "mouse traps", and for personal innovations, and mistfire is certainly
a talented coder, but I just don't see the need here for a new approach.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#17 Post by BarryK »

There is a problem...

The ROX right-click menu has "Open as text" which no longer works.

It relies on /etc/xdg/rox.sourceforge.net/MIME-types/text, the old one, which has "exec defaulttexteditor $@" in it.

Oh dear, how to get around this? Other than modifying the source code in rox, I can't see how.

Besides, Easy|Puppy already has default handlers for /etc/xdg/rox.sourceforge.net/MIME-types/text, audio, image, video, application, and my understanding is that if say video_blahblah does not exist, then rox will fall back to using 'video' which will call the default handler.
[url]https://bkhome.org/news/[/url]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#18 Post by don570 »

The ROX right-click menu has "Open as text" which no longer works.
I never use this feature. I prefer 'Open with' folder links.
______________________________________

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#19 Post by BarryK »

OK, think have sorted it. The old system has to be kept, but so can mistfire's new system be used.

With mistfire's system on its own, there is that problem of "Open as text". Also, there are some files that do not open anymore, such as application/x-notecase.

What I have done is kept all of the old handler scripts, as well as the new symlinks 'audio', 'image', 'video' and 'application', but not the 'text' symlink.

What that does is behave as before, but if there is no handler for, say png images, that is, no 'image_png' or 'image_x-png', then rox will fall back to using 'image' which is mistfire's system.

Of course, we could just have 'image' with "exec defaultimageviewer $@" in it, which kind of makes mystfires system unnecessary.

Hmmm, click on an application, say 'asunder', it does not open in the new system. The fallback should be to just run the application.

Not looking too good for the new system!
[url]https://bkhome.org/news/[/url]

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#20 Post by mistfire »

Thanks @Barry for the comment. I think audio video application scripts will be retain. Also I will change the post-install scripts in order to act rox-xdg as fallback script. In order to coexist old and new system.

Post Reply