scripting xmonad externally?

I've primarily been a ratpoison user for years, with a dalliance with wmii for a few months. I tried Xmonad over the weekend. Very nice work. The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.) Executing "ratpoison -c <ratpoison-command>" issues the command to the running ratpoison instance. wmii has a Plan 9 interface, driven by reading to and writing from particular places in a virtual filesystem. Third-party wrappers of these facilitate scripting in various languages. Are there any plans to offer such an interface in Xmonad in the future (or am I being a dolt and it's already possible and I've just missed it)? Here are some of the things that have resulted from the interfaces for the others: http://eigenclass.org/hiki.rb?wmii+ruby http://ratpoison.antidesktop.net/cgi-bin/wiki/Scripts

gmane.xmonad.zed2323:
I've primarily been a ratpoison user for years, with a dalliance with wmii for a few months. I tried Xmonad over the weekend. Very nice work.
The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.) Executing "ratpoison -c <ratpoison-command>" issues the command to the running ratpoison instance. wmii has a Plan 9 interface, driven by reading to and writing from particular places in a virtual filesystem. Third-party wrappers of these facilitate scripting in various languages.
Are there any plans to offer such an interface in Xmonad in the future (or am I being a dolt and it's already possible and I've just missed it)?
Here are some of the things that have resulted from the interfaces for the others:
http://eigenclass.org/hiki.rb?wmii+ruby http://ratpoison.antidesktop.net/cgi-bin/wiki/Scripts
There's the Command.hs interface in the contrib module, used for some of this. At the moment I don't think there's any plan to embed a scripting language directly in xmonad: far better to extend Commands.hs to say, use ghc-api, to allow arbitrary haskell extension if you want it. -- Don

I wrote (in summary):
The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.)
Are there any plans to offer such an interface in Xmonad in the future?
Donald Bruce Stewart
There's the Command.hs interface in the contrib module, used for some of this. At the moment I don't think there's any plan to embed a scripting language directly in xmonad: far better to extend Commands.hs to say, use ghc-api, to allow arbitrary haskell extension if you want it.
I wasn't referring to an embedded scripting language, but a generic API that would allow external scripts to communicate with Xmonad, both to read its state and to issue commands, like ratpoison's and wmii's APIs do. This would open up scripting in any language. Ease of scripting is what I find to be one of the attractions of those languages, and it'd be great to be able to script Xmonad in a language I already know (thought it's also nice to have the excuse to learn Haskell...)

gmane.xmonad.zed2323:
I wrote (in summary):
The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.)
Are there any plans to offer such an interface in Xmonad in the future?
Donald Bruce Stewart
writes: There's the Command.hs interface in the contrib module, used for some of this. At the moment I don't think there's any plan to embed a scripting language directly in xmonad: far better to extend Commands.hs to say, use ghc-api, to allow arbitrary haskell extension if you want it.
I wasn't referring to an embedded scripting language, but a generic API that would allow external scripts to communicate with Xmonad, both to read its state and to issue commands, like ratpoison's and wmii's APIs do. This would open up scripting in any language. Ease of scripting is what I find to be one of the attractions of those languages, and it'd be great to be able to script Xmonad in a language I already know (thought it's also nice to have the excuse to learn Haskell...)
Have a look at Commands.hs, which is currently used to control xmonad from the shell, but you surely can interact with it any way you want. -- Don

On Tue, Jul 24, 2007 at 03:44:26PM +1000, Donald Bruce Stewart wrote:
gmane.xmonad.zed2323:
I wrote (in summary):
The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.)
Are there any plans to offer such an interface in Xmonad in the future?
Donald Bruce Stewart
writes: There's the Command.hs interface in the contrib module, used for some of this. At the moment I don't think there's any plan to embed a scripting language directly in xmonad: far better to extend Commands.hs to say, use ghc-api, to allow arbitrary haskell extension if you want it.
I wasn't referring to an embedded scripting language, but a generic API that would allow external scripts to communicate with Xmonad, both to read its state and to issue commands, like ratpoison's and wmii's APIs do. This would open up scripting in any language. Ease of scripting is what I find to be one of the attractions of those languages, and it'd be great to be able to script Xmonad in a language I already know (thought it's also nice to have the excuse to learn Haskell...)
Have a look at Commands.hs, which is currently used to control xmonad from the shell, but you surely can interact with it any way you want.
Actually, commands uses dmenu synchronously and parses the string in-process. While it would be nice to control xmonad using a socket model, ISTR sjanssen saying { -package X11 is nearly impossible to use with threads, and this is one of the main motivations for XHSB. }. You can kluge around it by adding a handler for root PropertyNotify events on XMONAD_COMMAND and dispatching accordingly, then use xprop to control it; thus embedding the control channel over X11. (Not a small task, but most of the details could be in a re-usable contrib module...) Stefan

On Mon, Jul 23, 2007 at 10:49:11PM -0700, Stefan O'Rear wrote:
Actually, commands uses dmenu synchronously and parses the string in-process. While it would be nice to control xmonad using a socket model, ISTR sjanssen saying { -package X11 is nearly impossible to use with threads, and this is one of the main motivations for XHSB. }. You can kluge around it by adding a handler for root PropertyNotify events on XMONAD_COMMAND and dispatching accordingly, then use xprop to control it; thus embedding the control channel over X11. (Not a small task, but most of the details could be in a re-usable contrib module...)
I think the idea is cool, if I get it right. But I believe that it would require a small modification to Main.handle. by the way, attached you'll find just a proof of concept. SeverMode.hs must be used as a contrib module: - save it in XMonadContrib - import it from Config.hs and add something like: , ((modMask .|. controlMask, xK_s), startServer) in the keymap settings. be careful! when you start the server mode XMonad will be blocked and the only way you can unblock it is by sending a "restart-wm" command! then there's is the sendCommand utility: - compile it with ghc --make sendCommand.hs -o sendCommand To send a command, after you started the server mode, run: sendCommand "command" Remember to open an terminal with the focus before starting the server mode. As I said, this is just a joke to have some fun with. I don't know if this is what you had in mind. Let me know please. Ciao Andrea

On Mon, Jul 23, 2007 at 06:44:15PM +0000, Zed Lopez wrote:
The thing I'm most missing from ratpoison and wmii is an external api, which makes them extensible from external programs (and any language.) Executing "ratpoison -c <ratpoison-command>" issues the command to the running ratpoison instance.
A follow up, with respect to my previous message. This is what these patches are going to do. but they require a modifications to Main.hs and Config.hs and I don't think they will be allowed in the main tree. Still here they are...;-) By the way, by applying the first patch to XMonads and the second one to XMonadContrib you'll get the possibility to send to XMonad, from the command line, the same commands available in the Commands module. The utility to send those commands is included: sendCommad.hs (ghc --make sendCommand.hs -o sendCommand). You need to follow the instruction of ServerMode.hs. And the: sendCommand view3 or sencCommand shift8 etc. As you see this is the very equivalent of XMonadContrib.Commands. As I said before, just for fun in this hot Italian afternoon. Andrea
participants (4)
-
Andrea Rossato
-
dons@cse.unsw.edu.au
-
Stefan O'Rear
-
Zed Lopez