recipes

packages recipes for the <noname> package manager
Log | Files | Refs

config.h (10705B)


      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 	RED,
     17 	BLACK,
     18 };
     19 
     20 static Color colors[] = {
     21 	[DEFAULT] = { .fg = -1,          .bg = -1, .fg256 = -1, .bg256 = -1, },
     22 	[RED]     = { .fg = COLOR_RED,   .bg = -1, .fg256 =  1, .bg256 = -1, },
     23 	[BLACK]   = { .fg = COLOR_BLACK, .bg = -1, .fg256 =  0, .bg256 = -1, },
     24 };
     25 
     26 #define COLOR(c)        COLOR_PAIR(colors[c].pair)
     27 /* curses attributes for the currently focused window */
     28 #define SELECTED_ATTR   A_BOLD
     29 /* curses attributes for normal (not selected) windows */
     30 #define NORMAL_ATTR     (COLOR(BLACK) | A_BOLD)
     31 /* curses attributes for a window with pending urgent flag */
     32 #define URGENT_ATTR     (COLOR(RED) | A_BOLD)
     33 /* curses attributes for the status bar */
     34 #define BAR_ATTR        (COLOR(DEFAULT) | A_NORMAL)
     35 /* characters for beginning and end of status bar message */
     36 #define BAR_BEGIN       ' '
     37 #define BAR_END         ' '
     38 /* status bar (command line option -s) position */
     39 #define BAR_POS         BAR_TOP /* BAR_BOTTOM, BAR_OFF */
     40 /* whether status bar should be hidden if only one client exists */
     41 #define BAR_AUTOHIDE    false
     42 /* master width factor [0.1 .. 0.9] */
     43 #define MFACT 0.5
     44 /* number of clients in master area */
     45 #define NMASTER 1
     46 /* scroll back buffer size in lines */
     47 #define SCROLL_HISTORY 500
     48 /* printf format string for the tag in the status bar */
     49 #define TAG_SYMBOL   " %s "
     50 /* curses attributes for the currently selected tags */
     51 #define TAG_SEL      (COLOR(DEFAULT) | A_REVERSE)
     52 /* curses attributes for not selected tags which contain no windows */
     53 #define TAG_NORMAL   (COLOR(BLACK) | A_BOLD)
     54 /* curses attributes for not selected tags which contain windows */
     55 #define TAG_OCCUPIED (COLOR(DEFAULT) | A_BOLD)
     56 /* curses attributes for not selected tags which with urgent windows */
     57 #define TAG_URGENT (COLOR(RED) | A_BOLD)
     58 
     59 const char tags[][8] = { "1", "2", "3", "4", "5" };
     60 
     61 #include "tile.c"
     62 #include "grid.c"
     63 #include "bstack.c"
     64 #include "tstack.c"
     65 #include "vstack.c"
     66 #include "fullscreen.c"
     67 #include "fibonacci.c"
     68 
     69 /* by default the first layout entry is used */
     70 static Layout layouts[] = {
     71 	{ "[f]", tile },
     72 	{ "[b]", bstack },
     73 	{ "[u]", tstack },
     74 	{ "[n]", vstack },
     75 	{ "[g]", grid },
     76 	{ "[o]", spiral },
     77 	{ "[w]", dwindle },
     78 	{ "[m]", fullscreen },
     79 };
     80 
     81 #define MOD  CTRL('@')
     82 #define TAGKEYS(KEY,TAG) \
     83 	{ { MOD, 'v', KEY,     }, { view,           { tags[TAG] }               } }, \
     84 	{ { MOD, 't', KEY,     }, { tag,            { tags[TAG] }               } }, \
     85 	{ { MOD, 'V', KEY,     }, { toggleview,     { tags[TAG] }               } }, \
     86 	{ { MOD, 'T', KEY,     }, { toggletag,      { tags[TAG] }               } },
     87 
     88 /* you can specifiy at most 3 arguments */
     89 static KeyBinding bindings[] = {
     90 	{ { MOD, 'c',          }, { create,         { NULL }                    } },
     91 	{ { MOD, 'C',          }, { create,         { NULL, NULL, "$CWD" }      } },
     92 	{ { MOD, 'x', 'x',     }, { killclient,     { NULL }                    } },
     93 	{ { MOD, 'j',          }, { focusnext,      { NULL }                    } },
     94 	{ { MOD, 'J',          }, { focusdown,      { NULL }                    } },
     95 	{ { MOD, 'K',          }, { focusup,        { NULL }                    } },
     96 	{ { MOD, 'H',          }, { focusleft,      { NULL }                    } },
     97 	{ { MOD, 'L',          }, { focusright,     { NULL }                    } },
     98 	{ { MOD, 'k',          }, { focusprev,      { NULL }                    } },
     99 	{ { MOD, 'f',          }, { setlayout,      { "[f]" }                   } },
    100 	{ { MOD, 'b',          }, { setlayout,      { "[b]" }                   } },
    101 	{ { MOD, 'u',          }, { setlayout,      { "[u]" }                   } },
    102 	{ { MOD, 'n',          }, { setlayout,      { "[n]" }                   } },
    103 	{ { MOD, 'g',          }, { setlayout,      { "[g]" }                   } },
    104 	{ { MOD, 'o',          }, { setlayout,      { "[o]" }                   } },
    105 	{ { MOD, 'w',          }, { setlayout,      { "[w]" }                   } },
    106 	{ { MOD, 'm',          }, { setlayout,      { "[m]" }                   } },
    107 	{ { MOD, ' ',          }, { setlayout,      { NULL }                    } },
    108 	{ { MOD, 'i',          }, { incnmaster,     { "+1" }                    } },
    109 	{ { MOD, 'd',          }, { incnmaster,     { "-1" }                    } },
    110 	{ { MOD, 'h',          }, { setmfact,       { "-0.05" }                 } },
    111 	{ { MOD, 'l',          }, { setmfact,       { "+0.05" }                 } },
    112 	{ { MOD, '.',          }, { toggleminimize, { NULL }                    } },
    113 	{ { MOD, 's',          }, { togglebar,      { NULL }                    } },
    114 	{ { MOD, 'S',          }, { togglebarpos,   { NULL }                    } },
    115 	{ { MOD, 'M',          }, { togglemouse,    { NULL }                    } },
    116 	{ { MOD, '\n',         }, { zoom ,          { NULL }                    } },
    117 	{ { MOD, '\r',         }, { zoom ,          { NULL }                    } },
    118 	{ { MOD, '1',          }, { focusn,         { "1" }                     } },
    119 	{ { MOD, '2',          }, { focusn,         { "2" }                     } },
    120 	{ { MOD, '3',          }, { focusn,         { "3" }                     } },
    121 	{ { MOD, '4',          }, { focusn,         { "4" }                     } },
    122 	{ { MOD, '5',          }, { focusn,         { "5" }                     } },
    123 	{ { MOD, '6',          }, { focusn,         { "6" }                     } },
    124 	{ { MOD, '7',          }, { focusn,         { "7" }                     } },
    125 	{ { MOD, '8',          }, { focusn,         { "8" }                     } },
    126 	{ { MOD, '9',          }, { focusn,         { "9" }                     } },
    127 	{ { MOD, '\t',         }, { focuslast,      { NULL }                    } },
    128 	{ { MOD, 'q', 'q',     }, { quit,           { NULL }                    } },
    129 	{ { MOD, 'a',          }, { togglerunall,   { NULL }                    } },
    130 	{ { MOD, CTRL('L'),    }, { redraw,         { NULL }                    } },
    131 	{ { MOD, 'r',          }, { redraw,         { NULL }                    } },
    132 	{ { MOD, 'e',          }, { copymode,       { "dvtm-editor" }           } },
    133 	{ { MOD, 'E',          }, { copymode,       { "dvtm-pager" }            } },
    134 	{ { MOD, '/',          }, { copymode,       { "dvtm-pager", "/" }       } },
    135 	{ { MOD, 'p',          }, { paste,          { NULL }                    } },
    136 	{ { MOD, KEY_PPAGE,    }, { scrollback,     { "-1" }                    } },
    137 	{ { MOD, KEY_NPAGE,    }, { scrollback,     { "1"  }                    } },
    138 	{ { MOD, '?',          }, { create,         { "man dvtm", "dvtm help" } } },
    139 	{ { MOD, MOD,          }, { send,           { (const char []){MOD, 0} } } },
    140 	{ { KEY_SPREVIOUS,     }, { scrollback,     { "-1" }                    } },
    141 	{ { KEY_SNEXT,         }, { scrollback,     { "1"  }                    } },
    142 	{ { MOD, '0',          }, { view,           { NULL }                    } },
    143 	{ { MOD, KEY_F(1),     }, { view,           { tags[0] }                 } },
    144 	{ { MOD, KEY_F(2),     }, { view,           { tags[1] }                 } },
    145 	{ { MOD, KEY_F(3),     }, { view,           { tags[2] }                 } },
    146 	{ { MOD, KEY_F(4),     }, { view,           { tags[3] }                 } },
    147 	{ { MOD, KEY_F(5),     }, { view,           { tags[4] }                 } },
    148 	{ { MOD, 'v', '0'      }, { view,           { NULL }                    } },
    149 	{ { MOD, 'v', '\t',    }, { viewprevtag,    { NULL }                    } },
    150 	{ { MOD, 't', '0'      }, { tag,            { NULL }                    } },
    151 	TAGKEYS( '1',                              0)
    152 	TAGKEYS( '2',                              1)
    153 	TAGKEYS( '3',                              2)
    154 	TAGKEYS( '4',                              3)
    155 	TAGKEYS( '5',                              4)
    156 };
    157 
    158 static const ColorRule colorrules[] = {
    159 	{ "", A_NORMAL, &colors[DEFAULT] }, /* default */
    160 };
    161 
    162 /* possible values for the mouse buttons are listed below:
    163  *
    164  * BUTTON1_PRESSED          mouse button 1 down
    165  * BUTTON1_RELEASED         mouse button 1 up
    166  * BUTTON1_CLICKED          mouse button 1 clicked
    167  * BUTTON1_DOUBLE_CLICKED   mouse button 1 double clicked
    168  * BUTTON1_TRIPLE_CLICKED   mouse button 1 triple clicked
    169  * BUTTON2_PRESSED          mouse button 2 down
    170  * BUTTON2_RELEASED         mouse button 2 up
    171  * BUTTON2_CLICKED          mouse button 2 clicked
    172  * BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
    173  * BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
    174  * BUTTON3_PRESSED          mouse button 3 down
    175  * BUTTON3_RELEASED         mouse button 3 up
    176  * BUTTON3_CLICKED          mouse button 3 clicked
    177  * BUTTON3_DOUBLE_CLICKED   mouse button 3 double clicked
    178  * BUTTON3_TRIPLE_CLICKED   mouse button 3 triple clicked
    179  * BUTTON4_PRESSED          mouse button 4 down
    180  * BUTTON4_RELEASED         mouse button 4 up
    181  * BUTTON4_CLICKED          mouse button 4 clicked
    182  * BUTTON4_DOUBLE_CLICKED   mouse button 4 double clicked
    183  * BUTTON4_TRIPLE_CLICKED   mouse button 4 triple clicked
    184  * BUTTON_SHIFT             shift was down during button state change
    185  * BUTTON_CTRL              control was down during button state change
    186  * BUTTON_ALT               alt was down during button state change
    187  * ALL_MOUSE_EVENTS         report all button state changes
    188  * REPORT_MOUSE_POSITION    report mouse movement
    189  */
    190 
    191 #ifdef NCURSES_MOUSE_VERSION
    192 # define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
    193 #endif
    194 
    195 #define ENABLE_MOUSE true /* whether to enable mouse events by default */
    196 
    197 #ifdef CONFIG_MOUSE
    198 static Button buttons[] = {
    199 	{ BUTTON1_CLICKED,        { mouse_focus,      { NULL  } } },
    200 	{ BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
    201 	{ BUTTON2_CLICKED,        { mouse_zoom,       { NULL  } } },
    202 	{ BUTTON3_CLICKED,        { mouse_minimize,   { NULL  } } },
    203 };
    204 #endif /* CONFIG_MOUSE */
    205 
    206 static Cmd commands[] = {
    207 	/* create [cmd...]: create a new window, run `cmd` in the shell if specified */
    208 	{ "create", { create,	{ NULL } } },
    209 	/* focus <win_id>: focus the window whose `DVTM_WINDOW_ID` is `win_id` */
    210 	{ "focus",  { focusid,	{ NULL } } },
    211 	/* tag <win_id> <tag> [tag ...]: add +tag, remove -tag or set tag of the window with the given identifier */
    212 	{ "tag",    { tagid,	{ NULL } } },
    213 };
    214 
    215 /* gets executed when dvtm is started */
    216 static Action actions[] = {
    217 	{ create, { NULL } },
    218 };
    219 
    220 static char const * const keytable[] = {
    221 	/* add your custom key escape sequences */
    222 };