I think this needs to be done in the bitmask side. For now, I think it's enought with the IS_SNAP switch, although this might get hairy when we also use snaps for bitmask...
I'm wondering how to do it in bitmask side, as bitmask will need to know if it needs to autostart bitmask, riseup-vpn or whatnot.
There is a multiplatform library for go to do that, even if we don't do it in the go side will be a good source of inspiration to do the python code: https://github.com/ProtonMail/go-autostart
I don't think it should be the vpn service the one dealing with the autostart. I see two possibilities here:
Leave the autostart management to the UI. Which will mean some duplication of code between the qt/js and systray code. And in the qt/js UI will need to add some notifications between js and python to know about status changes in the vpn.
Do the autostart stuff in bitmaskd, but set the name and exec path from the UI. I would move the autostart into the core (instead of the vpn service) and add an API call to set the app information.
I'm tempted by the first option, but I think the second one is less work. I'll give it a try.
it makes sense to me for the bitmaskd to have an autostart API call. the whole idea is that we want to be able to have flexibility in what the frontend is, and not every frontend will be able to create autostart files on their own.
In bitmask-dev!259 (closed) I implement most of it. It basically automatically creates the autostart stuff when the vpn is turn on and deletes it if the vpn is turn off manually (not by shutting down bitmask).
I will add a manual vpn stop into the systray so we get the autostart removed if the user quits manually.