The "Zip" Family

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

The "Zip" Family

#1 Post by Smithy »

The zip entry in rox sourceforge.net does not seem to discriminate between zip files and tries to open a qtractor .qtz file with xarchive.
I managed to change it so that the qtz files, when clicked on, open with usr/bin/qtractor,
but then any .pets, .zips. gzips etc also try to open in qtractor, which of course are doomed to fail.

Is there a way to make a .qtz file association only, just for qtractor archive files?
A bit hard to explain, but I hope someone gets it without going off on
tangents.
Note: The right click asociation is fine, I managed to get an open with qtractor ok.
Attachments
file association(1).png
(96.57 KiB) Downloaded 212 times
file association.png
(70.08 KiB) Downloaded 212 times

mjmikulcik
Posts: 45
Joined: Sat 10 Jun 2017, 00:06

#2 Post by mjmikulcik »

What sounds to me is that the .qtz mime type is somehow the same as .zip or included in the xarchive. Maybe you need to make its own mime type. See http://puppylinux.org/wikka/HowToAddMIMEType Then specify the set run action.

First though, make sure there is no file in /root/Choices/MIME-types for the .qtz file.

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#3 Post by Smithy »

Thanks for your reply mjmikulcik, I've been to dark city's page so many times and it never seems to sink in.
I'm thinking of trying to make those .qtz files when clicked on, trigger an .sh file with qtractor "$1" in it, a lot simpler, but how to link the .sh to .qtz..

mjmikulcik
Posts: 45
Joined: Sat 10 Jun 2017, 00:06

#4 Post by mjmikulcik »

I just realized the problem... i think. The .qtz file happens to end in a "tz" which happens to be an extension for a compressed file. The mime type looks for anything ending in tz and labels it a zip and when you go to set run action for .qtz it sets it for all zip type applications. This is not what we want. Instead, we need to edit the mime type to allow for .qtz files and set the run action on them.

Could you a upload a small .qtz for me to experiment with? I'm not 100% sure of the solution but i think we can get there. Also, I'm unfamiliar with the dark city page you mentioned

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#5 Post by Smithy »

Yes here's a .qtz file, just a default setup one. (Has to be renamed).
Dark City is a forum member who authored the pages you linked to.
Thanks for having a go mjmikulcik!
Attachments
Default.gz
(1.21 KiB) Downloaded 57 times

ITSMERSH

#6 Post by ITSMERSH »

Hey Smithy.

I have a workaround.

When clicking a file by pressing the shift key, the file is interpret as text file and therefor sent to /usr/local/bin/defaulthandler (in fact it's sent to another script, which calls or is sym-linked to defaulthandler).

In /usr/local/bin/defaulthandler I'd added some modifications for files like .jpg. These files usually open in image viewer, but when I'm clicking a .jpg file by pressing shift, it calls GIMP (defaultimageeditor).

Here's my defaulthandler script:

Code: Select all

#!/bin/sh
#------------------------------------------------------------------------------
# Updated Version 2013, 2014, 2015 by RSH for LazY Puppy and the new Menu Pipes
#------------------------------------------------------------------------------

## Get Application Directory
##--------------------------
[ "$APPDIR" = "" ] && APPDIR="`dirname "$0"`" # Application Directory
#APPDIRAPP="`basename "$0"`" # Application Name
#APPDIRDIR="`dirname "$APPDIR"`" # Directory of Application Directory
#[ "$APPDIR" = "." ] && APPDIR="`pwd`"
#export APPDIR="$APPDIR"
#export APPDIR=`dirname "$0"`
#[ "$APPDIR" = '.' ] && export APPDIR=`pwd`

# Submitted file
FFILE="$@"
AFILE="`basename "$FFILE"`"
IMGEDITNOVIEW="false"
AUDEDITNOPLAY="false"
FILETOAPPSELECTOR="false"
[ -f "/tmp/defaulthandler_use_imageview" ] && read IMGEDITNOVIEW < "/tmp/defaulthandler_use_imageview"
[ -f "/tmp/defaulthandler_use_audioplay" ] && read AUDEDITNOPLAY < "/tmp/defaulthandler_use_audioplay"
[ -f "/tmp/defaulthandler_use_appselector" ] && read FILETOAPPSELECTOR < "/tmp/defaulthandler_use_appselector"

# It is a Web Link or it has an extension?
if [ "`echo -n "$FFILE" | grep '^http:'`" != "" ]; then
	/usr/local/bin/defaultbrowser "$FFILE"
	exit
	elif [ "`echo -n "$FFILE" | grep '^www.'`" != "" ]; then
	/usr/local/bin/defaultbrowser "http://""$FFILE"
	exit
	elif [ "`echo -n "$AFILE" | grep '\.'`" = "" ]; then
	/usr/local/bin/defaulttexteditor "$FFILE"
	exit
	else
	AEXT="`echo "$AFILE" | rev | cut -f 1 -d '.' | rev`"
fi

# Where are the RoxApp Application Directories?
[ -d "$APPDIR/apps" ] && APPSDIR="$APPDIR/apps" || APPSDIR="/usr/local/apps"
# Where are some of the Binaries?
[ -d "$APPDIR/bin" ] && BINSDIR="$APPDIR/bin" || BINSDIR="/usr/local/bin"

if [[ "$FILETOAPPSELECTOR" == "true" && -f /usr/local/apps/Send2AppOrDir/AppRun ]]; then

	/usr/local/apps/Send2AppOrDir/AppRun "$FFILE"

	######################################################################################
	else # [[ "$FILETOAPPSELECTOR" = "true" && -f /usr/local/apps/Send2AppOrDir/AppRun ]];
	######################################################################################

	# This has been updated a lot!
	case "$AEXT" in

		#-----------------------------------------------
		# Special Definitions for RSHs Application Kiosk
		#-----------------------------------------------

		# Audacity, Rosegarden
		aup|AUP|rg|RG)
			# File 'AppKiosk' or 'searchnexecute' in Drectory?
			if [[ -f $APPDIR/AppKiosk || -f $APPDIR/gdambuilder || -f $APPDIR/searchnexecute ]]; then

				case "$AEXT" in
					# Audacity Files
					aup|AUP)
						"$APPSDIR/Audacity/AppRun" "$FFILE" &
					;;

					# Rosegarden Files
					rg|RG)
						"$APPSDIR/Rosegarden/AppRun" "$FFILE" &
					;;

					# KDEnLiVE Files
					kdenlive|KDENLIVE)
						"$APPSDIR/Kdenlive/AppRun" "$FFILE" &
					;;
				esac

			fi
		;;

		#------------------------------------------------------
		# End of special Definitions for RSHs Application Kiosk
		#------------------------------------------------------

		#--------------------
		# Default Definitions
		#--------------------

		# SFS Modules
		iso|ISO)
			filemnt "$FFILE"
		;;

		# SFS Modules
		sfs|SFS)
			sfs-handler "$FFILE"
		;;

		# Archives
		gz|GZ|bz|BZ|tar*|TAR*|zip|ZIP|tgz|TGZ)
			/usr/bin/xarchive "$FFILE"
		;;

		# Install Packages
		deb|DEB|pet|PET)
			/usr/local/petget/petget "$FFILE"
		;;

		# Notecase Documents
		ncd|NCD)
			notecase "$FFILE"
		;;

		# Plain Text Documents
		txt|TXT|lst|LST|cfg|CFG|specs|SPECS|rc|RC|sh|SH|py|PY|js|JS|json|JSON)
			/usr/local/bin/defaulttexteditor "$FFILE"
		;;

		# Word Office Document
		doc|DOC|rtf|RTF|docx|DOCX|odt|ODT)
			/usr/local/bin/defaultwordprocessor "$FFILE"
		;;

		# Spreadsheet Office Documents
		xls|XLS|gnumeric|GNUMERIC|odc|ODC|ods|ODS)
			/usr/local/bin/defaultspreadsheet "$FFILE"
		;;

		# HTML/XML and similar Documents
		htm*|HTM*)
			/usr/local/bin/defaultbrowser "$FFILE"
		;;

		# HTML/XML and similar Documents
		xml|XML|css|CSS|php|PHP)
			/usr/local/bin/defaulttexteditor "$FFILE"
		;;

		# Image Documents 1 - GIMP should be the 'defaultimageeditor'
		xcf|XCF|ico|ICO|psd|PSD|gs|GS)
			/usr/local/bin/defaultimageeditor "$FFILE"
		;;

		# Image Documents 2 - ViewNior
		bmp|BMP|jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|tif*|TIF*|xpm|XPM)
			#/usr/local/bin/defaultimageeditor "$FFILE"
			[ "$IMGEDITNOVIEW" = "true" ] && /usr/local/bin/defaultimageeditor "$FFILE" || /usr/local/bin/defaultimageviewer "$FFILE"
		;;

		# Image Documents 3 - Corel Photopaint
		cpt|CPT)
			/usr/local/bin/defaultcorelphotoeditor "$FFILE"
		;;

		# Image Documents 3 - Corel Draw
		cdr|CDR)
			/usr/local/bin/defaultcoreldraweditor "$FFILE"
		;;

		# Image Documents 3 - Corel Dream 3D
		d3d|D3D)
			/usr/local/bin/defaultcoreldreameditor "$FFILE"
		;;

		# PDF/PostScript Documents
		pdf|PDF|ps|PS|eps|EPS)
			/usr/local/bin/defaultpdfviewer "$FFILE"
		;;

		# Audio Documents
		mp3|MP3|wav|WAV|flac|FLAC|ogg|OGG)
			#/usr/local/bin/defaultaudioeditor "$FFILE"
			#/usr/local/bin/defaultplayer "$FFILE"
			[ "$AUDEDITNOPLAY" = "true" ] && /usr/local/bin/defaultaudioeditor "$FFILE" || /usr/local/bin/defaultmediaplayer "$FFILE"
		;;

		# Video Documents
		mp4|MP4|mpg|MPG|mpeg|MPEG|avi|AVI|mkv|MKV)
			/usr/local/bin/defaultmediaplayer "$FFILE"
		;;

		#---------------------------
		# End of default Definitions
		#---------------------------

		# Any else Documents
		*)
			#/usr/local/bin/defaulttexteditor-bin "$FFILE"
			"$BINSDIR"/defaulttexteditor-bin "$FFILE"
		;;

	esac

fi # [[ "$FILETOAPPSELECTOR" = "true" && -f /usr/local/apps/Send2AppOrDir/AppRun ]];
And here's my defaulttexteditor-bin (called by defaulthandler)

Code: Select all

#!/bin/sh
#------------------------------------------------------------------------------
# New BackEnd for the defaulttexteditor Script
# Check for no-text files first and send them to 'defaultXXX' Script
# when doing a left-click onto the image while holding a shift key down
#------------------------------------------------------------------------------

# Send submitted file name/s into a temp file
[ "$@" != "" ] && SUBMITTED="$@" || SUBMITTED="new.txt"
echo "$SUBMITTED" > /tmp/file_submitted_shift_key_holded_down
BNSUBMIT="`basename "$SUBMITTED"`"
EXTENSION=${BNSUBMIT##*.} # extension only

case $EXTENSION in

	# KDEnLiVE Files
	kdenlive)
		if (grep -i kdenlive /usr/local/bin/defaultvideoeditor >/dev/null) then
			defaultvideoeditor "$SUBMITTED" &
			file_is_no_text="true"
		fi
	;;

	# ISO Files
	iso|ISO)
		filemnt "$SUBMITTED"
		file_is_no_text="true"
	;;

	# SFS Modules
	sfs|SFS)
		sfs-handler "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Archives
	gz|GZ|bz|BZ|tar*|TAR*|zip|ZIP|tgz|TGZ)
		/usr/bin/xarchive "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Install Packages
	deb|DEB|pet|PET)
		/usr/local/petget/petget "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Plain Text Documents
	txt|TXT|lst|LST|cfg|CFG|specs|SPECS|rc|RC|sh|SH|py|PY|js|JS|json|JSON)
		#/usr/local/bin/defaulttexteditor "$SUBMITTED"
		file_is_no_text="false"
	;;

	# Word Office Document
	doc|DOC|rtf|RTF|docx|DOCX|odt|ODT)
		/usr/local/bin/defaultwordprocessor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Spreadsheet Office Documents
	xls|XLS|gnumeric|GNUMERIC|odc|ODC|ods|ODS)
		/usr/local/bin/defaultspreadsheet "$SUBMITTED"
		file_is_no_text="true"
	;;

	# HTML/XML and similar Documents
	htm*|HTM*|xml|XML|css|CSS|php|PHP)
		#/usr/local/bin/defaulttexteditor "$SUBMITTED"
		file_is_no_text="false"
	;;

	# Image Documents 1 - GIMP should be the 'defaultimageeditor'
	xcf|XCF|ico|ICO|psd|PSD|gs|GS)
		/usr/local/bin/defaultimageeditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Image Documents 2 - GIMP should be the 'defaultimageeditor'
	bmp|BMP|jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|tif*|TIF*|xpm|XPM)
		/usr/local/bin/defaultimageeditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Image Documents 3 - Corel Photopaint
	cpt|CPT)
		/usr/local/bin/defaultcorelphotoeditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Image Documents 3 - Corel Draw
	cdr|CDR)
		/usr/local/bin/defaultcoreldraweditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Image Documents 3 - Corel Dream 3D
	d3d|D3D)
		/usr/local/bin/defaultcoreldreameditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# PDF/PostScript Documents
	pdf|PDF|ps|PS|eps|EPS)
		/usr/local/bin/defaultpdfviewer "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Audio Documents
	mp3|MP3|wav|WAV|flac|FLAC|ogg|OGG)
		/usr/local/bin/defaultaudioeditor "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Video Documents
	mp4|MP4|mpg|MPG|mpeg|MPEG|avi|AVI|mkv|MKV)
		/usr/local/bin/defaultmediaplayer "$SUBMITTED"
		file_is_no_text="true"
	;;

	# Any else Documents
	*)
		#/usr/local/bin/defaulttexteditor "$SUBMITTED"
		file_is_no_text="false"
	;;

esac

# Else, submitted file is a text file - send file to Geany
if [ "$file_is_no_text" = "false" ]; then
	if [ "`which geany`" != "" ]; then
		exec geany "$SUBMITTED" &
		elif [ "`which nicoedit`" != "" ]; then
		exec nicoedit "$SUBMITTED" &
		elif [ "`which leafpad`" != "" ]; then
		exec leafpad "$SUBMITTED" &
		# Lazy Puppy RunScript for Geany-0.20
		elif [ -f $HOME/.my-sfs-scripts/LP2_Geany-0.20.sfs.Scripts/LP2_Geany-0.20.sfs.Geany-text-editor.run.sh ]; then
		exec $HOME/.my-sfs-scripts/LP2_Geany-0.20.sfs.Scripts/LP2_Geany-0.20.sfs.Geany-text-editor.run.sh "$SUBMITTED" &
		# Lazy Puppy RunScript for Geany-0.21
		elif [ -f $HOME.my-sfs-scripts/LP2_Geany-0.21-i486.sfs.Scripts/LP2_Geany-0.21-i486.sfs.geany021.run.sh ]; then
		exec $HOME.my-sfs-scripts/LP2_Geany-0.21-i486.sfs.Scripts/LP2_Geany-0.21-i486.sfs.geany021.run.sh "$SUBMITTED" &
		# Lazy Puppy RunScript for Geany-1.22
		elif [ -f $HOME/.my-sfs-scripts/LP2_Geany-1.22-i686.sfs.Scripts/LP2_Geany-1.22-i686.sfs.geany.run.sh ]; then
		exec $HOME/.my-sfs-scripts/LP2_Geany-1.22-i686.sfs.Scripts/LP2_Geany-1.22-i686.sfs.geany.run.sh "$SUBMITTED" &
	fi
fi

# Remove temp File of submitted file name/s
rm -f /tmp/file_submitted_shift_key_holded_down

exit 0

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#7 Post by nic007 »

A workaround would be to right-click that file instead and use "open with" to specify the application you want it to open with.

mjmikulcik
Posts: 45
Joined: Sat 10 Jun 2017, 00:06

#8 Post by mjmikulcik »

Okay, so I've solved it. If you have the devx installed, (it's an sfs you can get from the setup/sfsmanager called development libraries or you could get it somewhere else)

What you need to do is place the attached file in your /usr/share/mime/packages directory and then run in the terminal the command

Code: Select all

update-mime-database /usr/share/mime
After that, restart X -> go to shutdown, restart graphical server, and when it boots back you have to "set run action" (right-click on file) and instead of being in the 'zip' family it will set for qtractor.

If you don't have devx installed, I recommend it because its useful if you ever want to compile anything, but supposing you don't want it, there is another way.

Code: Select all

#add mime-type (without using update-mime-database)
echo application/x-qtractor-file:*.qtz >> /usr/share/mime/globs
echo 50:application/x-qtractor-file:*.qtz >> /usr/share/mime/globs2
echo application/x-qtractor-file text/xml >> /usr/share/mime/subclasses
echo application/x-qtractor-file >> /usr/share/mime/types
paste this code into a script file. Set it to be executable in the permissions and run it. Then of course restart X. I haven't tested that method.

I hope this helps,
mjmikulcik

p.s. ITSMERSH I love your workaround but I don't think it's quite what Smithy wanted, however I might try it in the future myself
Attachments
Screenshot.jpg
Here is a picture showing it works
(37.96 KiB) Downloaded 97 times
qtractor.xml.gz
I took this by editing audacities. Also rename to just .xml
(287 Bytes) Downloaded 224 times

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#9 Post by Smithy »

Yay that works mjmikulcik, and fast too!

I've made a pet of it to add to qtractor. It's funny, step was talking about that stuff with woodenshoe the other day concerning rox filer.
Many thanks for working it out.

RSH: that does sound good that you can click with the shift key to change what you want to open, from a viewer like Viewnoir to an editor like Gimp, once you got used to it, that could be snappy.
Attachments
click to open.png
(41 KiB) Downloaded 79 times

ITSMERSH

#10 Post by ITSMERSH »

p.s. ITSMERSH I love your workaround but I don't think it's quite what Smithy wanted, however I might try it in the future myself
Never mind. 8)
RSH: that does sound good that you can click with the shift key to change what you want to open, from a viewer like Viewnoir to an editor like Gimp, once you got used to it, that could be snappy.
It is! :D

Post Reply