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 Thu 30 Oct 2014, 08:44
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to add an option to ROX' right-click menu?
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [18 Posts]   Goto page: Previous 1, 2
Author Message
ravensrest


Joined: 22 Feb 2008
Posts: 321
Location: Hood Canal, WA

PostPosted: Mon 10 Jan 2011, 21:13    Post subject:  

Putting a symlink to your "Trash" script in ~/.config/rox.sourceforge.net/OpenWith will result in the Trash item showing up in the Open With... item whenever you right click in Rox-filer. You can instead make the Trash script show up at the top of the main Rox-filer right click menu by selecting the Customize Menu... from the Rox-filer menu that pops up when an item is right clicked. The SendTo directory that pops up is symlinked to the OpenWith directory. Create a symlink in this way for each type of file you want to be able to move to the trash bin. See the rox manual in Puppy for more information.
BS
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Mon 10 Jan 2011, 22:20    Post subject:  

Karl Godt wrote:
does `mv $@` also works with spaces in the filename

and wouid `mv "$@"` also work ?
Try it and see - $@ should work with dragged files but not with command line entry unless you enclose spaced files with quotes -- I have a snippet that replaces spaces though

Code:
#!/bin/sh
[ $1 ] && cd $1
for x in *;do
y=`echo $x |sed "s/ /_/g"`;
[ "$x" != "$y" ] && mv "$x" "$y" && [ -d "$y" ] && $0 $y || [ -d "$x" ] && $0 $x;
done


explanation:
if you entered a directory as input change to that directory
for all files/directories in the current directory do
set up a variable to compare to x try to replace space with underscore using sed
if the variables don't match then must have had a spaces so rename (move) that file to the string with underscores
if the current y or x is a directory run this script in that directory too (this is recursion)
done

$0 refers to the script itself so you can call it recursively as above regardless if it is in $PATH or what it is named ... you can make a self destructing script like:
rm -f $0

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Tue 11 Jan 2011, 12:37    Post subject:  

just to add something that already exists is easy
as explained with symlinks


---------------------------------------------------------------------

*but if you truly want to add a new app to rox that you made its more complex and more code to take care of all of the steps needed

this not only automates it for you it shows you step by step how its done

here is a script you could easily modify to build any right click app
It already works for the trash as is so you have a working example to start with

how to
unzip these two files to root
/root/dnd_trash
/root/setup-global-trash

then just a one time set up needed click on this file and you are done you never have to do that part again
root/setup-global-trash



it uses the trash bin
and a new app dir was created
and a bonus dragNdrop selected files are move to trash

you get a prompt if you want to move the file as a safety

this is how I auto build app directories when I need one


Joe
trash.png
 Description   
 Filesize   15.22 KB
 Viewed   491 Time(s)

trash.png

dnd_trash-1-i486-3_SLXR.tar.gz
Description 
gz

 Download 
Filename  dnd_trash-1-i486-3_SLXR.tar.gz 
Filesize  1.92 KB 
Downloaded  228 Time(s) 

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [18 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0498s ][ Queries: 13 (0.0048s) ][ GZIP on ]