I've learned that it's possible to create inhibitors for a GUI session via dbus. However, when I do try to add an inhibitor, it is immediately removed. Here's an example.
I call to add inhibitor via this command (which is supposed to prevent logout from happening):
qdbus org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Inhibit "x-terminal-emulator" $(xdotool getactivewindow) "TEST REASON" 1
The output of dbus-monitor suggests that it is added, but then immediately removed.
$ dbus-monitor --profile | grep -i inhibitor
sig 1474613346.596581 156 :1.23 <none> /org/gnome/SessionManager org.gnome.SessionManager InhibitorAdded
sig 1474613346.603137 159 :1.23 <none> /org/gnome/SessionManager org.gnome.SessionManager InhibitorRemoved
How can I troubleshoot this ?
System in use: Ubuntu 16.04, Unity