Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO automate KDE Sweeper to keep digital privacy
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2614
Location: Hamburg/Germany

PostPosted: Tue Apr 20, 2010 11:51 am    Post subject: HOWTO automate KDE Sweeper to keep digital privacy Reply with quote

Hi, this is my first attempt to automate that tool by using the script below as a "mouse driver".
BTW you need the nifty xdotool for this scriptlet :
Code:
#!/bin/sh
#

#   automate KDE sweeper with xdotool
#

# set -x

sweeper &

#   get the window id, but break after MAX seconds
#
WINID=""
N=0
MAX=${2:-10}
while [[ -z "$WINID" && $N -le $MAX ]]
do
   for i in $(xdotool search --title "$Sweeper" 2>/dev/null)
   do
      xwininfo -id $i | grep "^xwininfo: Window id: " | grep -q "\"Sweeper\""
      if [[ $? -eq 0 ]]; then
         WINID=$i
         break
      fi
   done

   ((N=N+1))
   sleep 1
done

if [[ -z "$WINID" ]]; then
   echo "did not found a window id"
   exit 2
fi

xdotool windowactivate $WINID

#   click at "Select All"
#
xdotool key alt+a

#   click at "Clean Up"
#
xdotool key alt+c

sleep 1

#   get the popup window id with the warning message
#
TMPID=$(xdotool search --onlyvisible --title "^Warning ? Sweeper$" 2>/dev/null)
if [[ -z "$TMPID" ]]; then
   echo "did not found the popup window id"
   exit 3
fi
xdotool windowactivate $TMPID

#   click at "Continue"
#
xdotool key alt+o

sleep 2

#   activate the sweeper window and close the app
#
xdotool windowactivate $WINID && xdotool key ctrl+q


exit 0
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum