From cd6f93be3fa607e98fe17d05c86b31dcfc6fdf1c Mon Sep 17 00:00:00 2001 From: Sardem FF7 Date: Mon, 18 Apr 2011 23:06:32 +0200 Subject: [PATCH] Rename bind to bindcode Also fallback when using just 'bind' to be backward-compatible --- docs/userguide | 6 ++-- man/i3.man | 76 +++++++++++++++++++++++++------------------------- src/cfgparse.l | 7 +++-- src/cfgparse.y | 10 +++---- 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/docs/userguide b/docs/userguide index 35e587af..5610eaa5 100644 --- a/docs/userguide +++ b/docs/userguide @@ -256,7 +256,7 @@ keysyms. *Syntax*: ---------------------------------- bindsym [Modifiers+]keysym command -bind [Modifiers+]keycode command +bindcode [Modifiers+]keycode command ---------------------------------- *Examples*: @@ -268,7 +268,7 @@ bindsym Mod1+f f bindsym Mod1+Shift+r restart # Notebook-specific hotkeys -bind 214 exec /home/michael/toggle_beamer.sh +bindcode 214 exec /home/michael/toggle_beamer.sh -------------------------------- Available Modifiers: @@ -680,7 +680,7 @@ mode "resize" { bindsym d resize right +10 bindsym Shift+d resize right -10 - bind 36 mode default + bindcode 36 mode default } # Enter resize mode diff --git a/man/i3.man b/man/i3.man index 7dbe0dfa..e46ccbea 100644 --- a/man/i3.man +++ b/man/i3.man @@ -156,84 +156,84 @@ You can specify a custom path using the -c option. font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # Start terminal (Mod1+Enter) -bind Mod1+36 exec /usr/bin/urxvt +bindcode Mod1+36 exec /usr/bin/urxvt # Start dmenu (Mod1+v) -bind Mod1+55 exec /usr/bin/dmenu_run +bindcode Mod1+55 exec /usr/bin/dmenu_run # Kill current client (Mod1+Shift+q) -bind Mod1+Shift+24 kill +bindcode Mod1+Shift+24 kill # Beamer on/off -bind Mod1+73 exec /home/michael/toggle_beamer.sh +bindcode Mod1+73 exec /home/michael/toggle_beamer.sh # Screen locking -bind Mod1+68 exec /usr/bin/i3lock +bindcode Mod1+68 exec /usr/bin/i3lock # Restart i3 inplace (Mod1+Shift+r) -bind Mod1+Shift+27 restart +bindcode Mod1+Shift+27 restart # Exit i3 (Mod1+Shift+e) -bind Mod1+Shift+26 exit +bindcode Mod1+Shift+26 exit # Brightness -bind Mod1+97 exec sudo sh -c "echo up > /proc/acpi/ibm/brightness" -bind Mod1+103 exec sudo sh -c "echo down > /proc/acpi/ibm/brightness" +bindcode Mod1+97 exec sudo sh -c "echo up > /proc/acpi/ibm/brightness" +bindcode Mod1+103 exec sudo sh -c "echo down > /proc/acpi/ibm/brightness" # Fullscreen (Mod1+f) -bind Mod1+41 f +bindcode Mod1+41 f # Stacking (Mod1+h) -bind Mod1+43 s +bindcode Mod1+43 s # Default (Mod1+e) -bind Mod1+26 d +bindcode Mod1+26 d # Toggle tiling/floating of the current window (Mod1+Shift+Space) -bind Mod1+Shift+65 t +bindcode Mod1+Shift+65 t # Go into the tiling layer / floating layer, depending on whether # the current window is tiling / floating (Mod1+t) -bind Mod1+28 focus ft +bindcode Mod1+28 focus ft # Focus (Mod1+j/k/l/;) -bind Mod1+44 h -bind Mod1+45 j -bind Mod1+46 k -bind Mod1+47 l +bindcode Mod1+44 h +bindcode Mod1+45 j +bindcode Mod1+46 k +bindcode Mod1+47 l # Focus Container (Mod3+j/k/l/;) -bind Mod3+44 wch -bind Mod3+45 wcj -bind Mod3+46 wck -bind Mod3+47 wcl +bindcode Mod3+44 wch +bindcode Mod3+45 wcj +bindcode Mod3+46 wck +bindcode Mod3+47 wcl # Snap (Mod1+Control+j/k/l/;) -bind Mod1+Control+44 sh -bind Mod1+Control+45 sj -bind Mod1+Control+46 sk -bind Mod1+Control+47 sl +bindcode Mod1+Control+44 sh +bindcode Mod1+Control+45 sj +bindcode Mod1+Control+46 sk +bindcode Mod1+Control+47 sl # Move (Mod1+Shift+j/k/l/;) -bind Mod1+Shift+44 mh -bind Mod1+Shift+45 mj -bind Mod1+Shift+46 mk -bind Mod1+Shift+47 ml +bindcode Mod1+Shift+44 mh +bindcode Mod1+Shift+45 mj +bindcode Mod1+Shift+46 mk +bindcode Mod1+Shift+47 ml # Move Container (Mod3+Shift+j/k/l/;) -bind Mod3+Shift+44 wcmh -bind Mod3+Shift+45 wcmj -bind Mod3+Shift+46 wcmk -bind Mod3+Shift+47 wcml +bindcode Mod3+Shift+44 wcmh +bindcode Mod3+Shift+45 wcmj +bindcode Mod3+Shift+46 wcmk +bindcode Mod3+Shift+47 wcml # Workspaces -bind Mod1+10 1 -bind Mod1+11 2 +bindcode Mod1+10 1 +bindcode Mod1+11 2 ... # Move to Workspace -bind Mod1+Shift+10 1 -bind Mod1+Shift+11 2 +bindcode Mod1+Shift+10 1 +bindcode Mod1+Shift+11 2 ... ------------------------------------------------------------- diff --git a/src/cfgparse.l b/src/cfgparse.l index a2d62e54..c343aad6 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -33,7 +33,7 @@ int yycolumn = 1; EOL (\r?\n) -%s BIND_COND +%s BINDCODE_COND %s BINDSYM_COND %s BIND_AWS_COND %s BINDSYM_AWS_COND @@ -73,7 +73,8 @@ EOL (\r?\n) [0-9a-fA-F]+ { yylval.string = strdup(yytext); return HEX; } [0-9]+ { yylval.number = atoi(yytext); return NUMBER; } mode { return TOKMODE; } -bind { BEGIN(BIND_COND); return TOKBIND; } +bind { BEGIN(BINDCODE_COND); return TOKBINDCODE; } +bindcode { BEGIN(BINDCODE_COND); return TOKBINDCODE; } bindsym { BEGIN(BINDSYM_COND); return TOKBINDSYM; } floating_modifier { BEGIN(INITIAL); return TOKFLOATING_MODIFIER; } workspace { BEGIN(INITIAL); return TOKWORKSPACE; } @@ -138,7 +139,7 @@ shift { return TOKSHIFT; } BEGIN(INITIAL); yy_push_state(BUFFER_LINE); } -[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; } +[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; } [ \t]+ { BEGIN(BINDSYM_AWS_COND); return WHITESPACE; } [ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; } [ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; } diff --git a/src/cfgparse.y b/src/cfgparse.y index 721c5698..e8818b1f 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -202,7 +202,7 @@ void parse_file(const char *f) { %token STR_NG "" %token HEX "" %token OUTPUT "" -%token TOKBIND +%token TOKBINDCODE %token TOKTERMINAL %token TOKCOMMENT "" %token TOKFONT "font" @@ -289,14 +289,14 @@ bindline: ; binding: - TOKBIND WHITESPACE bind { $$ = $3; } + TOKBINDCODE WHITESPACE bindcode { $$ = $3; } | TOKBINDSYM WHITESPACE bindsym { $$ = $3; } ; -bind: +bindcode: binding_modifiers NUMBER WHITESPACE command { - printf("\tFound binding mod%d with key %d and command %s\n", $1, $2, $4); + printf("\tFound keycode binding mod%d with key %d and command %s\n", $1, $2, $4); Binding *new = scalloc(sizeof(Binding)); new->keycode = $2; @@ -310,7 +310,7 @@ bind: bindsym: binding_modifiers word_or_number WHITESPACE command { - printf("\tFound symbolic mod%d with key %s and command %s\n", $1, $2, $4); + printf("\tFound keysym binding mod%d with key %s and command %s\n", $1, $2, $4); Binding *new = scalloc(sizeof(Binding)); new->symbol = $2; -- 2.39.2