when i test it with LightDM or SDDM it works
but with GDM after logging out from gnome-shell the whole session terminates
i did this pkill gnome-*
and it went to openbox but gnome-shell never executes again (it fails for some reason)
You have to differentiate between scripts after logout or if after another session login which may be another user(maybe the same or console) and this is where gnome and gdm currently is not great. But first option is maybe some dconf-editor settings or gsettings if that way. Second option may maybe require gdm development if directly gdm support required and cannot be other way accessible.