I've written a little pipemenu script for the OB menu that offers the user a quick way to view/manage processes. I figured it would be convenient to add this to the Openbox menu, since it's always a click away anyway. This script spits out a pipe menu displaying the user's currently-running processes, from which they can be killed, suspended, restarted... The list of actions is customizable.
There's a section at the top of the script where you can add any processes you would like to be ignored (i.e. terms you want to be skipped by the menu), and a section to customize the actions you can perform on each. To get it working, just drop the script anywhere in your $PATH and add it to your menu as follows:
<menu execute="obpipemenu-processes" id="obpipemenu-processes" label="Kill" />
Get it here.
It's written in Python and requires Python 3. Feedback is appreciated!
EDIT: Fixed link.
Last edited by evhan (2009-11-12 16:05:47)
I've written a little pipemenu script for the OB menu that offers the user a quick way to view/kill processes:
I've often wanted the ability to see what processes are running or kill a process without opening a terminal or adding a block of text to conky... I figured it would be convenient to add this to the Openbox menu, since it's always a click away anyway. This script spits out a pipe menu displaying the user's currently-running processes, and selecting one of them will call kill on that process.
There's a section at the top of the script where you can add any processes you would like to be ignored (i.e. terms you want to be skipped by the menu). To get it working, just drop the script anywhere in your $PATH and add it to your menu as follows:
<menu execute="obpipemenu-kill-processes" id="obpipemenu-kill-processes" label="Kill" />
It's written in Python and requires python2.5. Feedback is appreciated!
And here's a link to a working version of the script... This one offers both kill and killall options, and allows you to view the process' full command. I'll be adding to the script over time.
Looks nifty, once 9.04 official is released I will surely test out your script.
I view KDE like I view snow. It looks fun and marvelous, it's fun to play in, but after a while I just want someone to take it all away.
It really sounds great, i will give it a try very soon
It sounds really great but:
at first i was getting an error about /bin/bash/python3 that it wasn't exist, I apt-get it and it runs giving me the following errors:
Traceback (most recent call last):
File "/home/jimmy/bin/obpipemenu-kill-processes", line 106, in <module>
File "/home/jimmy/bin/obpipemenu-kill-processes", line 58, in main
File "/home/jimmy/bin/obpipemenu-kill-processes", line 64, in menu
[submenu(p) for p in processes]
File "/home/jimmy/bin/obpipemenu-kill-processes", line 64, in <listcomp>
[submenu(p) for p in processes]
File "/home/jimmy/bin/obpipemenu-kill-processes", line 70, in submenu
for term in exclude and term in process:
UnboundLocalError: local variable 'term' referenced before assignment
Yeah, sorry -- I moved this a while ago and that version is quite a bit out of date. The new script is here: http://github.com/evhan/obpipemenu-proc … -processes.
Last edited by evhan (2009-11-12 14:28:26)
Aha! Thanks... but I'm getting one new error:
File "/home/jimmy/bin/obpipemenu-kill-processes", line 47
usr = pwd.getpwuid(os.getuid()) # from http://docs.python.org/library/os.html#os.getlogin
IndentationError: expected an indented block
I opened the link on the comment but I couldn't figure it out... sorry
Ah yes, Python and its finicky indentation rules. If you edited the file, you'll have to make sure the indentation in the file is either ALL SPACES or ALL TABS. No mixing allowed -- so say the Python gods. Annoying, I know
thanks!!! it works and it's great!!!
It seems that when openbox starts for the first time the pipe menu works, but after that it doesn't opening. I tried everything I could think of. I restart both #! and openbox, without success, but when I reconfigure it I'm getting this Openbox syntax error:
One or more XML syntax errors were found while parsing the openbox configuration files. See stdout for more information. The last error seen was in the file "(null)" line 1312, with message xmlParseEntityRef: no name
I run it again in terminal saving the output to a file and the line 1312 contains this:
1307 <menu id="process-menu-7037" label="deluge">
1308 <separator label="/usr/bin/python /usr/bin/deluge" />
1309 <item id="action70371" label="copy command">
1310 <action name="Execute">
1312 sh -c 'echo "/usr/bin/python /usr/bin/deluge" | xclip -selection clipboard'
can you make out what is wrong? I'm about to leave it and continue my #! life without troubling my self and you of course...
thats the command thats run when you click 'copy command'
it seems that it just saves "/usr/bin/python /usr/bin/deluge" in xclip, i don't think thats your problem.
yes, I was expecting to see something like <not to be placed here> in that line and that's why I post the hole menu item even though it seems ok. do you have any idea what to look about?
I open the output file again with gedit and set the XML highlight mode and scroll it down (fast enough) waiting to see something. I was about to give up when I fall on this:
<menu id="process-menu-7036" label="sh">
<separator label="sh -c deluge &" />
<item id="action70361" label="copy command">
sh -c 'echo "sh -c deluge &" | xclip -selection clipboard'
and similar highlighted "&" on firefox, thunderbird and maybe on some more <items> that I'm forgetting...
I believe this is close enough because every time I restart #!, the pipemenu works until I open firefox, so I can try and kill it with the pipe-kill.