I'd like to call a script on the laptop every time I close Lyx to automatically rsync whatever I was just working on to the desktop, if it's available. My first thought is to alias the lyx command to lyx && scriptname, but I don't think that's quite right. It also doesn't deal with launching it from the menu or when clicking a file in Nautilus.
So is there any way to define a script to call as Lyx exits? And, if possible, feed into that script the name of the file that was being edited?