Re: Custom responses to HAL events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15.11.2006 00:51, Cathal O'Brien wrote:
> > I've got an icon that does what I want, what I would like is for that
> > icon to
> > be hidden when the PDA is not plugged in and then automatically appear on
> > the
> > desktop when I plug in the PDA.  It's not essential - just wondering if
> > there
> > was a way to do it :-)
> >
> > --
> > Paul
> > ___________________________________________________
> > This message is from the kde mailing list.
> > Account management:  https://mail.kde.org/mailman/listinfo/kde.
> > Archives: http://lists.kde.org/.
> > More info: http://www.kde.org/faq.html.
>
> Nah i cant say its not possible but i was doing something like that with an
> external device before and the icon was always their. Dont know of a way to
> hide the icon once unplugged. Does anyone else know whether this is
> possible?

Hi,
I am not sure if you accomplish this by means of KDE, but here is what I'd do 
to make it work:
You have hal, right? There is a command line tool called hal-device that lists 
all the devices recognized by hal that are connected to the system. Type 
hal-device | less and look through the list when your PDA is connected. Find 
the line that identifies it. You can then right a simple daemon that monitors 
when this device is plugged and make it show/hide your desktop icon.
It ma look something like this:


#!/bin/bash

while true ; do

if [ `hal-device | grep "identification string goes here" | wc -l` -ge 1 ]
then
	-f ~/Desktop/.My\ Hidden\ Icon &&
	mv ~/Desktop/.My\ Hidden\ Icon ~/Desktop/My\ Visible\ Icon
else
	-f ~/Desktop/My\ Visible\ Icon &&
	mv ~/Desktop/My\ Visible\ Icon ~/Desktop/.My\ Hidden\ Icon
fi

sleep 5 # sleep for 5 seconds before attempting to refresh

done


Just make sure the script is started when you launch KDE, buy copying it to 
~/.kde/Autostart

There maybe are ways to detect the kernel notification upon the PDA connect, 
but I don't know how to do that...

-- 
Blade hails you...

Put a stake through my heart
And drag me into sunlight
                 --Nightwish

Attachment: pgppXLu28DX2N.pgp
Description: PGP signature

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux