Author Topic: Tray Closer  (Read 2282 times)

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12645
Tray Closer
« on: July 20, 2009, 05:33:50 AM »
Original  Poster: Old Polack

This is just a quicky.  

The problem: Your computer sits on the floor, to your right. You can reach the button to open the tray, to drop in a DVD, or CD. After dropping the disk on the tray, you have to lean over to reach under the tray to reach the button to close it, or resort to pushing the tray itself, because you can't quite reach the button. Either way, there is a possibility of damaging the tray in the process.

The solution: A tray closing icon on the desktop.

Right click the desktop, and choose Create New --> Link to Application.

A Properties box opens, with "Link to Application" in the title box, highlighted for you to create a new name for the link. Type; Close Tray, as the new title. Click the blue gearwheel icon, and in the pop up, click the Applications button and choose Devices from the drop down menu. Choose a cdrom or dvd icon, whichever best describes your device. Next click the Application tab, and in the box next to Command type, "eject -T" (without the quotes). Click OK, and you have your icon.

If you have more than one optical drive, you need an icon for each. Label them as you feel appropriate, and type the command as;

eject -T cdrom
eject -T dvdrecorder
eject -T dvdrom

depending on what your /etc/fstab shows the device to be named. If you don't like the icon on the desktop proper, or like having it available even when the desktop is covered, drag it to the kicker panel, or the "quick launcher" on the panel, if you like really small, space saving, icons. You can then delete the original desktop icon, if you wish.

Enjoy  
« Last Edit: July 23, 2009, 10:23:26 PM by old-polack »

Thanks to everyone who donates. You keep the servers running.
Follow me on Twitter for the latest development info.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Tray Closer
« Reply #1 on: July 20, 2009, 06:24:45 AM »
Just a note ........ my fstab file does not have an entry for optical drives as the media is mounted as removable media by hal/udev I believe, so maybe the command to toggle the tray for the device should use the device's  /dev node particularly if there are more than one optical device in the machine?

For instance I have two optical devices ..... a SATA internal drive and an external USB connected device.
Using     eject -T cdrom      will toggle the internal devices tray but if I wish to toggle the external device tray I use /dev/<whatever>

eject -T /dev/sr0          my internal device

eject -T /dev/sr1          my external device

Actually the /dev/  part can be omitted and just use

eject -T sr0

eject -T sr1

which will work equally well.

regards.
« Last Edit: July 20, 2009, 06:27:11 AM by JohnBoy »

musonio

  • Guest
Re: Tray Closer
« Reply #2 on: July 20, 2009, 09:16:01 AM »
I loved this tip when I read it and I have become addicted to the panel icon I made with it (no more reaching down those long 20 cm.).
However, I have noticed that I I have been so foolish as to label the dvd/cd with a name that contains blank spaces, the command eject does not work when you try to eject the mounted cd (it does work if tis umnounted).

For example: I labelled a dvd "5a - Contemporanea (A-G)"
When I type eject -T /or eject -T /dev/sr0, I get:

Code: [Select]
umount: /media/5a\040-\040Contemporanea\040(A-G) is not mounted (according to mtab)
eject: unmounting `/media/5a\040-\040Contemporanea\040(A-G)' has failed

If anyone knows a way rounf to get it working (other than not using spaces in the label), please share you knowledge.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Tray Closer
« Reply #3 on: July 20, 2009, 09:50:34 AM »
In place of the single command to eject the tray, you could place a command to unmount the media first .....

umount /dev/sr0
eject -T /dev/sr0

I "think" that should do what you need ......

or, on one line

umount /dev/sr0; eject -T /dev/sr0

regards
« Last Edit: July 20, 2009, 09:52:44 AM by JohnBoy »

musonio

  • Guest
Re: Tray Closer
« Reply #4 on: July 20, 2009, 10:26:33 AM »
I guess the answer was in the question.
Thanks a lot. That worked perfectly!!!!

Online Rudge

  • Hero Member
  • *****
  • Posts: 9766
  • I'm Just A Dog.
Re: Tray Closer
« Reply #5 on: July 23, 2009, 09:48:30 PM »
I added the app to my application bar and put an "open" app there as well. Just use the same command without the "-t" option. -- "eject".. Now I never have to push the button on my drive. :) Nice tip thanks!


-If you wish to make an apple pie from scratch, you must first invent the universe-  Carl Sagan

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11681
  • ----IOFLU----
Re: Tray Closer
« Reply #6 on: July 23, 2009, 10:21:27 PM »
I added the app to my application bar and put an "open" app there as well. Just use the same command without the "-t" option. -- "eject".. Now I never have to push the button on my drive. :) Nice tip thanks!

The -T is for toggle, The tray link both opens and closes the tray.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline coolbreeze

  • Hero Member
  • *****
  • Posts: 2682
  • Error #152 - Windows not found: (C)heer (P)arty (D
Re: Tray Closer
« Reply #7 on: July 24, 2009, 01:59:05 PM »
Thanks for that OP  8)
Linux user #440309
PCLOS IS THE KING  Please Donate to the cause. PCLinuxOS
Asinus caput tuum a te: et esto vigilans!
M5A78L-M mobo, AMD Phenom IIx 6 1055T, 4Gig ram,nvidia GeForce GT 240 1 Gig, Netgear DGN2200

Offline jimwilk

  • Hero Member
  • *****
  • Posts: 1133
Re: Tray Closer
« Reply #8 on: July 24, 2009, 03:43:20 PM »
Texstar,
Thanks for that, I have bookmarked the link to this post for later implementation.

Jim
PCLinuxOS 2013.01 KDE (2 desktop computers)
PCLinuxOS  2013.04 KDE on Asus  laptop


Windows free since 2005
Our house has windows: our computers have no Windoze!
Registered Linux User #409991

Offline Bren

  • Full Member
  • ***
  • Posts: 222
Re: Tray Closer
« Reply #9 on: July 24, 2009, 06:16:40 PM »
This is a neat tip.  I had to make a link to device on my desktop before I could make the link to app. work, though.  I had no idea where to look for the DVD drive otherwise.
Brenda

musonio

  • Guest
Re: Tray Closer
« Reply #10 on: July 24, 2009, 06:44:07 PM »
Bren:
Perhaps you're already aware of it, but there is a mini-applet for the panel called "Media manager" or somthing like that (mine is in Spanish so I ddon't remember the exact name) that show you an icon on the panel for each removable device that is present in the system (mounted or unmounted), which lets you eject a cd/dvd, mount it, open it in Konqueror, etc.

Online Rudge

  • Hero Member
  • *****
  • Posts: 9766
  • I'm Just A Dog.
Re: Tray Closer
« Reply #11 on: July 25, 2009, 04:44:09 PM »

Quote
The -T is for toggle, The tray link both opens and closes the tray.

I'll be darn, that's even better.


-If you wish to make an apple pie from scratch, you must first invent the universe-  Carl Sagan