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)

southwalesboy 2010-09-13 00:34

close all open tasks easily in 1 gesture?
 
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!

extendedping 2010-09-13 01:30

Re: close all open tasks easily in 1 gesture?
 
I think it is a good idea as well.

Reffyyyy 2010-09-13 01:35

Re: close all open tasks easily in 1 gesture?
 
Interesting idea that hopefully a developer will implement.

SAABoy 2010-09-13 08:51

Re: close all open tasks easily in 1 gesture?
 
great idea :D

rolan900d 2010-09-13 09:08

Re: close all open tasks easily in 1 gesture?
 
doesn't the optimizeN900 script kill all running tasks?

Matan 2010-09-13 09:30

Re: close all open tasks easily in 1 gesture?
 
modified-hildon-desktop has a dbus call to close a specific window. With that it should be easy to write a script to close all windows. You can then call this script with some key combination, or using a desktop widget.

southwalesboy 2010-09-13 12:42

Re: close all open tasks easily in 1 gesture?
 
I got queen bee running with some nice shortcuts, can anyone write a script I could use with that?

And btw it wasnt an idea, it was a question I thought someone must have had this sorted by now. its been bugging me long time.

And @ rolan900d I dont want to kill all running processes inc system ones. Just the open windows in the task switcher, or even just the conversation related task windows would be better!

Anyone with the know how feeling in the mood to post a script?? :D

extendedping 2010-09-13 13:33

Re: close all open tasks easily in 1 gesture?
 
actually it works perfect for me already...about once a day.

then I pull out the battery, and reboot.

Matan 2010-09-13 13:41

Re: close all open tasks easily in 1 gesture?
 
It might also be possible to use wmctrl for that.
wmctrl -l lists all windows, including their titles, and wmctrl -c closes a window.

Tedri Mark 2010-09-13 14:02

Re: close all open tasks easily in 1 gesture?
 
Something similar to how in xp 5 firefox windows are grouped together on the taskbar, and the option to close group would be handy..

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

NightShift79 2010-09-13 22:03

Re: close all open tasks easily in 1 gesture?
 
lol... come on...

danramos 2010-09-13 22:41

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

Originally Posted by NightShift79 (Post 815293)
lol... come on...

I'm a jerk. Sorry, couldn't help it for the chuckle. :p

Crugath 2010-09-14 19:15

Re: close all open tasks easily in 1 gesture?
 
Apologies if this has been mentioned before already. I know it's not quite the same, but it's close enough. Like you said, if you have 21 conversation windows open, select one of them, tap the power button and choose "End Current Task" and all 21 conversation windows will close. I know that doesn't affect the other applications open, but it does make it easier :P

jedi 2010-09-15 09:41

Re: close all open tasks easily in 1 gesture?
 
So has anyone tried this script? I've found it pretty handy - especially when run from the power button menu.

Just occasionally it seems to not close certain windows, and I'm wondering if it's related to the assumtion of the 0x00 / 0x01 ID's being system-specific?

pelago 2010-09-15 12:52

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

Originally Posted by Crugath (Post 816129)
Like you said, if you have 21 conversation windows open, select one of them, tap the power button and choose "End Current Task" and all 21 conversation windows will close.

Does anyone know if that closes the app "nicely", i.e. allows it to finish writing to databases etc.? I've always assumed it was to kill a task that was non-responsive in a possibly destructive manner.

munkiii 2010-09-15 14:30

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

Originally Posted by jedi (Post 815159)
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


How do i save this as a script and run it?

I have saved all that code into a file called "close_all.sh", and tried to run it by typing

Code:

cd /home/user/
sh close_all.sh

but i get an error of

Code:

close_all.sh: line 5: syntax error: Bad substitution

jedi 2010-09-15 15:12

Re: close all open tasks easily in 1 gesture?
 
It's because it's a bash script.

First make sure you have bash installed ("apt-get install bash" when root user).

Then set the exec permission on your file:
Code:

chmod +x close_all.sh
Then run it with:
Code:

./close_all.sh
Note: you don't need to be root user to run it.

Zidust 2010-09-15 15:21

Re: close all open tasks easily in 1 gesture?
 
Have you guys ever thought about a type of Sleep/restore function? A way for the user to easily close all tasks and afterwards just as easily open all tasks again?

I'm no developer so I have no idea if this is even possible but it would be a little like firefox's restore function.

What do you guys/developers think? Is this possible? It could give us a nice boost in battery power at least :).

allnameswereout 2010-09-15 17:42

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

Originally Posted by danramos (Post 815317)
I'm a jerk. Sorry, couldn't help it for the chuckle. :p

Well, it does work, it works out of the box, and it is rather typical for monolithic OSes and dumb terminals.

If you close all windowed applications you might as well restart your phone. Who says a daemon isn't to blame? Hence, I'd say the right way is to use upstart for this (there isnt a sysvinit).

Quote:

Originally Posted by Zidust (Post 816938)
Have you guys ever thought about a type of Sleep/restore function? A way for the user to easily close all tasks and afterwards just as easily open all tasks again?

I'm no developer so I have no idea if this is even possible but it would be a little like firefox's restore function.

What do you guys/developers think? Is this possible? It could give us a nice boost in battery power at least :).

Yes, I did, but GeneralAntilles was of the opinion thats for Intel netbooks since our lil ARM device was 24/7 never going down because it could go into very low power mode.

If you do want to suspend an application you can use kill -19 <pid>, and kill -18 <pid> to continue it.

Now, in theory he had a good point, in practice not since the device can sometimes hardly be up for 6 hours. Even laptops would auto suspend or hibernate when juice is too low.

SAABoy 2010-09-17 23:06

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

Originally Posted by fraaaaanka (Post 815173)
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?

dude, really? that was a nasty comment whether you call it a joke or not.


All times are GMT. The time now is 10:42.

vBulletin® Version 3.8.8