in X-Geek

Making FreeNX always suspend

I’m running my Rivendell radio automation software on a virtual host, connecting to it using FreeNX. It works very well for the most part, but there’s been one little piece which could cause disaster: the FreeNX server’s habit of asking me if I want to suspend or terminate my session. Because my music will stop if the session terminates, I don’t ever want that option. I want it to always suspend.

I spent a few minutes tonight tracking down the best way to do this. It turns out the /usr/bin/nxdialog script is being called. By patching this script, I can force the suspend option every time. Problem solved!

Below is the code that does the magic:

— nxdialog.orig 2011-10-24 11:45:14.000000000 -0400
+++ nxdialog-mine 2012-03-30 21:41:33.000000000 -0400
@@ -415,6 +415,11 @@
exit 0
}

+always_suspend()
+{
+ return 3
+}
+
#
# main case statement
#
@@ -427,7 +432,7 @@
${dialog_interface}_yesno
;;
yesnosuspend)
– ${dialog_interface}_yesnosuspend
+ always_suspend
;;
panic)
${dialog_interface}_panic

You can also download the raw patch here.