phiroc wrote on Tuesday, December 04, 2007 2:45 PM:: > is there a way to trap clicks on the Cygwin/X Server icon in the > System Tray or on the Exit Button in the dialog that appears? >
I don't know of a way to trap the exit, but... > I would like cygwin to run a script before shutting down. You could try adding a menu item (to the menu that appears when you right click on the X icon) to provide your own exit method. This is done using the $HOME/.XWinrc file. If you don't already have a file ~/.Xwinrc, you can get a basic one from http://www.msu.edu/~huntharo/xwin/devel/server/example.XWinrc Place it in your $HOME directory, and rename it to .XWinrc You could then change the root menu to something like this: menu root { // Comments fit here, too... "Reload .XWinrc" RELOAD "Kill XWin" exec "my_script ; kill $PPID" "Applications" menu apps SEParATOR } The Exit menu item will not be affected, but the new item "Kill XWin" will run "my_script" (assuming it is in your PATH), then kill XWin. I haven't tested how XWin responds to kill, so you may want to experiment with changing the signal, e.g. to "kill -HUP $PPID" in order to get a clean exit. If you want to know more about the .Xwinrc file, type "man XWinrc" (case is significant). HTH, Phil -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/
