[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[screen-devel] Scripting Support for Screen
From: |
Sadrul Habib Chowdhury |
Subject: |
[screen-devel] Scripting Support for Screen |
Date: |
Thu, 24 Jul 2008 12:00:04 -0400 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
Hi. I started working on a lua script loader for screen last night. I am
quite happy with the progress so far. I would like to know what people
think about this kind of work. I discussed about this briefly with Micah
last night, and he also thought discussing this in the list would be
useful.
I will try to answer a few questions that might come up in advance:
* Where is the patchset?
- The current patchset is available at
http://www.pidgin.im/~sadrul/pp/scripting-lua/. The patches are against
the development version of screen
(http://git.savannah.gnu.org/gitweb/?p=screen.git)
* What's the goal?
- The goal right now is to allow executing some user-defined function
on specific events, e.g. when a window is closed, opened,
title/position changed, a display is detached etc. etc. easily, i.e.
without requiring a recompilation/reinstallation.
I started working on this mostly out of curiosity, to see where it
goes, and what cool things it might allow users to do. One use I have
in mind is to send some signal to the process in a window when it's not
visible in any of the displays, (and send another one when it becomes
visible for the first time). It doesn't make all that much sense to
implement such highly personalized features in screen itself.
I am sure people will find a lot of other interesting things to do.
* Why Lua?
- Because I like it!
To be perfectly honest, there was no compelling technical reason for me
to choose lua. I hadn't worked with lua bindings before, but I was told
it's much easier to work with than with some other scripting languages
(e.g. python!). I thought I would give it a try and find out.
* Why not guile?
- Because I haven't seen it before, and I wasn't aware of it until Micah
told me about it last night on IRC!
Note: with the patchset, it is possible to support multiple scripting
languages, either built-in at compile time (current), or dynamically
loaded on demand (not yet implemented, but possible semi-trivially.
[1] for details). So in theory, it will be possible to have none,
either or both lua and guile support. (and any other language someone
cares to write bindings for)
* What about the bloat?
- I would refer to the commit message at [1]
* Is there a sample script?
- Yes! http://www.pidgin.im/~sadrul/pp/scripting-lua/sc.lua
The 'fore_changed' function towards the end is the one that gets
executed when the foreground window for a display is changed. It prints
the list of windows (# and title), a message explaining the switch from
the previous window to the current one, and finally prints detailed
information about each display and its foreground window. The display
information includes the term, tty, user and the canvases.
* What are the current triggers/hooks?
- Right now, only changing the foreground window in a display will
trigger a function named 'fore_changed' in the lua script. I don't have
a complete list of hooks in mind yet. I plan on adding new hooks as the
need arises. Suggestions are very welcome!
I would love to know if people have any opinions, suggestions etc. about
this.
[1]
http://www.pidgin.im/~sadrul/pp/scripting-lua/0003-Add-a-layer-of-abstraction-for-the-script-bindings.patch
Cheers,
Sadrul
- [screen-devel] Scripting Support for Screen,
Sadrul Habib Chowdhury <=
- Re: [screen-devel] Scripting Support for Screen, Johannes Weiner, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Micah Cowan, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Tom Scogland, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Micah Cowan, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Micah Cowan, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Johannes Weiner, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Micah Cowan, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Johannes Weiner, 2008/07/24
- Re: [screen-devel] Scripting Support for Screen, Mark Eichin, 2008/07/25
- Re: [screen-devel] Scripting Support for Screen, Johannes Weiner, 2008/07/25