xInterface-0.4 Trash can Thread last updated on 2008-04-11 22:28:57

Posted by member 378304 on 2008-04-08 12:50:18

Hey.

I know it's lame to ask for other peoples code, but has anyone made a Trash can with xInterface-0.4 that want to share their code?

I've been trying to make one for a pretty long time now, but i don't understand the readme ( I have read it atleast 40 times)

I have looked at some of fractal.designs themes and he does it with a lua script and some other stuff.

Posted by member 269067 on 2008-04-09 11:08:33 link

ok here's my code.
Here's what happens: I have an xlabel that displays a trash can icon.
Following the xInterface readme, It refreshes "TrashLabel" with a new icon depending on if the trash is full or not.
;--xInterface for "trashlabel"--

xTrashBecomesEmpty !LabelRefresh TrashLabel TrashLabelImage "trash.png"
xTrashBecomesFilled !LabelRefresh TrashLabel TrashLabelImage "trashfull.png"
xTrashCheckInterval 2

;--xlabel for trash can--

*Label TrashLabel
TrashLabelPaintingMode .image
TrashLabelX -44
TrashLabelY -44
TrashLabelImage "trash.png"


You should have trash icons named "trash.png" and "trashfull.png" for this particular example to work, and you probably have your own ideas on what to name the label, but this should get you started.
I also have a popup that goes along with it:
;--TrashLabel popup menu--

*Popup "Recycle Bin" !New !PopupTrash
*Popup "Empty recycle bin" !xTrashEmpty
*Popup "Open recycle bin" "$BitBucket$"
*Popup ~New

and add this to the "TrashLabel" entry:
TrashLabelOnLeftClick !PopupTrash

Posted by member 378304 on 2008-04-09 11:24:13 link

Cool. Thanks a lot :D When i try to hook the trash can label to my backround the icon disappears. Anyone know how to fix this?

This is the code i have for the trash can and backround:

*Label Trash
*TrashModuleHook !LabelLsBoxHook xTrash
TrashX 184
TrashY 172
TrashWidth 143
TrashHeight 86
TrashIPaintingMode ".image"
TrashImage Trashbg.png
TrashMoveAble
TrashNoMoveCursor
TrashMoveModifierKey ".none"
TrashFont Marke Eigenbau
TrashFontHeight 12
TrashFontColor FFFFFF
TrashFontSmoothing False
TrashFontTopBorder 15
TrashFontLeftBorder 29
TrashText "[exportedevar('xTrashItemCount')] Item(s)"

*Label xTrash
xTrashX 200
xTrashY 200
xTrashWidth 29
xTrashHeight 42
xTrashPaintingMode ".image"
xTrashImage TrashEmpty.png
xTrashAlwaysOnTop False
xTrashBecomesEmpty !LabelRefresh xTrash xTrashImage "TrashEmpty.png"
xTrashBecomesFilled !LabelRefresh xTrash xTrashImage "TrashEmpty.png"
xTrashMoveAble
xTrashNoMoveCursor
xTrashMoveModifierKey ".none"
xTrashCheckInterval 1
*xTrashOnLeftClick .shift !xTrashEmpty

Posted by member 360399 on 2008-04-09 17:54:34 link

What about showing the trashcan usage (in percent) ??
I would add this to my nxt theme :D

Posted by member 1 on 2008-04-09 19:33:27 link

errrr...let me get this straight...you want to know how full your recycle bin is? Isn't it always 0%?

Posted by member 378304 on 2008-04-10 02:05:36 link

@xbullethammer: I can try to record the trashcan in action when i get home from school.

@DeViLbOi: What do mean? How can a recycle bin always be 0% full when it's something in it?

Edit: Here's a video of the trash can in use:

http://dl.getdropbox.com/u/7547/LsTrash.wmv

As you can see the icon doesn't move with the window, anyone know how to fix that?

Posted by member 93947 on 2008-04-10 07:51:06 link

use a overlay label to display the icon, or hook the iconlabel into the other

Posted by member 378304 on 2008-04-10 07:53:43 link

Well, if you had looked at my code you would have seen that i tried to do that:

*TrashModuleHook !LabelLsBoxHook xTrash

Edit: Nevermind guys. I found a typo. My x and Y axis for xTrash were 200, they should have been 20 :p

Thanks for all the help

Posted by member 1 on 2008-04-10 08:11:27 link

The Recycle Bin can always be 0% full with things in it because it has no max. size. It isn't like a drive where there are limitations to the storage. 1500/∞ = 0%

Posted by member 212670 on 2008-04-11 05:25:05 link

By default, recycle bins have a max size of 10% total drive space per drive. So if something is in it, you could calculate the percentage filled (doing a little math using xinterface and xstatsclass). Of course, if someone changes the default size of the recycle bin, that goes out the window... unless there's a way to get that info somehow.

Posted by member 378304 on 2008-04-11 06:38:42 link

To be honest i don't understand what you two are talking about... i have done everything i wanted to do with my trash can. It deletes files and shows how many itmes i have in there... never wanted to do anything more.

Posted by member 1 on 2008-04-11 07:52:24 link

xbullethammer asked if you could display the size in %. Which is what we are talking about.

xcal: but you don't know which drive each file is on that was deleted so you can't calculate it that way, unless you only have one drive.

Posted by member 378304 on 2008-04-11 16:07:53 link

Haha, i miss read xbullethammers post. I thought it said "What about showing the trashcan in use" :p

Posted by member 212670 on 2008-04-11 22:28:57 link

@DeV: Yup, that presents another problem.

Regardless, I honestly can't think of why someone would even want to know the % of their bin that's filled. It just seems like completely useless info. You'd be better off just knowing how much HD space you have left.