dvtm

Fork of dvtm, a minimal terminal multiplexer
git clone git://git.laack.co/dvtm.git
Log | Files | Refs | README | LICENSE

config.def.h (10206B)


      1 /* valid curses attributes are listed below they can be ORed
      2  *
      3  * A_NORMAL        Normal display (no highlight)
      4  * A_STANDOUT      Best highlighting mode of the terminal.
      5  * A_UNDERLINE     Underlining
      6  * A_REVERSE       Reverse video
      7  * A_BLINK         Blinking
      8  * A_DIM           Half bright
      9  * A_BOLD          Extra bright or bold
     10  * A_PROTECT       Protected mode
     11  * A_INVIS         Invisible or blank mode
     12  */
     13 
     14 enum {
     15 	DEFAULT,
     16 	BLUE,
     17 };
     18 
     19 static Color colors[] = {
     20 	[DEFAULT] = { .fg = -1,         .bg = -1, .fg256 = -1, .bg256 = -1, },
     21 	[BLUE]    = { .fg = COLOR_BLUE, .bg = -1, .fg256 = 68, .bg256 = -1, },
     22 };
     23 
     24 #define COLOR(c)        COLOR_PAIR(colors[c].pair)
     25 /* curses attributes for the currently focused window */
     26 #define SELECTED_ATTR   (COLOR(BLUE) | A_NORMAL)
     27 /* curses attributes for normal (not selected) windows */
     28 #define NORMAL_ATTR     (COLOR(DEFAULT) | A_NORMAL)
     29 /* curses attributes for a window with pending urgent flag */
     30 #define URGENT_ATTR     NORMAL_ATTR
     31 /* curses attributes for the status bar */
     32 #define BAR_ATTR        (COLOR(BLUE) | A_NORMAL)
     33 /* characters for beginning and end of status bar message */
     34 #define BAR_BEGIN       '['
     35 #define BAR_END         ']'
     36 /* status bar (command line option -s) position */
     37 #define BAR_POS         BAR_TOP /* BAR_BOTTOM, BAR_OFF */
     38 /* whether status bar should be hidden if only one client exists */
     39 #define BAR_AUTOHIDE    true
     40 /* master width factor [0.1 .. 0.9] */
     41 #define MFACT 0.5
     42 /* number of clients in master area */
     43 #define NMASTER 1
     44 /* scroll back buffer size in lines */
     45 #define SCROLL_HISTORY 500
     46 /* printf format string for the tag in the status bar */
     47 #define TAG_SYMBOL   "[%s]"
     48 /* curses attributes for the currently selected tags */
     49 #define TAG_SEL      (COLOR(BLUE) | A_BOLD)
     50 /* curses attributes for not selected tags which contain no windows */
     51 #define TAG_NORMAL   (COLOR(DEFAULT) | A_NORMAL)
     52 /* curses attributes for not selected tags which contain windows */
     53 #define TAG_OCCUPIED (COLOR(BLUE) | A_NORMAL)
     54 /* curses attributes for not selected tags which with urgent windows */
     55 #define TAG_URGENT (COLOR(BLUE) | A_NORMAL | A_BLINK)
     56 
     57 const char tags[][8] = { "1", "2", "3", "4", "5" };
     58 
     59 #include "tile.c"
     60 #include "grid.c"
     61 #include "horizontal.c"
     62 #include "bstack.c"
     63 #include "fullscreen.c"
     64 
     65 /* by default the first layout entry is used */
     66 static Layout layouts[] = {
     67 	{ "[]=", tile },
     68 	{ "+++", grid },
     69 	{ "TTT", bstack },
     70 	{ "[ ]", fullscreen },
     71 };
     72 
     73 #define MOD  CTRL('g')
     74 #define TAGKEYS(KEY,TAG) \
     75 	{ { MOD, 'v', KEY,     }, { view,           { tags[TAG] }               } }, \
     76 	{ { MOD, 't', KEY,     }, { tag,            { tags[TAG] }               } }, \
     77 	{ { MOD, 'V', KEY,     }, { toggleview,     { tags[TAG] }               } }, \
     78 	{ { MOD, 'T', KEY,     }, { toggletag,      { tags[TAG] }               } },
     79 
     80 /* you can specifiy at most 3 arguments */
     81 static KeyBinding bindings[] = {
     82 	{ { MOD, 'c',          }, { create,         { NULL }                    } },
     83 	{ { MOD, 'C',          }, { create,         { NULL, NULL, "$CWD" }      } },
     84 	{ { MOD, 'x', 'x',     }, { killclient,     { NULL }                    } },
     85 	{ { MOD, 'j',          }, { focusnext,      { NULL }                    } },
     86 	{ { MOD, 'J',          }, { focusdown,      { NULL }                    } },
     87 	{ { MOD, 'K',          }, { focusup,        { NULL }                    } },
     88 	{ { MOD, 'H',          }, { focusleft,      { NULL }                    } },
     89 	{ { MOD, 'L',          }, { focusright,     { 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,       { "dvtm-editor" }           } },
    121 	{ { MOD, 'E',          }, { copymode,       { "dvtm-pager" }            } },
    122 	{ { MOD, '/',          }, { copymode,       { "dvtm-pager", "/" }       } },
    123 	{ { MOD, 'p',          }, { paste,          { NULL }                    } },
    124 	{ { MOD, KEY_PPAGE,    }, { scrollback,     { "-1" }                    } },
    125 	{ { MOD, KEY_NPAGE,    }, { scrollback,     { "1"  }                    } },
    126 	{ { MOD, '?',          }, { create,         { "man dvtm", "dvtm help" } } },
    127 	{ { MOD, MOD,          }, { send,           { (const char []){MOD, 0} } } },
    128 	{ { KEY_SPREVIOUS,     }, { scrollback,     { "-1" }                    } },
    129 	{ { KEY_SNEXT,         }, { scrollback,     { "1"  }                    } },
    130 	{ { MOD, '0',          }, { view,           { NULL }                    } },
    131 	{ { MOD, KEY_F(1),     }, { view,           { tags[0] }                 } },
    132 	{ { MOD, KEY_F(2),     }, { view,           { tags[1] }                 } },
    133 	{ { MOD, KEY_F(3),     }, { view,           { tags[2] }                 } },
    134 	{ { MOD, KEY_F(4),     }, { view,           { tags[3] }                 } },
    135 	{ { MOD, KEY_F(5),     }, { view,           { tags[4] }                 } },
    136 	{ { MOD, 'v', '0'      }, { view,           { NULL }                    } },
    137 	{ { MOD, 'v', '\t',    }, { viewprevtag,    { NULL }                    } },
    138 	{ { MOD, 't', '0'      }, { tag,            { NULL }                    } },
    139 	TAGKEYS( '1',                              0)
    140 	TAGKEYS( '2',                              1)
    141 	TAGKEYS( '3',                              2)
    142 	TAGKEYS( '4',                              3)
    143 	TAGKEYS( '5',                              4)
    144 };
    145 
    146 static const ColorRule colorrules[] = {
    147 	{ "", A_NORMAL, &colors[DEFAULT] }, /* default */
    148 };
    149 
    150 /* possible values for the mouse buttons are listed below:
    151  *
    152  * BUTTON1_PRESSED          mouse button 1 down
    153  * BUTTON1_RELEASED         mouse button 1 up
    154  * BUTTON1_CLICKED          mouse button 1 clicked
    155  * BUTTON1_DOUBLE_CLICKED   mouse button 1 double clicked
    156  * BUTTON1_TRIPLE_CLICKED   mouse button 1 triple clicked
    157  * BUTTON2_PRESSED          mouse button 2 down
    158  * BUTTON2_RELEASED         mouse button 2 up
    159  * BUTTON2_CLICKED          mouse button 2 clicked
    160  * BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
    161  * BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
    162  * BUTTON3_PRESSED          mouse button 3 down
    163  * BUTTON3_RELEASED         mouse button 3 up
    164  * BUTTON3_CLICKED          mouse button 3 clicked
    165  * BUTTON3_DOUBLE_CLICKED   mouse button 3 double clicked
    166  * BUTTON3_TRIPLE_CLICKED   mouse button 3 triple clicked
    167  * BUTTON4_PRESSED          mouse button 4 down
    168  * BUTTON4_RELEASED         mouse button 4 up
    169  * BUTTON4_CLICKED          mouse button 4 clicked
    170  * BUTTON4_DOUBLE_CLICKED   mouse button 4 double clicked
    171  * BUTTON4_TRIPLE_CLICKED   mouse button 4 triple clicked
    172  * BUTTON_SHIFT             shift was down during button state change
    173  * BUTTON_CTRL              control was down during button state change
    174  * BUTTON_ALT               alt was down during button state change
    175  * ALL_MOUSE_EVENTS         report all button state changes
    176  * REPORT_MOUSE_POSITION    report mouse movement
    177  */
    178 
    179 #ifdef NCURSES_MOUSE_VERSION
    180 # define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
    181 #endif
    182 
    183 #define ENABLE_MOUSE true /* whether to enable mouse events by default */
    184 
    185 #ifdef CONFIG_MOUSE
    186 static Button buttons[] = {
    187 	{ BUTTON1_CLICKED,        { mouse_focus,      { NULL  } } },
    188 	{ BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
    189 	{ BUTTON2_CLICKED,        { mouse_zoom,       { NULL  } } },
    190 	{ BUTTON3_CLICKED,        { mouse_minimize,   { NULL  } } },
    191 };
    192 #endif /* CONFIG_MOUSE */
    193 
    194 static Cmd commands[] = {
    195 	/* create [cmd]: create a new window, run `cmd` in the shell if specified */
    196 	{ "create", { create,	{ NULL } } },
    197 	/* focus <win_id>: focus the window whose `DVTM_WINDOW_ID` is `win_id` */
    198 	{ "focus",  { focusid,	{ NULL } } },
    199 	/* tag <win_id> <tag> [tag ...]: add +tag, remove -tag or set tag of the window with the given identifier */
    200 	{ "tag",    { tagid,	{ NULL } } },
    201 };
    202 
    203 /* gets executed when dvtm is started */
    204 static Action actions[] = {
    205 	{ create, { NULL } },
    206 };
    207 
    208 static char const * const keytable[] = {
    209 	/* add your custom key escape sequences */
    210 };