Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    close all open tasks easily in 1 gesture?

    Reply
    Page 2 of 3 | Prev |   1   2   3   | Next
    jedi | # 11 | 2010-09-13, 17:59 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    SallyJane | # 12 | 2010-09-13, 18:33 | Report

    How about linking this function or script to the accelerometer ?

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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Matan | # 13 | 2010-09-13, 18:36 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to Matan For This Useful Post:
    nicolai, pelago

     
    fraaaaanka | # 14 | 2010-09-13, 18:37 | Report

    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!!!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    jedi | # 15 | 2010-09-13, 18:44 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    jedi | # 16 | 2010-09-13, 19:44 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    fraaaaanka | # 17 | 2010-09-13, 19:55 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    southwalesboy | # 18 | 2010-09-13, 21:37 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    NightShift79 | # 19 | 2010-09-13, 21:49 | Report

    ...Back in my symbian days I was so used to 'Jbak TaskMan'...
    Hope we see an TaskManager for the N900 some time.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    danramos | # 20 | 2010-09-13, 21:51 | Report

    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.


    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to danramos For This Useful Post:
    allnameswereout, ibrakalifa, Russe89

     
    Page 2 of 3 | Prev |   1   2   3   | Next
vBulletin® Version 3.8.8
Normal Logout