st

fork of suckless's simple terminal
Index Commits Files Refs README LICENSE
commit 96c230e476a4fb446a8fa8d651c88fda32cd5427
parent 6166a1afc8c7875ce9ba62e5001040014269a26d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 31 Jan 2014 23:05:42 +0100

Add key definition for printer sequences

These new combinations generate the same behaviour (basically) of
vt102. It is a good way of communicating st with other programs.

[0] http://www.vt100.net/docs/vt102-ug/chapter2.html

Diffstat:
Mconfig.def.h | 2++
Mst.c | 12++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -107,6 +107,8 @@ static Mousekey mshortcuts[] = {
 
 static Shortcut shortcuts[] = {
     /* mask                 keysym          function        argument */
+    { ControlMask,          XK_Print,       toggleprinter,  {.i =  0} },
+    { ShiftMask,            XK_Print,       printscreen,    {.i =  0} },
     { MODKEY|ShiftMask,     XK_Prior,       xzoom,          {.i = +1} },
     { MODKEY|ShiftMask,     XK_Next,        xzoom,          {.i = -1} },
     { ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },
diff --git a/st.c b/st.c
@@ -314,6 +314,8 @@ static void clippaste(const Arg *);
 static void numlock(const Arg *);
 static void selpaste(const Arg *);
 static void xzoom(const Arg *);
+static void printscreen(const Arg *) ;
+static void toggleprinter(const Arg *);
 
 /* Config.h for applying patches and the configuration. */
 #include "config.h"
@@ -2283,6 +2285,16 @@ tprinter(char *s, size_t len) {
 }
 
 void
+toggleprinter(const Arg *arg) {
+    term.mode ^= MODE_PRINT;
+}
+
+void
+printscreen(const Arg *arg) {
+    tdump();
+}
+
+void
 tdumpline(int n) {
     Glyph *bp, *end;