[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RP] Patch to stop shells from being left around
From: |
Mike Meyer |
Subject: |
Re: [RP] Patch to stop shells from being left around |
Date: |
Wed Oct 10 13:25:11 2001 |
Jonathan Walther <address@hidden> types:
> -----BEGIN PGP SIGNED MESSAGE-----
> If thats part of the problem, I can fix it.
It means you have to mangle the names before you use them, which
causes headaches in shell scripts. In python, it was a breeze. I'll
include the latest version of that script here, which uses the new %l
format.
> What do you guys think of having a syntax for ratmenu of
> "menuitem" "command" "menuitem" "command" to replace
> "menuitem":"command" "menuitem":"command"? This would make it work just
> like dialog.
Two problems. One is easy to fix - make "-" for the "command" mean use
menuitem for the command. Second, can you get the changes back to
9menu, or make ratmenu respond to mouse clicks? I still use both, and
share menu entries between them.
Hmm - maybe there's one fix for both cases. The ":" is really only an
issue if you're trying to generate menus dynamically. How about a
switch "-nocolon" or some such which triggers the above
behavior. Without it, you get the 9menu parsing. With it, you get the
syntax where the commands and menuitmes are separate arguments?
<mike
Oh yeah, the new python script. It's a lot longer than the shell
script now. But it's OO, which means it must be good :-).
--
Mike Meyer <address@hidden> http://www.mired.org/home/mwm/
Q: How do you make the gods laugh? A: Tell them your plans.
#!/usr/opt/bin/python
"""Use the ratpoison command to build a menu of windows to hand to ratmenu.
Any arguments will be passed to ratmenu before the list of window menu
entries."""
import sys, os
class Window:
"A description of a ratpoison window"
def __init__(my, line, newsep = '!'):
"Init with a ratpoison window format of %l:%n:%s:%t"
order, my.number, my.status, name = line[:-1].split(':', 3)
my.name = name.replace(':', newsep)
my.order = int(order)
def __cmp__(my, other):
return cmp(my.order, other.order)
def __repr__(my):
return '%s%s%s:ratpoison -c "select %s"' % \
(my.number, my.status, my.name, my.number)
if __name__ == "__main__":
winfile = os.popen('ratpoison -c "windows %l:%n:%s:%t"')
winlist = map(Window, winfile.readlines())
winfile.close()
winlist.sort()
os.execv("/usr/X11R6/bin/ratmenu", sys.argv + map(repr, winlist))
- Re: [RP] Patch to stop shells from being left around, (continued)
- Re: [RP] Patch to stop shells from being left around, shawn, 2001/10/05
- Re: [RP] Patch to stop shells from being left around, Ryan Yeske, 2001/10/05
- Re: [RP] Patch to stop shells from being left around, Mike Meyer, 2001/10/06
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/06
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/10
- Re: [RP] Patch to stop shells from being left around, Mike Meyer, 2001/10/10
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/10
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/10
- Re: [RP] Patch to stop shells from being left around,
Mike Meyer <=
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Doug Kearns, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Mike Meyer, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Mike Meyer, 2001/10/11
- Re: [RP] Patch to stop shells from being left around, Jonathan Walther, 2001/10/11