| Prev |   1   2   3   | Next
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   close all open tasks easily in 1 gesture? (https://talk.maemo.org/showthread.php?t=62183)

jedi 2010-09-13 17:59

Re: close all open tasks easily in 1 gesture?
 
Here's my quick 'n' very dirty script.

Note: it requires Bash and wmctrl (apt-get install bash wmctrl)

Code:

#!/bin/bash
IFS=$'\n'
shopt -s nocasematch

# Array of window titles NOT to close
NOCLOSE=("hildon-home" "hildon-status-menu" "desktop")

for LINE in `wmctrl -lp `; do
  PID=`echo "$LINE" | awk '{print $3}'`
  PTITLE=`echo $LINE | awk '{print $5}'`
  SKIP=FALSE
  for i in ${NOCLOSE[@]};do
      if [[ "$i" = "$PTITLE" ]];then
        SKIP=TRUE
      fi
  done
  if [[ $SKIP = TRUE ]]; then
      echo "Skipping $PID ($PTITLE)"
  else
      echo "Killing $PID ($PTITLE)"
      kill $PID
  fi
done

With the help of this post I've added it as a shortcut to my power key menu.

My coding skills suck - I'm sure there's a much better/optimal way of doing this, but it works for me.

SallyJane 2010-09-13 18:33

Re: close all open tasks easily in 1 gesture?
 
How about linking this function or script to the accelerometer ?

So flipping the device face over, or shaking it, clears all tasks.

Matan 2010-09-13 18:36

Re: close all open tasks easily in 1 gesture?
 
When the device is locked there is another window that should probably not be closed: gp_tklock.

It seems to me that the id of all the windows that should not be locked starts with 0x01, and the other (user) windows starts with something else. Using this might make your script simpler, and might allow for not closing other windows that should not be closed, that are not on your list.

fraaaaanka 2010-09-13 18:37

Re: close all open tasks easily in 1 gesture?
 
Quote:

Originally Posted by southwalesboy (Post 814503)
Hi, Ive tried both searches and cant seem 2 find any hints, but does anyone know of a way to kill all open tasks instantly? easily! I always end up with 20 odd conversation windows and it bugs be havin 2 click them 1 by 1 to shut in the task switcher. I am a text addict!

super idea!!!

jedi 2010-09-13 18:44

Re: close all open tasks easily in 1 gesture?
 
Quote:

Originally Posted by Matan (Post 815107)
When the device is locked there is another window that should probably not be closed: gp_tklock.

For me, there's no chance the script will be run when the device is locked (as I run it from my power key menu). But if you are using it in a situation where you need it, add "gp_tklock" to the NOCLOSE array (obviously).

Quote:

Originally Posted by Matan (Post 815107)
It seems to me that the id of all the windows that should not be locked starts with 0x01, and the other (user) windows starts with something else. Using this might make your script simpler, and might allow for not closing other windows that should not be closed, that are not on your list.

I was wondering the same, and if this was a good way of identifying windows not to be closed. Can anyone confirm the magicery behind these codes?

jedi 2010-09-13 19:44

Re: close all open tasks easily in 1 gesture?
 
I've been playing with "gp_tklock" which interestingly is the only ID starting 0x00. It's started when the phone is locked, but if I kill it (wmctrl -c "gp_tklock") it goes and I'm still able to unlock my phone (both with power button/swipe and side flick switch).

Anyway here's a much simplifed version of the script, now killing anything with an ID > 0x01 instead of using a "NOCLOSE" array.

Code:

#!/bin/bash
IFS=$'\n'

for LINE in `wmctrl -lp `; do
  if [ ${LINE:2:2} -gt 1 ]; then
      PID=`echo "$LINE" | awk '{print $3}'`
      PTITLE=`echo $LINE | awk '{print $5}'`
      echo "Killing $PID ($PTITLE)"
      kill $PID
  fi
done


fraaaaanka 2010-09-13 19:55

Re: close all open tasks easily in 1 gesture?
 
Quote:

Originally Posted by SallyJane (Post 815100)
How about linking this function or script to the accelerometer ?

So flipping the device face over, or shaking it, clears all tasks.

typical woman with bad idea .... the shakey option wouldnt work as i listen to music at the gym on my n900

ps only jkin about the typical woman bit!!!!

perhaps long press on camera button when lens cover is closed or an icon on desktop?

southwalesboy 2010-09-13 21:37

Re: close all open tasks easily in 1 gesture?
 
I like the sound of that script, but have no clue how to use it. Is it possible to run it as a queenbee desktop button?

NightShift79 2010-09-13 21:49

Re: close all open tasks easily in 1 gesture?
 
...Back in my symbian days I was so used to 'Jbak TaskMan'...
Hope we see an TaskManager for the N900 some time.

danramos 2010-09-13 21:51

Re: close all open tasks easily in 1 gesture?
 
Quote:

Originally Posted by southwalesboy (Post 814503)
Hi, Ive tried both searches and cant seem 2 find any hints, but does anyone know of a way to kill all open tasks instantly? easily! I always end up with 20 odd conversation windows and it bugs be havin 2 click them 1 by 1 to shut in the task switcher. I am a text addict!

Hold down that button circled in red for a while. I'll bet it'll kill ALL your open tasks pretty instantly. :)

http://natisbad.org/N900/img/n900-to...ons-scaled.png


| Prev |   1   2   3   | Next
All times are GMT. The time now is 10:42.

vBulletin® Version 3.8.8