viking

webkit based web browser for Enlightenment
Log | Files | Refs | LICENSE

keymap.h (10999B)


      1 /*
      2     (c) 2009 by Leon Winter
      3     (c) 2009-2011 by Hannes Schueller
      4     (c) 2009-2010 by Matto Fransen
      5     (c) 2010-2011 by Hans-Peter Deifel
      6     (c) 2010-2011 by Thomas Adam
      7     (c) 2011 by Albert Kim
      8     see LICENSE file
      9 */
     10 
     11 #ifndef _KEYMAP
     12 #define _KEYMAP
     13 
     14 /* key bindings for normal mode
     15     Note: GDK_VoidSymbol is a wildcard so it matches on every modkey
     16 */
     17 static Key keys[] = {
     18 	/* modmask,   modkey, key,    function,   argument */
     19 	{ 0,          'q',    "1",    quickmark,  { .s = "1" } },
     20 	{ 0,          'q',    "2",    quickmark,  { .s = "2"  } },
     21 	{ 0,          'q',    "3",    quickmark,  { .s = "3" } },
     22 	{ 0,          'q',    "4",    quickmark,  { .s = "4" } },
     23 	{ 0,          'q',    "5",    quickmark,  { .s = "5" } },
     24 	{ 0,          'q',    "6",    quickmark,  { .s = "6" } },
     25 	{ 0,          'q',    "7",    quickmark,  { .s = "7" } },
     26 	{ 0,          'q',    "8",    quickmark,  { .s = "8" } },
     27 	{ 0,          'q',    "9",    quickmark,  { .s = "9" } },
     28 	{ 0,          0,      "0",    scroll,     {ScrollJumpTo   | DirectionLeft} },
     29 	{ 0,          0,      "$",    scroll,     {ScrollJumpTo   | DirectionRight} },
     30 	{ 0,          'g',    "g",    scroll,     {ScrollJumpTo   | DirectionTop} },
     31 	{ 0,          0,      "G",    scroll,     {ScrollJumpTo   | DirectionBottom} },
     32 	{ 0,          0,      "h",    scroll,     {ScrollMove     | DirectionLeft     | UnitLine} },
     33 	{ 0,          0,      "j",    scroll,     {ScrollMove     | DirectionBottom   | UnitLine} },
     34 	{ 0,          0,      "k",    scroll,     {ScrollMove     | DirectionTop      | UnitLine} },
     35 	{ 0,          0,      "l",    scroll,     {ScrollMove     | DirectionRight    | UnitLine} },
     36 	{ 0,          0,      " ",    scroll,     {ScrollMove     | DirectionBottom   | UnitPage} },
     37 	{ "Shift",    0,      " ",    scroll,     {ScrollMove     | DirectionTop      | UnitPage} },
     38 	{ "Control",  0,      "b",    scroll,     {ScrollMove     | DirectionTop      | UnitPage} },
     39 	{ "Control",  0,      "f",    scroll,     {ScrollMove     | DirectionBottom   | UnitPage} },
     40 	{ "Control",  0,      "d",    scroll,     {ScrollMove     | DirectionBottom   | UnitBuffer} },
     41 	{ "Control",  0,      "u",    scroll,     {ScrollMove     | DirectionTop      | UnitBuffer} },
     42 	{ "Control",  0,      "e",    scroll,     {ScrollMove     | DirectionBottom   | UnitLine} },
     43 	{ "Control",  0,      "y",    scroll,     {ScrollMove     | DirectionTop      | UnitLine} },
     44 	/*
     45 	   { 0,          "g",    "t",    fake_key_event,   { .s = "l", .i = ShiftMask + ControlMask   } },
     46 	   { 0,          "g",    "T",    fake_key_event,   { .s = "h", .i = ShiftMask + ControlMask  } },
     47 	   { 0,          "g",    "1",    fake_key_event,   { .s = "1", .i = ControlMask   } },
     48 	   { 0,          "g",    "2",    fake_key_event,   { .s = "2", .i = ControlMask   } },
     49 	   { 0,          "g",    "3",    fake_key_event,   { .s = "3", .i = ControlMask   } },
     50 	   { 0,          "g",    "4",    fake_key_event,   { .s = "4", .i = ControlMask   } },
     51 	   { 0,          "g",    "5",    fake_key_event,   { .s = "5", .i = ControlMask   } },
     52 	   { 0,          "g",    "6",    fake_key_event,   { .s = "6", .i = ControlMask   } },
     53 	   { 0,          "g",    "7",    fake_key_event,   { .s = "7", .i = ControlMask   } },
     54 	   { 0,          "g",    "8",    fake_key_event,   { .s = "8", .i = ControlMask   } },
     55 	   { 0,          "g",    "9",    fake_key_event,   { .s = "9", .i = ControlMask   } },
     56 	   { 0,          "g",    "0",    fake_key_event,   { .s = "0", .i = ControlMask   } },
     57 	   */
     58 	{ "Alt",      0,      "Left", navigate,   {NavigationBack} },
     59 	{ "Alt",      0,      "Right",navigate,   {NavigationForward} },
     60 	{ "Control",  0,      "i",    navigate,   {NavigationBack} },
     61 	{ "Control",  0,      "o",    navigate,   {NavigationForward} },
     62 	{ 0,          0,      "H",    navigate,   {NavigationBack} },
     63 	{ 0,          0,      "L",    navigate,   {NavigationForward} },
     64 	// { 0,          0,      "r",    navigate,   {NavigationReload} },
     65 	{ 0,          0,      "R",    navigate,   {NavigationForceReload} },
     66 	{ 0,          0,      "c",    navigate,   {NavigationCancel} },
     67 
     68 	{ 0,          0,      "plus", zoom,       {ZoomIn} },
     69 	{ 0,          0,      "minus", zoom,      {ZoomOut} },
     70 	{ 0,          'z',    "i",    zoom,       {ZoomIn} },
     71 	{ 0,          'z',    "o",    zoom,       {ZoomOut} },
     72 	{ 0,          'z',    "z",    zoom,       {ZoomReset} },
     73 
     74 	{ 0,          0,      "y",    yank,       {SourceURL     | ClipboardPrimary  | ClipboardGTK} },
     75 	{ 0,          0,      "Y",    yank,       {SourceSelection| ClipboardPrimary | ClipboardGTK} },
     76 
     77 	{ 0,          'g',    "u",    descend,    {NthSubdir} },
     78 	{ 0,          'g',    "U",    descend,    {Rootdir} },
     79 
     80 	{ 0,          'g',    "h",    open_arg,   {TargetCurrent, DEFAULT_URL} },
     81 	{ 0,          'g',    "H",    open_arg,   {TargetNew,     DEFAULT_URL} },
     82 
     83 	{ 0,          0,      "p",    paste,      {TargetCurrent | ClipboardPrimary  | ClipboardGTK} },
     84 	{ 0,          0,      "P",    paste,      {TargetNew     | ClipboardPrimary  | ClipboardGTK} },
     85 
     86 	{ "Control",  0,      "a",    number,     {Increment} },
     87 	{ "Control",  0,      "x",    number,     {Decrement} },
     88 
     89 	{ 0,          0,      "n",    search,     {DirectionNext     | CaseInsensitive   | Wrapping} },
     90 	{ 0,          0,      "N",    search,     {DirectionPrev     | CaseInsensitive   | Wrapping} },
     91 
     92 	{ 0,          0,      "colon", input,     {.s = ":" } },
     93 	// { 0,          0,      "o",    input,      {.s = ":open "} },
     94 	{ 0,          0,      "O",    input,      {.s = ":open ", .i = InsertCurrentURL} },
     95 	// { 0,          0,      "t",    input,      {.s = ":tabopen "} },
     96 	{ 0,          0,      "T",    input,      {.s = ":tabopen ", .i = InsertCurrentURL} },
     97 	// { 0,          0,      "w",    input,      {.s = ":winopen "} },
     98 	{ 0,          0,      "W",    input,      {.s = ":winopen ", .i = InsertCurrentURL} },
     99 	{ 0,          0,      "slash",    input,      {.s = "/"} },
    100 	//    { 0,          0,      GDK_KP_Divide,  input,      {.s = "/"} },
    101 	{ 0,          0,      "question",    input,      {.s = "?"} },
    102 
    103 	{ 0,          0,      "period", input,      {.s = "."} },
    104 	{ 0,          0,      "comma", input,      {.s = ","} },
    105 	{ 0,          ';',    "i",    input,      {.s = ";i"} },
    106 	{ 0,          ';',    "s",    input,      {.s = ";s"} },
    107 	{ 0,          ';',    "y",    input,      {.s = ";y"} },
    108 	{ 0,          ';',    "o",    input,      {.s = ";o"} },
    109 	{ 0,          ';',    "t",    input,      {.s = ";t"} },
    110 	{ 0,          ';',    "w",    input,      {.s = ";w"} },
    111 	{ 0,          ';',    "I",    input,      {.s = ";I"} },
    112 	{ 0,          ';',    "O",    input,      {.s = ";O"} },
    113 	{ 0,          ';',    "T",    input,      {.s = ";T"} },
    114 	{ 0,          ';',    "W",    input,      {.s = ";W"} },
    115 
    116 	{ 0,          '*', "Escape",     set,        {ModeNormal} },
    117 	{ "Control",  '*', "bracketleft",            set,        {ModeNormal} },
    118 	{ "Control",  0,      "z",    set,        {ModePassThrough} },
    119 	{ "Control",  0,      "v",    set,        {ModeSendKey} },
    120 	{ 0,          0,      "f",    input,      {.s = "."} },
    121 	{ 0,          0,      "F",    input,      {.s = ","} },
    122 
    123 	{ 0,          'g',    "i",    focus_input,{} },
    124 	{ 0,          0,      "u",    revive,     {} },
    125 
    126 	// { 0,          0,      "x",    buffer,       {0} },
    127 	// { 0,          0,      "X",    revive_last_tab,       {0} },
    128 	{ 0,          0,      "b",    switch_buffer, {0}},
    129 	/* leave this last line as last */
    130 	{ 0,          0,      0,      0,          {0} },
    131 };
    132 
    133 /* command mapping */
    134 static Command commands[] = {
    135 	/* command,               function,         argument */
    136 	{ "b",                    switch_buffer,    {0} },
    137 	{ "bdelete",              buffer,           {0} },
    138 	{ "ba",                   navigate,         {NavigationBack} },
    139 	{ "back",                 navigate,         {NavigationBack} },
    140 	{ "ec",                   script,           {Info} },
    141 	{ "echo",                 script,           {Info} },
    142 	{ "echoe",                script,           {Error} },
    143 	{ "echoerr",              script,           {Error} },
    144 	{ "fw",                   navigate,         {NavigationForward} },
    145 	{ "fo",                   navigate,         {NavigationForward} },
    146 	{ "forward",              navigate,         {NavigationForward} },
    147 	{ "inspector",            inspector,        {0} },
    148 	{ "javascript",           script,           {Silent} },
    149 	{ "o",                    open_arg,         {TargetCurrent} },
    150 	{ "open",                 open_arg,         {TargetCurrent} },
    151 	{ "q",                    quit,             {0} },
    152 	{ "quit",                 quit,             {0} },
    153 	{ "re",                   navigate,         {NavigationReload} },
    154 	{ "re!",                  navigate,         {NavigationForceReload} },
    155 	{ "reload",               navigate,         {NavigationReload} },
    156 	{ "reload!",              navigate,         {NavigationForceReload} },
    157 	{ "st",                   navigate,         {NavigationCancel} },
    158 	{ "stop",                 navigate,         {NavigationCancel} },
    159 	{ "t",                    open_arg,          {0} },
    160 	{ "tabopen",              open_arg,         {TargetNew} },
    161 	{ "winopen",              open_arg,         {TargetNewWindow} },
    162 	{ "print",                print_frame,      {0} },
    163 	{ "bma",                  bookmark,         {0} },
    164 	{ "bookmark",             bookmark,         {0} },
    165 	{ "source",               view_source,      {0} },
    166 	//    { "set",                  browser_settings, {0} },
    167 	//    { "map",                  mappings,         {0} },
    168 	{ "jumpleft",             scroll,           {ScrollJumpTo   | DirectionLeft} },
    169 	{ "jumpright",            scroll,           {ScrollJumpTo   | DirectionRight} },
    170 	{ "jumptop",              scroll,           {ScrollJumpTo   | DirectionTop} },
    171 	{ "jumpbottom",           scroll,           {ScrollJumpTo   | DirectionBottom} },
    172 	{ "pageup",               scroll,           {ScrollMove     | DirectionTop      | UnitPage} },
    173 	{ "pagedown",             scroll,           {ScrollMove     | DirectionBottom   | UnitPage} },
    174 	{ "navigationback",   	  navigate,         {NavigationBack} },
    175 	{ "navigationforward",	  navigate,         {NavigationForward} },
    176 	{ "scrollleft",           scroll,           {ScrollMove     | DirectionLeft     | UnitLine} },
    177 	{ "scrollright",          scroll,           {ScrollMove     | DirectionRight    | UnitLine} },
    178 	{ "scrollup",             scroll,           {ScrollMove     | DirectionTop      | UnitLine} },
    179 	{ "scrolldown",           scroll,           {ScrollMove     | DirectionBottom   | UnitLine} },
    180 	{ "ls",                   list,             {0} },
    181 };
    182 
    183 #if 0
    184 static Mouse mouse[] = {
    185 	/* modmask,  modkey,    button, function, argument */
    186 	{0,         0,         2,      paste,    {TargetCurrent  | ClipboardPrimary  | ClipboardGTK, rememberedURI} },
    187 	{"Control",  0,         2,      paste,           {TargetNew  | ClipboardPrimary  | ClipboardGTK} },
    188 	{"Control", 0,         1,      open_remembered, {TargetNew} },
    189 };
    190 #endif
    191 
    192 #endif