The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Execute an .sh file using bindsym

asked 2014-06-11 22:07:09 +0000

anonymous user

Anonymous

updated 2014-06-12 06:38:28 +0000

Adaephon gravatar image

Hello. In .i3/config I have wrote this:

set $alt Mod1
bindsym $alt+Shift ~/.i3/lang_change.sh

and it returns this error when im trying to restart i3

Syntax error, unexpected <string>,expecting <number> or <word> or '+'

in file ...../.3/config, line 22

bindsym $alt+Shift ~/.i3/lang_change.sh

How can i execute that script when ALT+SHIFT is pressed ?

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-06-12 01:25:12 +0000

triplc gravatar image

updated 2014-06-13 01:51:39 +0000

As per suggestion from Adaephon:

You have to use exec in order to bind external commands:

bindcode Shift+64   exec /home/yourname/.i3/lang_change.sh

or

bindcode Mod1+50    exec /home/yourname/.i3/lang_change.sh

or

bindcode Mod1+62    exec /home/yourname/.i3/lang_change.sh
edit flag offensive delete link more

Comments

This fixes the error. But it will still not work, because you cannot bind modifier keys (Shift, Control, Alt, Super) by their keyboard symbol. [You have to use the keyboard codes in that case.](https://faq.i3wm.org/question/2854/keybinding-for-the-both-shifts-keys/?answer=2861#post-id-2861)

Adaephon gravatar imageAdaephon ( 2014-06-12 06:55:16 +0000 )edit

Hmm doesn't work with this solution and returns 'unexpected <modifier> Mod41+Shift exec /home/yourname/.i3/lang_change.sh' Mod41 occurs because it is $mod is set on Mod4.

F.N gravatar imageF.N ( 2014-06-12 06:59:04 +0000 )edit

So with xmodmap -pke | grep Alt , i saw that the keycode of Alt_L Meta_L is 64. Then i wrote this in config but still has a problem with the + symbol. bindcode 64+Shift exec /home/me/.i3/lang_change.sh

F.N gravatar imageF.N ( 2014-06-12 07:13:38 +0000 )edit

With `bindcode` only the last key is given by its code, modifiers for this key are still given by their name (`Mod1`, `Mod4`, `Shift`, `Control`). So Alt+Shift (hold Alt, then press Shift) has to be written as `Mod1+50` (Shift_L) and/or `Mod1+62` (Shift_R). `Shift+64` would be hold Shift, press Alt.

Adaephon gravatar imageAdaephon ( 2014-06-12 07:49:40 +0000 )edit

Thank you.Now it works.

F.N gravatar imageF.N ( 2014-06-12 08:08:07 +0000 )edit

Question Tools

Stats

Asked: 2014-06-11 22:07:09 +0000

Seen: 579 times

Last updated: Jun 13 '14