Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Xfce Screenshooter restored to sanity

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
HarborView
Posts: 41
Joined: 2014-02-01 02:21
Location: The Space Coast of the USA

Xfce Screenshooter restored to sanity

#1 Post by HarborView »

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

#!/bin/bash
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.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5343
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: Xfce Screenshooter restored to sanity

#2 Post by dilberts_left_nut »

Code: Select all

killall <name>
works too.
AdrianTM wrote:There's no hacker in my grandma...

Post Reply