Trash for Ice

Stuff that has yet to be sorted into a category.
Message
Author
User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

Trash for Ice

#1 Post by dvw86 »

I don't know if anybody would be interested, but here is a little script that I wrote for Ice, that creates a "Trash" can on the desktop. It could easily be made to work in other window managers though. It is manual intallation only at the time. I got the trash icons from Knoppix. Here is a screen shot of how it looks.

EDIT
In the README file I forgot to mention that you need to create a symlink of /root/my-applications/bin/empty-trash and place it in /usr/local/bin
I fixed it.
Image

EDIT File removed. Download final copy here
Last edited by dvw86 on Mon 20 Feb 2006, 02:54, edited 4 times in total.

User avatar
papaschtroumpf
Posts: 250
Joined: Fri 17 Jun 2005, 04:23

#2 Post by papaschtroumpf »

clever.
is there really a need for both a png and an xpm icon?
Mandriva LE 2005 user and puppy newbie

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#3 Post by dvw86 »

The .xpm is 16X16 and is for the Ice Quick Launch Menu. The .png is for the desktop icon and is 48X48.

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

the png might work in the menu too ... icewm can display pngs's and will automatically resize them too

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#5 Post by dvw86 »

GuestToo wrote:the png might work in the menu too ... icewm can display pngs's and will automatically resize them too
That would be great since I have a bunch of png's that I want to use in the Ice menu. I'll give it a try.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#6 Post by Lobster »

dvw86 wrote:
GuestToo wrote:the png might work in the menu too ... icewm can display pngs's and will automatically resize them too
That would be great since I have a bunch of png's that I want to use in the Ice menu. I'll give it a try.
I did miss having a bin - so now I have one - good stuff. I notice that Puppy or is it Linux takes several seconds to delete files (applies to copying aswell)

Is this mounting, compressing and uncompressing? Why is it slow? Can it be speeded up or tell me it is doing it?

:)
thanks again
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#7 Post by dvw86 »

It is not slow on my system. It is pretty instantaneous, although Rox doesn't update until after you mouse over the Rox window. It's just a simple script (my first shell script btw). It just checks to see if you have included a file or directory when activating the script. If there is a file or directory it moves it to the trash. If no file or directory it simply opens up the trash file in Rox.

Code: Select all

#!/bin/sh
test -sd "$@"
if [ "$?" = "0" ]
then
exec rox /root/.Trash
else mv "$@" /root/.Trash/
fi
The empty trash script just deletes everything in the trash directory.

Code: Select all

#!/bin/sh
rm -r /root/.Trash/*

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#8 Post by GuestToo »

you can add paths that icewm searches for icons, in the preferences file ... so you don't need to include the path to the icon

if the icon is an xpm, you do not need to include .xpm ... if it's a png, you need to include the .png

you can put icons in /root/.icewm/icons/ if you like

User avatar
papaschtroumpf
Posts: 250
Joined: Fri 17 Jun 2005, 04:23

#9 Post by papaschtroumpf »

If that's OK with you, I will add this to my IceWM Unleashed, making some of the tweaks that GuestToo suggested.
Mandriva LE 2005 user and puppy newbie

User avatar
flamesage
Posts: 214
Joined: Sat 02 Jul 2005, 00:39

#10 Post by flamesage »

Could there be a way we could DRAG it onto a recycle bin icon in the taskbar?
Or mabe when you right click it you could automaticly tell it "Send to Trash"

User avatar
papaschtroumpf
Posts: 250
Joined: Fri 17 Jun 2005, 04:23

#11 Post by papaschtroumpf »

Have you even tried it? grab a file from rox-filer and drag it onto the icon and it goes to the trash, just like you'd expect.

SendTo is not working for me yet but it should work, I must have screwed up somewhere. (EDIT: I had and it now works)

Anyone knows of a clever way that you could get the "empty trahscan" choice if you right click on the trashcan rather than use the quicklaunch?

By the way, I did verify that if you put the png icon in the icewm path, and specify the png extension in the quicklaunch menu (the toolbar file), it gets dispayed properly and gets resized. Minor savins, but everything counts.

As part of adding this to an unleashed, I think the following paths make sense:
scripts in /usr/X11R6/bin
png icon in /usr/local/share/icewm/icons
modify toolabr file in /usr/local/share/icewm/toolbar
ln -s /usr/X11R6/bin/empty-trash /usr/local/bin/empty-trash
ln -s /usr/X11R6/bin/Trash /root/Choices/SendTo/Trash
Mandriva LE 2005 user and puppy newbie

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#12 Post by GuestToo »

it's trivially easy to add Empty Trash to the context menu of the trash icon, if you make it a roxapp

the roxapp will have the icon in it too

you can run a roxapp from a menu, and link to the icon inside it (or the icon inside it can be a symlink if you like)

see my aterm dotpup (or aumix or eboard or mplayer or xmms) to see how to add context menus to a roxapp (right click the icon and click Look Inside ... the context menu is in AppInfo.xml ) ... and read the rox docs

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#13 Post by dvw86 »

Great ideas. I'll work on a context menu for the trash can.
I think the following paths make sense:
scripts in /usr/X11R6/bin
png icon in /usr/local/share/icewm/icons
modify toolabr file in /usr/local/share/icewm/toolbar
ln -s /usr/X11R6/bin/empty-trash /usr/local/bin/empty-trash
ln -s /usr/X11R6/bin/Trash /root/Choices/SendTo/Trash
I was trying to keep as much of it in root as possible so it will not get deleted with Puppy upgrades, but you can stick things in any directory that you want. I'm glad that some one finds it useful.

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#14 Post by dvw86 »

Ok, here it is. This is a Rox App version of Trash. I did not include the IceWM Quick Launch Menu or the empty-trash script since you can now right click on the trash icon and select "Empty the Trash". Just unzip it, put it where you want, and drag it to your desktop. I will also make a zip file of the icons and the empty-trash script for those who may want them. Only one icon is included and it sets itself. Thanks to GuestToo for his words of wisdom.
EDIT You will also need to create /root/.Trash if you do not already have it.

EDIT #2 File removed. Download final copy here
Last edited by dvw86 on Tue 19 Jul 2005, 00:09, edited 2 times in total.

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#15 Post by dvw86 »

This is basically the things I took out of the first zip file. You can use them to make an "Empty the Trash" item in the Quick Launch Menu if you do not already have it.
Attachments
trash-extras.zip
Extra script and icons for the Trash Application.
(5.26 KiB) Downloaded 1197 times

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#16 Post by Flash »

Will this work with any version of Icewm, on any version of Puppy?

I need to know for the index. Thanks.

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#17 Post by GuestToo »

this line in AppRun will create /root/.Trash if it doesn't exist:

[ -d /root/.Trash ] || mkdir /root/.Trash

changing the trash icon (full, empty) is easy ... getting rox to show the changed icon, rather than a cached version of the old icon, is harder

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#18 Post by dvw86 »

Flash wrote:Will this work with any version of Icewm, on any version of Puppy?

I need to know for the index. Thanks.
It will now run in any window manager (I've tested it in Jwm and Fvwm95). It should also run in any version of Puppy, but I've only tested it in 1.0.3.

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#19 Post by dvw86 »

GuestToo wrote:this line in AppRun will create /root/.Trash if it doesn't exist:

[ -d /root/.Trash ] || mkdir /root/.Trash

changing the trash icon (full, empty) is easy ... getting rox to show the changed icon, rather than a cached version of the old icon, is harder
Thanks, I'll add that to it. How would I go about changing the icons based on the contents of root/.Trash? My first thought is that I would I check for the size of the directory and anything over 0 bytes be considered full. I don't know how I would then set the icon though.

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#20 Post by dvw86 »

I now have the icon changing every time something is added to the trash and when the trash is emptied. There are a couple of issues though.
First is that the icon isn't updated until you mouse over the trash icon (just like the Filer windows).
Second is that the application HAS to be placed in /root/my-applications/bin

Here is the code. Any recommendations? Any body know how to get rox to refresh icons from a shell command?

Code: Select all

#!/bin/sh
# July 2, 2005 - Dan Van Wormer - Puppy Linux

[ -d /root/.Trash ] || mkdir /root/.Trash
test -sd "$@"
if [ "$?" = "0" ]
then
exec rox /root/.Trash
else mv "$@" /root/.Trash/
cp /root/my-applications/bin/Trash/trashcan_full.png /root/my-applications/bin/Trash/.DirIcon
fi

if [ "$1" = "-empty" ]
then
rm -r /root/.Trash/*
cp /root/my-applications/bin/Trash/trashcan_empty.png /root/my-applications/bin/Trash/.DirIcon
fi

Post Reply