read -n 1 -s -r -p "Press any key to close."
so that the entire script is:
Code: Select all
#!/bin/bash
echo Click on any part of any window to see its launch command.
ps --no-headers -o cmd $(xprop _NET_WM_PID | cut --delimiter=' ' --fields=3)
read -n 1 -s -r -p "Press any key to close."
I've tried sooooo many variations. Nothing works. The script starts fine, the crosshairs appear and I can drag it about, but the terminal session immediately closes when I click on another open window. I can't figure out how to keep it open so I can see the results.
ps $(xprop _NET_WM_PID | cut -d' ' -f3)
works fine when run in a preexisting terminal session.Here is the menu item's launcher:
x-terminal-emulator -e /home/mark/crosshairs.sh
.Here is the text of crosshairs.sh:
Code: Select all
#!/bin/bash
echo Click on any part of any window.
ps $(xprop _NET_WM_PID | cut -d' ' -f3)
Mark.