I have Ubuntu 20.04 installed with Unity Desktop only. No default Gnome. In this desktop on pressing the logout button I want to run a python script. One example of this is given in Script Execution at user logout (non root user), but this works in Python2 and Focal Fossa doesn't have Python2. I tried to port this script to Python3 which I couldn't.
Can you show us a way to make this script work in Python3 which is default in Focal Fossa? Or where can we start to write it from scratch?
/usr/bin/gnome-session-quit
with your own script (which calls the original as the final step of course). – Wayne Vosberg Jun 04 '20 at 07:01