Okay. Here is how to use xmacro to close ntm.
- install xmacro:
sudo apt-get install xmacro
-
run ntm and check it is running in the system tray
-
open a terminal and type the following command:
xmacrorec2 > stop-ntm.txt
When you run that above command, it will appear to do nothing. That is because it is waiting for you to press any key. Once you have pressed that key, it will go into "record" mode. It will keep recording all actions you take on your desktop until you press that key again. At which point, the recording will stop. I usually just use the "esc" key for this purpose. After you have pressed the "esc" key for the first time, simply move your mouse cursor to the ntm system tray icon and right-click it to bring up its menu. Then left-click on "Quit". when ntm has closed, then click back in your terminal where you are running xmarco and press the "esc" key. This will stop xmacro and will save it's output as a text file in your home folder.
- Open pluma text editor and paste the following command into it
xmacroplay "$DISPLAY" < stop-ntm.txt
Save and close the file as "stop-ntm.sh"
You will now find you have two extra files in your home folder. "stop-ntm-txt" and "stop-ntm.sh"
See below:
- Open caja and right click the "stop-ntm.sh" file and choose "properties" Go to the "permissions" tab and check the "allow executing file as program" checkbox. See below:
Then close the "properties" dialog box.
Now to test the above script:
a) close any instances of ntm that may be open
b) open ntm
c) double click the "stop-ntm.sh" bash script that you have created in your home folder. Choose "run". See below:
You should now find that NTM should close and will disappear from your system tray.
You can now invoke the above "stop-ntm.sh" file in any other bash script with the following command
sh stop-ntm.sh
If you need me to make a video of how to do all of the above, let me know and I will produce one.