patch-config.h - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
 (HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       patch-config.h
       ---
            1 --- /dev/null   2016-01-17 23:22:00.000000000 +0100
            2 +++ config.h    2016-01-17 23:21:46.000000000 +0100
            3 @@ -0,0 +1,217 @@
            4 +/* valid curses attributes are listed below they can be ORed
            5 + *
            6 + * A_NORMAL        Normal display (no highlight)
            7 + * A_STANDOUT      Best highlighting mode of the terminal.
            8 + * A_UNDERLINE     Underlining
            9 + * A_REVERSE       Reverse video
           10 + * A_BLINK         Blinking
           11 + * A_DIM           Half bright
           12 + * A_BOLD          Extra bright or bold
           13 + * A_PROTECT       Protected mode
           14 + * A_INVIS         Invisible or blank mode
           15 + */
           16 +
           17 +enum {
           18 +       DEFAULT,
           19 +       WHITE,
           20 +};
           21 +
           22 +static Color colors[] = {
           23 +       [DEFAULT] = { .fg = -1,         .bg = -1, .fg256 = -1, .bg256 = -1, },
           24 +       [WHITE]    = { .fg = COLOR_WHITE, .bg = -1, .fg256 = 68, .bg256 = -1, },
           25 +};
           26 +
           27 +#define COLOR(c)        COLOR_PAIR(colors[c].pair)
           28 +/* curses attributes for the currently focused window */
           29 +#define SELECTED_ATTR   (COLOR(WHITE) | A_NORMAL)
           30 +/* curses attributes for normal (not selected) windows */
           31 +#define NORMAL_ATTR     (COLOR(DEFAULT) | A_NORMAL)
           32 +/* curses attributes for a window with pending urgent flag */
           33 +#define URGENT_ATTR     NORMAL_ATTR
           34 +/* curses attributes for the status bar */
           35 +#define BAR_ATTR        (COLOR(WHITE) | A_NORMAL)
           36 +/* characters for beginning and end of status bar message */
           37 +#define BAR_BEGIN       '['
           38 +#define BAR_END         ']'
           39 +/* status bar (command line option -s) position */
           40 +#define BAR_POS         BAR_TOP /* BAR_BOTTOM, BAR_OFF */
           41 +/* whether status bar should be hidden if only one client exists */
           42 +#define BAR_AUTOHIDE    false
           43 +/* master width factor [0.1 .. 0.9] */
           44 +#define MFACT 0.55
           45 +/* number of clients in master area */
           46 +#define NMASTER 1
           47 +/* scroll back buffer size in lines */
           48 +#define SCROLL_HISTORY 1000
           49 +/* printf format string for the tag in the status bar */
           50 +#define TAG_SYMBOL   "[%s]"
           51 +/* curses attributes for the currently selected tags */
           52 +#define TAG_SEL      (COLOR(DEFAULT) | A_BOLD)
           53 +/* curses attributes for not selected tags which contain no windows */
           54 +#define TAG_NORMAL   (COLOR(DEFAULT) | A_NORMAL)
           55 +/* curses attributes for not selected tags which contain windows */
           56 +#define TAG_OCCUPIED (COLOR(WHITE) | A_NORMAL)
           57 +/* curses attributes for not selected tags which with urgent windows */
           58 +#define TAG_URGENT (COLOR(DEFAULT) | A_NORMAL | A_REVERSE)
           59 +
           60 +const char tags[][8] = { "1", "2", "3", "4", "5" };
           61 +
           62 +#include "tile.c"
           63 +#include "grid.c"
           64 +#include "bstack.c"
           65 +#include "fullscreen.c"
           66 +
           67 +/* by default the first layout entry is used */
           68 +static Layout layouts[] = {
           69 +       { "[ ]", fullscreen },
           70 +       { "[]=", tile },
           71 +       { "+++", grid },
           72 +       { "TTT", bstack },
           73 +};
           74 +
           75 +#define MOD  CTRL('b')
           76 +#define TAGKEYS(KEY,TAG) \
           77 +       { { MOD, 'v', KEY,     }, { view,           { tags[TAG] }               } }, \
           78 +       { { MOD, 't', KEY,     }, { tag,            { tags[TAG] }               } }, \
           79 +       { { MOD, 'V', KEY,     }, { toggleview,     { tags[TAG] }               } }, \
           80 +       { { MOD, 'T', KEY,     }, { toggletag,      { tags[TAG] }               } },
           81 +
           82 +/* you can at most specifiy MAX_ARGS (3) number of arguments */
           83 +static KeyBinding bindings[] = {
           84 +       { { MOD, 'c',          }, { create,         { NULL }                    } },
           85 +       { { MOD, 'C',          }, { create,         { NULL, NULL, "$CWD" }      } },
           86 +       { { MOD, 'x', 'x',     }, { killclient,     { NULL }                    } },
           87 +       { { MOD, 'j',          }, { focusnext,      { NULL }                    } },
           88 +       { { MOD, 'J',          }, { focusnextnm,    { NULL }                    } },
           89 +       { { MOD, 'K',          }, { focusprevnm,    { NULL }                    } },
           90 +       { { MOD, 'k',          }, { focusprev,      { NULL }                    } },
           91 +       { { MOD, 'f',          }, { setlayout,      { "[]=" }                   } },
           92 +       { { MOD, 'g',          }, { setlayout,      { "+++" }                   } },
           93 +       { { MOD, 'b',          }, { setlayout,      { "TTT" }                   } },
           94 +       { { MOD, 'm',          }, { setlayout,      { "[ ]" }                   } },
           95 +       { { MOD, ' ',          }, { setlayout,      { NULL }                    } },
           96 +       { { MOD, 'i',          }, { incnmaster,     { "+1" }                    } },
           97 +       { { MOD, 'd',          }, { incnmaster,     { "-1" }                    } },
           98 +       { { MOD, 'h',          }, { setmfact,       { "-0.05" }                 } },
           99 +       { { MOD, 'l',          }, { setmfact,       { "+0.05" }                 } },
          100 +       { { MOD, '.',          }, { toggleminimize, { NULL }                    } },
          101 +       { { MOD, 's',          }, { togglebar,      { NULL }                    } },
          102 +       { { MOD, 'S',          }, { togglebarpos,   { NULL }                    } },
          103 +       { { MOD, 'M',          }, { togglemouse,    { NULL }                    } },
          104 +       { { MOD, '\n',         }, { zoom ,          { NULL }                    } },
          105 +       { { MOD, '\r',         }, { zoom ,          { NULL }                    } },
          106 +       { { MOD, '1',          }, { focusn,         { "1" }                     } },
          107 +       { { MOD, '2',          }, { focusn,         { "2" }                     } },
          108 +       { { MOD, '3',          }, { focusn,         { "3" }                     } },
          109 +       { { MOD, '4',          }, { focusn,         { "4" }                     } },
          110 +       { { MOD, '5',          }, { focusn,         { "5" }                     } },
          111 +       { { MOD, '6',          }, { focusn,         { "6" }                     } },
          112 +       { { MOD, '7',          }, { focusn,         { "7" }                     } },
          113 +       { { MOD, '8',          }, { focusn,         { "8" }                     } },
          114 +       { { MOD, '9',          }, { focusn,         { "9" }                     } },
          115 +       { { MOD, '\t',         }, { focuslast,      { NULL }                    } },
          116 +       { { MOD, 'q', 'q',     }, { quit,           { NULL }                    } },
          117 +       { { MOD, 'a',          }, { togglerunall,   { NULL }                    } },
          118 +       { { MOD, CTRL('L'),    }, { redraw,         { NULL }                    } },
          119 +       { { MOD, 'r',          }, { redraw,         { NULL }                    } },
          120 +       { { MOD, 'e',          }, { copymode,       { NULL }                    } },
          121 +       { { MOD, '/',          }, { copymode,       { "/" }                     } },
          122 +       { { MOD, 'p',          }, { paste,          { NULL }                    } },
          123 +       { { MOD, KEY_PPAGE,    }, { scrollback,     { "-1" }                    } },
          124 +       { { MOD, KEY_NPAGE,    }, { scrollback,     { "1"  }                    } },
          125 +       { { MOD, '?',          }, { create,         { "man dvtm", "dvtm help" } } },
          126 +       { { MOD, MOD,          }, { send,           { (const char []){MOD, 0} } } },
          127 +       { { KEY_SPREVIOUS,     }, { scrollback,     { "-1" }                    } },
          128 +       { { KEY_SNEXT,         }, { scrollback,     { "1"  }                    } },
          129 +       { { MOD, '0',          }, { view,           { NULL }                    } },
          130 +       { { MOD, KEY_F(1),     }, { view,           { tags[0] }                 } },
          131 +       { { MOD, KEY_F(2),     }, { view,           { tags[1] }                 } },
          132 +       { { MOD, KEY_F(3),     }, { view,           { tags[2] }                 } },
          133 +       { { MOD, KEY_F(4),     }, { view,           { tags[3] }                 } },
          134 +       { { MOD, KEY_F(5),     }, { view,           { tags[4] }                 } },
          135 +       { { MOD, 'v', '0'      }, { view,           { NULL }                    } },
          136 +       { { MOD, 'v', '\t',    }, { viewprevtag,    { NULL }                    } },
          137 +       { { MOD, 't', '0'      }, { tag,            { NULL }                    } },
          138 +       TAGKEYS( '1',                              0)
          139 +       TAGKEYS( '2',                              1)
          140 +       TAGKEYS( '3',                              2)
          141 +       TAGKEYS( '4',                              3)
          142 +       TAGKEYS( '5',                              4)
          143 +};
          144 +
          145 +static const ColorRule colorrules[] = {
          146 +       { "", A_NORMAL, &colors[DEFAULT] }, /* default */
          147 +};
          148 +
          149 +/* possible values for the mouse buttons are listed below:
          150 + *
          151 + * BUTTON1_PRESSED          mouse button 1 down
          152 + * BUTTON1_RELEASED         mouse button 1 up
          153 + * BUTTON1_CLICKED          mouse button 1 clicked
          154 + * BUTTON1_DOUBLE_CLICKED   mouse button 1 double clicked
          155 + * BUTTON1_TRIPLE_CLICKED   mouse button 1 triple clicked
          156 + * BUTTON2_PRESSED          mouse button 2 down
          157 + * BUTTON2_RELEASED         mouse button 2 up
          158 + * BUTTON2_CLICKED          mouse button 2 clicked
          159 + * BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
          160 + * BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
          161 + * BUTTON3_PRESSED          mouse button 3 down
          162 + * BUTTON3_RELEASED         mouse button 3 up
          163 + * BUTTON3_CLICKED          mouse button 3 clicked
          164 + * BUTTON3_DOUBLE_CLICKED   mouse button 3 double clicked
          165 + * BUTTON3_TRIPLE_CLICKED   mouse button 3 triple clicked
          166 + * BUTTON4_PRESSED          mouse button 4 down
          167 + * BUTTON4_RELEASED         mouse button 4 up
          168 + * BUTTON4_CLICKED          mouse button 4 clicked
          169 + * BUTTON4_DOUBLE_CLICKED   mouse button 4 double clicked
          170 + * BUTTON4_TRIPLE_CLICKED   mouse button 4 triple clicked
          171 + * BUTTON_SHIFT             shift was down during button state change
          172 + * BUTTON_CTRL              control was down during button state change
          173 + * BUTTON_ALT               alt was down during button state change
          174 + * ALL_MOUSE_EVENTS         report all button state changes
          175 + * REPORT_MOUSE_POSITION    report mouse movement
          176 + */
          177 +
          178 +#ifdef NCURSES_MOUSE_VERSION
          179 +# define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
          180 +#endif
          181 +
          182 +#define ENABLE_MOUSE true /* whether to enable mouse events by default */
          183 +
          184 +#ifdef CONFIG_MOUSE
          185 +static Button buttons[] = {
          186 +       { BUTTON1_CLICKED,        { mouse_focus,      { NULL  } } },
          187 +       { BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
          188 +       { BUTTON2_CLICKED,        { mouse_zoom,       { NULL  } } },
          189 +       { BUTTON3_CLICKED,        { mouse_minimize,   { NULL  } } },
          190 +};
          191 +#endif /* CONFIG_MOUSE */
          192 +
          193 +static Cmd commands[] = {
          194 +       { "create", { create,   { NULL } } },
          195 +};
          196 +
          197 +/* gets executed when dvtm is started */
          198 +static Action actions[] = {
          199 +       { create, { NULL } },
          200 +};
          201 +
          202 +static char const * const keytable[] = {
          203 +       /* add your custom key escape sequences */
          204 +};
          205 +
          206 +/* editor to use for copy mode. If neither of DVTM_EDITOR, EDITOR and PAGER is
          207 + * set the first entry is chosen. Otherwise the array is consulted for supported
          208 + * options. A %d in argv is replaced by the line number at which the file should
          209 + * be opened. If filter is true the editor is expected to work even if stdout is
          210 + * redirected (i.e. not a terminal). If color is true then color escape sequences
          211 + * are generated in the output.
          212 + */
          213 +static Editor editors[] = {
          214 +       { .name = "vis",         .argv = { "vis", "+%d", "-", NULL   }, .filter = true,  .color = false },
          215 +       { .name = "sandy",       .argv = { "sandy", "-d", "-", NULL  }, .filter = true,  .color = false },
          216 +       { .name = "dvtm-editor", .argv = { "dvtm-editor", "-", NULL  }, .filter = true,  .color = false },
          217 +       { .name = "vim",         .argv = { "vim", "+%d", "-", NULL   }, .filter = false, .color = false },
          218 +       { .name = "less",        .argv = { "less", "-R", "+%d", NULL }, .filter = false, .color = true  },
          219 +       { .name = "more",        .argv = { "more", "+%d", NULL       }, .filter = false, .color = false },
          220 +};