TrayControl_v1.0

Miscellaneous tools
Post Reply
Message
Author
User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

TrayControl_v1.0

#1 Post by Mike Walsh »

Evening, all.

Honestly, the things I get up to when I'm at a loose end... :lol: :shock:

TrayControl was inspired by the fact that radky has included a Menu item at the foot of the 'Multimedia' menu in DPup 'Stretch'.....called, quite simply, 'CD-Eject'. It does exactly what it says; it ejects the loading tray for your CD/DVD drive.

So; I got to thinking. Whoa..... Bad for my grey cell, too much of that kinda thing..! :lol:

I knew pBurn lets you both eject and load the drive tray while you're using it. So, I did a wee bit of research, and found that the commands involved are included in every Linux distro ever built:-

Quite simply, 'eject' to, well, eject.....and

'eject -t' to close it again.

(from this webpage.)

So, daft bugger that I am, I adapted something I built for the Chrome browser builds I produce.....and put together a 'standalone', point-and-click GUI for opening & closing the optical drive tray. Just because, well.....because I could. :roll: It runs from an icon in the notification area:-


Image


....and looks like this:-


Image


It's totally pointless & nonsensical; a truly daft thing to waste my time on. But.....what the hell, we all need a good laugh now and then. (*shrug*) :lol: :lol: :lol:

Some wag on the page I linked to above even suggested you could create your own, personal 'cuckoo clock'.....by writing a script to build those 2 commands into an hourly cron job. (Oh, for Chrissakes..... Image)

Still; I guess you could (if you were so inclined..!!)

It's all good fun.

For anyone who fancies a laugh, you can find 'em here:-

https://drive.google.com/drive/folders/ ... sp=sharing

There's one of each, due to the included YAD binary.

Enjoy!!


Mike. :wink:

Pro
Posts: 109
Joined: Fri 12 Feb 2010, 11:12

#2 Post by Pro »

if i have 2 CD/DVD drive?

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#3 Post by Mike Walsh »

Pro wrote:if i have 2 CD/DVD drive?
Whoa, steady on, lad. Haven't thought that far ahead yet....

I only threw this together for a laugh last night. You're right, some folks do have multiple optical drives (I've got a second empty bay in my own desktop, should I want one).....but it's not that common.

I'll have to do some research, and figure that one out. I'm not really a 'script kiddie', and have a lot on my plate besides messing around with Puppy, so.....it may be a while yet. (Don't take this too seriously; remember, Puppy's all about having fun!)

In the meantime, for those of us with a single drive, this'll work fine.


Mike. :wink:

artsown
Posts: 403
Joined: Wed 12 Sep 2012, 18:35

#4 Post by artsown »

Mike, I'm glad you posted your "one liner" since it provides a good
working example of how to use yad.

Art

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#5 Post by Mike Walsh »

artsown wrote:Mike, I'm glad you posted your "one liner" since it provides a good
working example of how to use yad.

Art
@ Art:-

In actual fact, that one-liner was figured out mostly by Fred and musher0. I've used it quite a few times since, in various things; small utilities I prefer to keep readily available in the notification area.

Yeah, I know; many of the older crew can't understand why I don't do these sort of things in GTKdialog. The trouble is, I started playing around with YAD about 3 years ago, using Smokey's online guide.....and I've got quite good at putting little GUIs together with it. It's a piece of cake to compile, and it doesn't really take up that much space.....especially considering that even 'old' computers generally now have at least a dual-core CPU, in addition to fair-sized amounts of RAM. The really 'low-powered' hardware that was around when Puppy first came onto the scene isn't so common any more, so I don't really see that Puppy's becoming quite as 'bloated' as the old guard say it is.

Besides, I've got to learn another whole new 'language' for GTKdialog.... :roll: :shock:

Code: Select all

#!/bin/sh
#
#YAD 'one-liner' from musher0 / fredx181, to place executable tray icon in notification area
#
yad --notification --text="Eject CD/DVD Tray" --command='/usr/local/bin/TrayControl.sh' --image='/usr/local/lib/X11/pixmaps/eject.png' 2>/dev/null
But I still don't understand what the '2>/dev/null' thing actually does.....

(Yes, I'm getting reasonably proficient with the command-line after all this time, but I'm still a 'point & click' guy at heart (a hang-over from I don't know how many different versions and years of Windoze). I like making things as easy to use as possible.....and if that kind of approach sits well with newbie 'refugees' from Windoze, well, that all helps to convince them that the kennels aren't such a bad place to be after all... :) )

'New blood' never hurts.


Mike. :wink:

scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

#6 Post by scsijon »

funny thing, but, I unload by clicking on the relative cd drive icon and 'unmount' in the menu that appears, and it opens.

Easy peasy.

Post Reply