So, because the repository version gave me dependencies issues, I use AntiMicroX as an AppImage to use a gamepad as mouse/keyboard. I’m trying to create scripts to launch programs like browsers, while launching AntiMicroX as it starts and killing it when the program ends.
So far I’ve managed to kill the process AntiMicroX-86_64.AppImage with pkill AntiMicroX. But antimicrox still runs in the tray after that. After analyzing the list of processes, i’ve seen that two processes are launched :
- AntiMicroX-86_64.AppImage, which seems to be the GUI as it ends when the window is closed
- AppRun.wrapped, which seems to be the core of it, as i can still use the gamepad when it’s running (and the icon shows in the tray).
So I can simply pkill AntiMicroX ; pkill AppRun.wrapped and it effectively closes both, working as expected. But I’m kind of unsure about how safe it is to terminate it via its name, since other apps could use this AppRun.wrapped name, i guess.
From what i could find, it seems to be something that should be avoided but can happen when building the AppImage, so pkill could catch other AppImages processes (though none of the AppImage that i have create processes named that way). Probably not a big deal since it’s probably restricted to AppImages, but I thought i’d ask around.
The AppImage is just a squashfs container. From your scropt you can mount it and run the executable or even extract it once and then run the executable from the script. Mounting is easier if the appimage updates itself. More information
Can you use
pkill -fwith the full command line? Or is it the same for all AppRun.wrapped processes?Yup, very clever, I think this will avoid any problem with other potential AppImage processes. Thank you very much <3
For more details : this AppRun.wrapped process is mounted in a partially randomized folder each time, something like /tmp/.mount_AntiMiXXXXXX/AppRun.wrapped, where the Xs are a bunch of random characters. So using pkill with regex can both include all versions this full command line can take, while excluding processes created by other apps (which, I suppose , won’t have ‘AntiMi’ in their folder name) :
pkill -f /tmp/.mount_AntiMi.*/AppRun.wrappedBy setting a specific temp where AppImage would mount itself, you can be more certain to kill the right thing with regex later:
export TMPDIR=/path/you/want/tmp ./YourApp
Kill signals have different priorities in Linux. The default should be to ask it to kill itself and cleanup nicely, which may or may not work. If you want to be absolutely sure it dies every time, you want to use
pkill -9 whateverprocess.Thanks for the tip, i had to try it out because i didn’t knew that. It seems in this case the
-9option does the same as default (delete the AntiMicroX process but not the AppRun one). I also tried withkillalland its-goption to include all processes in the same group, but they probably are not in a common group since it behaved the same. Anyway, TIL about these options so thank you !In this case you’re just seeing the App image container and it’s subprocess as two different processes. If you kill the AppImage process, it SHOULD kill the subprocess unless there is something whacky going on with how they spawn it.
It may also be different if for some reason sudo is being being used in the mix here.


