SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-05-25 22:46:28

evhan
#! Member
Registered: 2009-04-28
Posts: 58
Website

Openbox process menu

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)

Offline

Be excellent to each other!

#2 2009-05-25 23:18:11

kBang
#! Die Hard
From: Calera, AL, USA
Registered: 2009-01-06
Posts: 774

Re: Openbox process menu

evhan wrote:

I've written a little pipemenu script for the OB menu that offers the user a quick way to view/kill processes:

obpipemenu-kill-processes.jpg

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!

Download: obpipemenu-kill-processes

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.

Offline

#3 2009-05-26 05:40:45

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 9,417

Re: Openbox process menu

This seems like it could come in handy. I will try it out.

Offline

#4 2009-05-26 12:44:32

ADcomp
Python Script Master
From: Belgium
Registered: 2008-12-22
Posts: 600
Website

Re: Openbox process menu

Hello ..
Good job ! It looks pretty cool .. I'll try tonight


David [aka] ADcomp

Offline

#5 2009-05-26 13:19:29

leolana
New Member
Registered: 2009-05-18
Posts: 6

Re: Openbox process menu

It really sounds great,  i will give it a try very soon

Offline

#6 2009-11-12 14:05:22

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

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:

jimmy@archae2:~/bin$ obpipemenu-kill-processes
<openbox_pipe_menu>
Traceback (most recent call last):
  File "/home/jimmy/bin/obpipemenu-kill-processes", line 106, in <module>
    main()
  File "/home/jimmy/bin/obpipemenu-kill-processes", line 58, in main
    menu(out)
  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

any help???

Offline

#7 2009-11-12 14:21:19

evhan
#! Member
Registered: 2009-04-28
Posts: 58
Website

Re: Openbox process menu

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)

Offline

#8 2009-11-12 15:19:28

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

Aha! Thanks... but I'm getting one new error:

jimmy@archae2:~/bin$ obpipemenu-kill-processes
  File "/home/jimmy/bin/obpipemenu-kill-processes", line 47
    usr = pwd.getpwuid(os.getuid())[0] # 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 hmm

Offline

#9 2009-11-12 15:33:21

evhan
#! Member
Registered: 2009-04-28
Posts: 58
Website

Re: Openbox process menu

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 mad

Offline

#10 2009-11-12 15:52:36

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

big_smile thanks!!! it works and it's great!!!

best regards!

Offline

#11 2009-11-12 17:30:27

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

sad

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">
1311 <execute>
1312 sh -c 'echo "/usr/bin/python /usr/bin/deluge" | xclip -selection clipboard'
1313 </execute>
1314 </action>
1315 </item>

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... mad

Offline

#12 2009-11-12 18:10:52

benj1
Wiki Wizard
From: Yorkshire, England
Registered: 2009-09-05
Posts: 1,084

Re: Openbox process menu

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.


- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Offline

#13 2009-11-12 18:16:20

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

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? sad

Offline

#14 2009-11-12 18:46:01

slapfish
#! Die Hard
From: Athens, Greece
Registered: 2009-10-22
Posts: 601

Re: Openbox process menu

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">
<action name="Execute">
<execute>
sh -c 'echo "sh -c deluge  &" | xclip -selection clipboard'
</execute>
</action>
</item>

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.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo