Rename bind to bindcode

Also fallback when using just 'bind' to be backward-compatible
This commit is contained in:
Sardem FF7 2011-04-18 23:06:32 +02:00 committed by Michael Stapelberg
parent 84b804cda6
commit cd6f93be3f
4 changed files with 50 additions and 49 deletions

View File

@ -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

View File

@ -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
...
-------------------------------------------------------------

View File

@ -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)
<COLOR_COND>[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);
}
<BIND_COND>[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; }
<BINDCODE_COND>[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; }
<BINDSYM_COND>[ \t]+ { BEGIN(BINDSYM_AWS_COND); return WHITESPACE; }
<BIND_AWS_COND>[ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; }
<BINDSYM_AWS_COND>[ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; }

View File

@ -202,7 +202,7 @@ void parse_file(const char *f) {
%token <string>STR_NG "<string (non-greedy)>"
%token <string>HEX "<hex>"
%token <string>OUTPUT "<RandR output>"
%token TOKBIND
%token TOKBINDCODE
%token TOKTERMINAL
%token TOKCOMMENT "<comment>"
%token TOKFONT "font"
@ -289,14 +289,14 @@ bindline:
;
binding:
TOKBIND WHITESPACE bind { $<binding>$ = $<binding>3; }
TOKBINDCODE WHITESPACE bindcode { $<binding>$ = $<binding>3; }
| TOKBINDSYM WHITESPACE bindsym { $<binding>$ = $<binding>3; }
;
bind:
bindcode:
binding_modifiers NUMBER WHITESPACE command
{
printf("\tFound binding mod%d with key %d and command %s\n", $<number>1, $2, $<string>4);
printf("\tFound keycode binding mod%d with key %d and command %s\n", $<number>1, $2, $<string>4);
Binding *new = scalloc(sizeof(Binding));
new->keycode = $<number>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", $<number>1, $<string>2, $<string>4);
printf("\tFound keysym binding mod%d with key %s and command %s\n", $<number>1, $<string>2, $<string>4);
Binding *new = scalloc(sizeof(Binding));
new->symbol = $<string>2;