Xfce Screenshooter restored to sanity

Share your own howto's etc. Not for support questions!

Xfce Screenshooter restored to sanity

Postby HarborView » 2015-09-09 02:39

There is nothing wrong with the Xfce Screenshooter. It activates a popup whenever the Print Screen/Sysrq key is pressed. But I have a detached keyboard and sometimes when I move it I hit that key accidentally. Then I have to click the red X. Not a big deal.

Except sometimes it repeated 30, 40, I don't know how many times. I spent several minutes clicking and clicking to erase all the popups. This was insane.

Then as I was reading man pgrep I saw a crossreference to pkill. Instead of killing a process by the PID number, it can kill by name. When it does it kills every instance of the process.
Both pgrep and pkill are limited to the processes that one user with their -u option.

So I made a Bash program:
Code: Select all
pkill -f -u $UID xfce4-screensho

I created a launcher on screen and pointed it to the program. I dragged it to the lower right and tested it. I hit the Print Screen over and over and over and etc. Then one click cleared them. Once click clears them.

Today I simplified it. In the launcher itself I I entered:
Code: Select all
pkill -f -u AAAA xfce4-screensho

The launcher for Xfce 4.08 doesn't use system variables such as ~ or $UID. So AAAA stands in for my user name.

The -f option is optional. It means kill only processes with that exact name. Let me explain. The same option is in pgrep:
Code: Select all
pgrep -u $UID display

not only listed every running occurence in ImageMagick's display but also a program displaytest.sh.
Code: Select all
pgrep -x -u $UID display

gets the exact name. I'm pretty sure that there is no other program that starts with xfce4-screensho but the -f option give a level of safety.
Posts: 41
Joined: 2014-02-01 02:21
Location: The Space Coast of the USA

Re: Xfce Screenshooter restored to sanity

Postby dilberts_left_nut » 2015-09-09 07:24

Code: Select all
killall <name>
works too.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
Posts: 5077
Joined: 2009-10-05 07:54
Location: enzed

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests