Steve Kemp's Blog Writings relating to Debian & Free Software

When I was your age, television was called books

Tue, 8 Jul 2008 12:32:38 GMT

There are few programs I use with so much combined love & loathing than GNU screen.

Yesterday I spent a while adding another feature I've been wanting for so long, the unbindall primitive.

In many cases I find myself using screen as a wrapper around other things. But usually I end up having to disable dangerous keybindings, to gain security or to protect users from themselves.

Typically this leads to a screenrc file looking like this:

#
#  Disable these bindings.
#
bind :
bind s
bind S
bind Z
bind ^\
bind c
bind ^c
bind z
bind Z
bind B
...

Instead it would be better if I could just say:

#
#  Unbind *all* keystrokes
#
unbindall

#
#  Restore actions we need/want/love.
#
bind x quit
bind d detach
bind c screen
..

Anyway, thanks to a small patch I can now.

ObQuote: The Princess Bride

| 4 comments.

 

Comments On This Entry

[gravitar] Daniel Kahn Gillmor

Submitted at 19:12:03 on 8 July 2008

This is a Good Thing, Steve. Will you be submitting this patch upstream (or to debian at least)?
Aside from being generally useful, I'd like to be able to count on this feature for cereal
[gravitar] Steve

Submitted at 19:30:36 on 8 July 2008

I'll include the patch here for posterity - I hadn't planned on submitting to Debian because they mostly only take patches that upstream do.

Upstream development on screen is glacial, so there's probably not a lot of point ...


--- screen-4.0.3.orig/comm.h.dist
+++ screen-4.0.3/comm.h.dist
@@ -225,4 +225,4 @@
 #define RC_ZOMBIE 174
-
-#define RC_LAST 174
+#define RC_UNBIND 175
+#define RC_LAST 175

--- screen-4.0.3.orig/process.c
+++ screen-4.0.3/process.c
@@ -1297,2 +1297,15 @@
 #endif
+    case RC_UNBINDALL:
+      {
+        register unsigned int i;
+
+        for (i = 0; i < sizeof(ktab)/sizeof(*ktab); i++)
+          {
+            ktab[i].nr = RC_ILLEGAL;
+            ktab[i].args = noargs;
+            ktab[i].argl = 0;
+          }
+       Msg(0, "unbound all keys" );
+        break;
+      }
     case RC_ZOMBIE:
only in patch2:

--- screen-4.0.3.orig/comm.c
+++ screen-4.0.3/comm.c
@@ -302,2 +302,3 @@
   { "umask",           ARGS_1|ARGS_ORMORE },
+  { "unbindall",       ARGS_0 },
   { "unsetenv",                ARGS_1 },

[gravitar] Jamie Rollins

Submitted at 23:24:51 on 8 July 2008

Steve, this is a great idea. I really think we should push for this to be added in Debian at least, if not upstream. Your use of screen as a wrapper really inspired us and we now use it in much the same way, and having to unbind everything is a real pain. We unbound a lot, but did we get everything?
We should file this as a wishlist to Debian.
[gravitar] Steve Kemp

Submitted at 23:29:58 on 8 July 2008

Jamie, please do feel free to point people at the patch / file a bug.


 

Comments are closed on posts which are more than ten days old.

Spiral Logo

Search

Recent Posts

Recent Tags

Links

RSS Feed

  • Subscribe to feed