Identify USB stick insert/removal and lock/unlock screen...
Hi - I want a system that locks my X display (using xscreensaver) when I remove my USB stick and automatically unlocks it when I remove my usb stick.
I'm planning to create a shell script running in constant loop and sleeping for a few seconds everytime in the end of loop - unless I have to use a way where that wont work...
The big problem is reacting to insert/removing the usb stick...
And then recognizing the usb stick to be the correct one without mounting it if possible - this way I guess it could be any USB device...
Smaller problem is how to unlock the xscreensaver... it could just be killed and restarted.
So far the best plan (and it's not that good) I have come up with is to watch fstab, as the usbstick's mount point and parameters are added there automatically when plugged in and removed when taken off and react according to it... It's very quick and dirty solution, but it get's worse...
To identify the usb-stick I don't know a way without mounting it and I dont want to mount it automatically, so I came up with another quick and dirty solution - when usb-stick is inserted it quickly mounts it, checks if certain data is saved there and unmounts it - and unlocks/kills&restarts the screensaver if it is the correct stick.
I would really wish to have a better solution than this, but it could work at least. Any help for not so... lame solution is highly appreciated!