Reply
Thread Tools
jedi's Avatar
Posts: 1,411 | Thanked: 1,330 times | Joined on Jan 2010 @ Tatooine
#11
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.
__________________
May the source be with you.
 
Posts: 176 | Thanked: 59 times | Joined on Mar 2010
#12
How about linking this function or script to the accelerometer ?

So flipping the device face over, or shaking it, clears all tasks.
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#13
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.
__________________
My repository

"N900 community support for the MeeGo-Harmattan" Is the new "Mer is Fremantle for N810".

No more Nokia devices for me.
 

The Following 2 Users Say Thank You to Matan For This Useful Post:
Posts: 436 | Thanked: 298 times | Joined on Jan 2010 @ England
#14
Originally Posted by southwalesboy View Post
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!!!
__________________
SEE THE WIKI.MAEMO ALARMED PAGE AND FIND NEW, COOL COMMANDS AND IF YOU HAVE ANY COOL/AWESOME/USEFUL COMMANDS YOURSELF PLEASE ADD THEM. http://wiki.maemo.org/ALARMED_Commands_List
If you dont have a wiki.maemo account and cant be bothered to create one you can inbox me your commands and I will add them for you.
 
jedi's Avatar
Posts: 1,411 | Thanked: 1,330 times | Joined on Jan 2010 @ Tatooine
#15
Originally Posted by Matan View Post
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).

Originally Posted by Matan View Post
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?
__________________
May the source be with you.
 
jedi's Avatar
Posts: 1,411 | Thanked: 1,330 times | Joined on Jan 2010 @ Tatooine
#16
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
__________________
May the source be with you.
 
Posts: 436 | Thanked: 298 times | Joined on Jan 2010 @ England
#17
Originally Posted by SallyJane View Post
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?
__________________
SEE THE WIKI.MAEMO ALARMED PAGE AND FIND NEW, COOL COMMANDS AND IF YOU HAVE ANY COOL/AWESOME/USEFUL COMMANDS YOURSELF PLEASE ADD THEM. http://wiki.maemo.org/ALARMED_Commands_List
If you dont have a wiki.maemo account and cant be bothered to create one you can inbox me your commands and I will add them for you.
 
Posts: 95 | Thanked: 26 times | Joined on Oct 2009 @ UK
#18
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's Avatar
Posts: 417 | Thanked: 200 times | Joined on Apr 2010 @ Germany
#19
...Back in my symbian days I was so used to 'Jbak TaskMan'...
Hope we see an TaskManager for the N900 some time.
 
danramos's Avatar
Posts: 4,672 | Thanked: 5,455 times | Joined on Jul 2008 @ Springfield, MA, USA
#20
Originally Posted by southwalesboy View Post
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.

 

The Following 3 Users Say Thank You to danramos For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:13.