Custom responses to HAL events
lists at basilisk.ukfsn.org
Wed Nov 15 23:10:06 GMT 2006
On Wednesday 15 November 2006 08:28, Boyan Tabakov wrote:
> 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:
> while true ; do
> if [ `hal-device | grep "identification string goes here" | wc -l` -ge 1 ]
> -f ~/Desktop/.My\ Hidden\ Icon &&
> mv ~/Desktop/.My\ Hidden\ Icon ~/Desktop/My\ Visible\ Icon
> -f ~/Desktop/My\ Visible\ Icon &&
> mv ~/Desktop/My\ Visible\ Icon ~/Desktop/.My\ Hidden\ Icon
> sleep 5 # sleep for 5 seconds before attempting to refresh
> Just make sure the script is started when you launch KDE, buy copying it to
> There maybe are ways to detect the kernel notification upon the PDA
> connect, but I don't know how to do that...
Thanks Boyan... that got me thinking. The solution I have come up with is to
use a udev rule. When I plug in my PDA, a network interface called usb0 is
created for it, so I created a file /etc/udev/rules.d/85-PDA.rules
and a /home/paul/bin/PDA script containing:
case "$ACTION" in
cp /home/paul/PDA.desktop /home/paul/Desktop
rm -f /home/paul/Desktop/PDA.desktop
This needs a bit of polishing, but it seems to do what I wanted.
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
More info: http://www.kde.org/faq.html.
More information about the kde