dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

config.h (13068B)


      1 /* ░▀▀▄░█▀▄░█░█░█▄█░░
      2  * ░▄▀░░█▀▄░█▄█░█░█░░
      3  * ░▀▀▀░▀▀░░▀░▀░▀░▀░░ */
      4 ///---User configurable stuff---///
      5 ///---Modifiers---///
      6 #define MOD             XCB_MOD_MASK_4       /* Super/Windows key  or check xmodmap(1) with -pm  defined in /usr/include/xcb/xproto.h */
      7 ///--Speed---///
      8 /* Move this many pixels when moving or resizing with keyboard unless the window has hints saying otherwise.
      9  *0)move step slow   1)move step fast
     10  *2)mouse slow       3)mouse fast     */
     11 static const uint16_t movements[] = {20,40,15,400};
     12 /* resize by line like in mcwm -- jmbi */
     13 static const bool     resize_by_line          = true;
     14 /* the ratio used when resizing and keeping the aspect */
     15 static const float    resize_keep_aspect_ratio= 1.03;
     16 ///---Offsets---///
     17 /*0)offsetx          1)offsety
     18  *2)maxwidth         3)maxheight */
     19 static const uint8_t offsets[] = {10,10,20,20};
     20 ///---Colors---///
     21 /*0)focuscol         1)unfocuscol
     22  *2)fixedcol         3)unkilcol
     23  *4)fixedunkilcol    5)outerbordercol
     24  *6)emptycol         */
     25 static const char *colors[] = {"#807b64","#131313","#3f3639","#58333e","#1e1b1c","#2b2b2d","#202020"};
     26 /* if this is set to true the inner border and outer borders colors will be swapped */
     27 static const bool inverted_colors = true;
     28 ///---Cursor---///
     29 /* default position of the cursor:
     30  * correct values are:
     31  * TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, MIDDLE
     32  * All these are relative to the current window. */
     33 #define CURSOR_POSITION MIDDLE
     34 ///---Borders---///
     35 /*0) Outer border size. If you put this negative it will be a square.
     36  *1) Full borderwidth    2) Magnet border size
     37  *3) Resize border size  */
     38 static const uint8_t borders[] = {4,10,6,6};
     39 /* Windows that won't have a border.
     40  * It uses substring comparison with what is found in the WM_NAME
     41  * attribute of the window. You can test this using `xprop WM_NAME`
     42  */
     43 #define LOOK_INTO "WM_NAME"
     44 static const char *ignore_names[] = {"bar", "xclock"};
     45 ///--Menus and Programs---///
     46 static const char *menucmd[]   = { "/home/pyratebeard/bin/rundmc", NULL };
     47 static const char *terminal[]  = { "urxvtc", NULL };
     48 static const char *lock[]  = { "/home/pyratebeard/bin/lock", NULL };
     49 ///--Custom foo---///
     50 static void halfandcentered(const Arg *arg)
     51 {
     52 	Arg arg2 = {.i=TWOBWM_MAXHALF_VERTICAL_LEFT};
     53 	maxhalf(&arg2);
     54 	Arg arg3 = {.i=TWOBWM_TELEPORT_CENTER};
     55 	teleport(&arg3);
     56 }
     57 static void maxwithborders(const Arg *arg)
     58 {
     59 	Arg arg2 = {.i=TWOBWM_MAXHALF_VERTICAL_LEFT};
     60 	maxhalf(&arg2);
     61 	Arg arg3 = {.i=TWOBWM_MAXIMIZE_HORIZONTALLY};
     62 	maxvert_hor(&arg3);
     63 }
     64 static void doubledown(const Arg *arg)
     65 {
     66 	Arg arg2 = {.i=TWOBWM_MAXHALF_UNFOLD_VERTICAL};
     67 	maxhalf(&arg2);
     68 	Arg arg3 = {.i=TWOBWM_MAXHALF_UNFOLD_HORIZONTAL};
     69 	maxhalf(&arg3);
     70 }
     71 ///---Sloppy focus behavior---///
     72 /*
     73  * Command to execute when switching from sloppy focus to click to focus
     74  * The strings "Sloppy" and "Click" will be passed as the last argument
     75  * If NULL this is ignored
     76  */
     77 static const char *sloppy_switch_cmd[] = {};
     78 //static const char *sloppy_switch_cmd[] = { "notify-send", "toggle sloppy", NULL };
     79 static void toggle_sloppy(const Arg *arg)
     80 {
     81 	is_sloppy = !is_sloppy;
     82 	if (arg->com != NULL && LENGTH(arg->com) > 0) {
     83 		start(arg);
     84 	}
     85 }
     86 ///---Shortcuts---///
     87 /* Check /usr/include/X11/keysymdef.h for the list of all keys
     88  * 0x000000 is for no modkey
     89  * If you are having trouble finding the right keycode use the `xev` to get it
     90  * For example:
     91  * KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
     92  *  root 0x98, subw 0x0, time 211120530, (128,73), root:(855,214),
     93  *  state 0x10, keycode 171 (keysym 0x1008ff17, XF86AudioNext), same_screen YES,
     94  *  XLookupString gives 0 bytes:
     95  *  XFilterEvent returns: False
     96  *
     97  *  The keycode here is keysym 0x1008ff17, so use  0x1008ff17
     98  *
     99  *
    100  * For AZERTY keyboards XK_1...0 should be replaced by :
    101  *      DESKTOPCHANGE(     XK_ampersand,                     0)
    102  *      DESKTOPCHANGE(     XK_eacute,                        1)
    103  *      DESKTOPCHANGE(     XK_quotedbl,                      2)
    104  *      DESKTOPCHANGE(     XK_apostrophe,                    3)
    105  *      DESKTOPCHANGE(     XK_parenleft,                     4)
    106  *      DESKTOPCHANGE(     XK_minus,                         5)
    107  *      DESKTOPCHANGE(     XK_egrave,                        6)
    108  *      DESKTOPCHANGE(     XK_underscore,                    7)
    109  *      DESKTOPCHANGE(     XK_ccedilla,                      8)
    110  *      DESKTOPCHANGE(     XK_agrave,                        9)*
    111  */
    112 #define DESKTOPCHANGE(K,N) \
    113 {  MOD ,             K,              changeworkspace, {.i=N}}, \
    114 {  MOD |SHIFT,       K,              sendtoworkspace, {.i=N}},
    115 static key keys[] = {
    116     /* modifier           key            function           argument */
    117     // Focus to next/previous window
    118     {  MOD ,              XK_Tab,        focusnext,         {.i=TWOBWM_FOCUS_NEXT}},
    119     {  MOD |SHIFT,        XK_Tab,        focusnext,         {.i=TWOBWM_FOCUS_PREVIOUS}},
    120     // Kill a window
    121     {  MOD ,              XK_q,          deletewin,         {}},
    122     // Resize a window
    123     {  MOD |SHIFT,        XK_k,          resizestep,        {.i=TWOBWM_RESIZE_UP}},
    124     {  MOD |SHIFT,        XK_j,          resizestep,        {.i=TWOBWM_RESIZE_DOWN}},
    125     {  MOD |SHIFT,        XK_l,          resizestep,        {.i=TWOBWM_RESIZE_RIGHT}},
    126     {  MOD |SHIFT,        XK_h,          resizestep,        {.i=TWOBWM_RESIZE_LEFT}},
    127     // Resize a window slower
    128     {  MOD |SHIFT|CONTROL,XK_k,          resizestep,        {.i=TWOBWM_RESIZE_UP_SLOW}},
    129     {  MOD |SHIFT|CONTROL,XK_j,          resizestep,        {.i=TWOBWM_RESIZE_DOWN_SLOW}},
    130     {  MOD |SHIFT|CONTROL,XK_l,          resizestep,        {.i=TWOBWM_RESIZE_RIGHT_SLOW}},
    131     {  MOD |SHIFT|CONTROL,XK_h,          resizestep,        {.i=TWOBWM_RESIZE_LEFT_SLOW}},
    132     // Move a window
    133     {  MOD ,              XK_k,          movestep,          {.i=TWOBWM_MOVE_UP}},
    134     {  MOD ,              XK_j,          movestep,          {.i=TWOBWM_MOVE_DOWN}},
    135     {  MOD ,              XK_l,          movestep,          {.i=TWOBWM_MOVE_RIGHT}},
    136     {  MOD ,              XK_h,          movestep,          {.i=TWOBWM_MOVE_LEFT}},
    137     // Move a window slower
    138     {  MOD |CONTROL,      XK_k,          movestep,          {.i=TWOBWM_MOVE_UP_SLOW}},
    139     {  MOD |CONTROL,      XK_j,          movestep,          {.i=TWOBWM_MOVE_DOWN_SLOW}},
    140     {  MOD |CONTROL,      XK_l,          movestep,          {.i=TWOBWM_MOVE_RIGHT_SLOW}},
    141     {  MOD |CONTROL,      XK_h,          movestep,          {.i=TWOBWM_MOVE_LEFT_SLOW}},
    142     // Teleport the window to an area of the screen.
    143     // Center:
    144     {  MOD ,              XK_g,          teleport,          {.i=TWOBWM_TELEPORT_CENTER}},
    145     // Center y:
    146     {  MOD |SHIFT,        XK_g,          teleport,          {.i=TWOBWM_TELEPORT_CENTER_Y}},
    147     // Center x:
    148     {  MOD |CONTROL,      XK_g,          teleport,          {.i=TWOBWM_TELEPORT_CENTER_X}},
    149     // Top left:
    150     {  MOD ,              XK_y,          teleport,          {.i=TWOBWM_TELEPORT_TOP_LEFT}},
    151     // Top right:
    152     {  MOD ,              XK_u,          teleport,          {.i=TWOBWM_TELEPORT_TOP_RIGHT}},
    153     // Bottom left:
    154     {  MOD ,              XK_b,          teleport,          {.i=TWOBWM_TELEPORT_BOTTOM_LEFT}},
    155     // Bottom right:
    156     {  MOD ,              XK_n,          teleport,          {.i=TWOBWM_TELEPORT_BOTTOM_RIGHT}},
    157     // Resize while keeping the window aspect
    158     {  MOD ,              XK_Home,       resizestep_aspect, {.i=TWOBWM_RESIZE_KEEP_ASPECT_GROW}},
    159     {  MOD ,              XK_End,        resizestep_aspect, {.i=TWOBWM_RESIZE_KEEP_ASPECT_SHRINK}},
    160     // Maximize (ignore offset and no EWMH atom)
    161     //{  MOD ,              XK_x,          maximize,          {}},
    162     // Maximize with borders
    163     {  MOD ,              XK_x,          maxwithborders,          {.i=0}},
    164     // Unfold vert and horz
    165     {  MOD ,              XK_d,          doubledown,              {.i=0}},
    166     // Full screen (disregarding offsets and adding EWMH atom)
    167     {  MOD |SHIFT ,       XK_x,          fullscreen,        {}},
    168     // Maximize vertically
    169     {  MOD ,              XK_m,          maxvert_hor,       {.i=TWOBWM_MAXIMIZE_VERTICALLY}},
    170     // Maximize horizontally
    171     {  MOD |SHIFT,        XK_m,          maxvert_hor,       {.i=TWOBWM_MAXIMIZE_HORIZONTALLY}},
    172     // Maximize and move
    173     // vertically left
    174     {  MOD |SHIFT,        XK_y,          maxhalf,           {.i=TWOBWM_MAXHALF_VERTICAL_LEFT}},
    175     // vertically right
    176     {  MOD |SHIFT,        XK_u,          maxhalf,           {.i=TWOBWM_MAXHALF_VERTICAL_RIGHT}},
    177     // horizontally left
    178     {  MOD |SHIFT,        XK_b,          maxhalf,           {.i=TWOBWM_MAXHALF_HORIZONTAL_BOTTOM}},
    179     // horizontally right
    180     {  MOD |SHIFT,        XK_n,          maxhalf,           {.i=TWOBWM_MAXHALF_HORIZONTAL_TOP}},
    181     //fold half vertically
    182     {  MOD |SHIFT|CONTROL,XK_y,          maxhalf,           {.i=TWOBWM_MAXHALF_FOLD_VERTICAL}},
    183     //fold half horizontally
    184     {  MOD |SHIFT|CONTROL,XK_b,          maxhalf,           {.i=TWOBWM_MAXHALF_FOLD_HORIZONTAL}},
    185     //unfold vertically
    186     {  MOD |SHIFT|CONTROL,XK_u,          maxhalf,           {.i=TWOBWM_MAXHALF_UNFOLD_VERTICAL}},
    187     //unfold horizontally
    188     {  MOD |SHIFT|CONTROL,XK_n,          maxhalf,           {.i=TWOBWM_MAXHALF_UNFOLD_HORIZONTAL}},
    189     // Next/Previous screen
    190     {  MOD ,              XK_comma,      changescreen,      {.i=TWOBWM_NEXT_SCREEN}},
    191     {  MOD ,              XK_period,     changescreen,      {.i=TWOBWM_PREVIOUS_SCREEN}},
    192     // Raise or lower a window
    193     {  MOD ,              XK_r,          raiseorlower,      {}},
    194     // Next/Previous workspace
    195     {  MOD ,              XK_v,          nextworkspace,     {}},
    196     {  MOD ,              XK_c,          prevworkspace,     {}},
    197     // Move to Next/Previous workspace
    198     {  MOD |SHIFT ,       XK_v,          sendtonextworkspace,{}},
    199     {  MOD |SHIFT ,       XK_c,          sendtoprevworkspace,{}},
    200     // Iconify the window
    201     {  MOD ,              XK_i,          hide,              {}},
    202     // Make the window unkillable
    203     {  MOD ,              XK_a,          unkillable,        {}},
    204     // Make the window appear always on top
    205     {  MOD,               XK_t,          always_on_top,     {}},
    206     // Make the window stay on all workspaces
    207     {  MOD ,              XK_f,          fix,               {}},
    208     // Move the cursor
    209     {  MOD ,              XK_Up,         cursor_move,       {.i=TWOBWM_CURSOR_UP_SLOW}},
    210     {  MOD ,              XK_Down,       cursor_move,       {.i=TWOBWM_CURSOR_DOWN_SLOW}},
    211     {  MOD ,              XK_Right,      cursor_move,       {.i=TWOBWM_CURSOR_RIGHT_SLOW}},
    212     {  MOD ,              XK_Left,       cursor_move,       {.i=TWOBWM_CURSOR_LEFT_SLOW}},
    213     // Move the cursor faster
    214     {  MOD |SHIFT,        XK_Up,         cursor_move,       {.i=TWOBWM_CURSOR_UP}},
    215     {  MOD |SHIFT,        XK_Down,       cursor_move,       {.i=TWOBWM_CURSOR_DOWN}},
    216     {  MOD |SHIFT,        XK_Right,      cursor_move,       {.i=TWOBWM_CURSOR_RIGHT}},
    217     {  MOD |SHIFT,        XK_Left,       cursor_move,       {.i=TWOBWM_CURSOR_LEFT}},
    218     // Start programs
    219     {  MOD ,              XK_w,          start,             {.com = menucmd}},
    220     {  MOD ,              XK_Return,     start,             {.com = terminal}},
    221     {  MOD ,              XK_z,          start,             {.com = lock}},
    222     // Exit or restart 2bwm
    223     {  MOD |CONTROL,      XK_q,          twobwm_exit,       {.i=0}},
    224     {  MOD |CONTROL,      XK_r,          twobwm_restart,    {.i=0}},
    225     {  MOD ,              XK_space,      halfandcentered,   {.i=0}},
    226     {  MOD ,              XK_s,          toggle_sloppy,     {.com = sloppy_switch_cmd}},
    227     // Change current workspace
    228        DESKTOPCHANGE(     XK_1,                             0)
    229        DESKTOPCHANGE(     XK_2,                             1)
    230        DESKTOPCHANGE(     XK_3,                             2)
    231        DESKTOPCHANGE(     XK_4,                             3)
    232        DESKTOPCHANGE(     XK_5,                             4)
    233        DESKTOPCHANGE(     XK_6,                             5)
    234        DESKTOPCHANGE(     XK_7,                             6)
    235        DESKTOPCHANGE(     XK_8,                             7)
    236        DESKTOPCHANGE(     XK_9,                             8)
    237        DESKTOPCHANGE(     XK_0,                             9)
    238 };
    239 // the last argument makes it a root window only event
    240 static Button buttons[] = {
    241     {  MOD        ,XCB_BUTTON_INDEX_1,     mousemotion,   {.i=TWOBWM_MOVE}, false},
    242     {  MOD        ,XCB_BUTTON_INDEX_3,     mousemotion,   {.i=TWOBWM_RESIZE}, false},
    243     {  0          ,XCB_BUTTON_INDEX_3,     start,         {.com = terminal}, true},
    244     {  MOD|SHIFT,  XCB_BUTTON_INDEX_1,     changeworkspace, {.i=0}, false},
    245     {  MOD|SHIFT,  XCB_BUTTON_INDEX_3,     changeworkspace, {.i=1}, false},
    246     {  MOD|ALT,    XCB_BUTTON_INDEX_1,     changescreen,    {.i=1}, false},
    247     {  MOD|ALT,    XCB_BUTTON_INDEX_3,     changescreen,    {.i=0}, false}
    248 };