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

Why can't I use Alt/Mod1 for bindings?

asked 2015-10-30 03:50:19 +0000

beanaroo gravatar image

updated 2015-10-30 03:51:15 +0000

I would like the following functionality:

bindsym --release Print exec --no-startup-id scrot -z
bindsym --release Mod1+Print exec --no-startup-id scrot -zu
bindsym --release Shift+Print exec --no-startup-id scrot -zs

Lines 1 and 3 work as expected.

Line 2 does nothing.

I have tried using bindcodes instead. I have also double-checked checked xev and xmodmap outputs.

Am I doing something wrong?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-10-30 14:46:19 +0000

Adaephon gravatar image

updated 2015-11-16 12:37:11 +0000

There are two likely causes for this issue:

i3 internal: Since version 4.11 (at least in some cases) the key symbols used with bindsym need to be the ones that X recognizes when the given Modifiers are pressed. In your case with Alt+Print that means you have to actually use

bindsym Mod1+Sys_Req exec --no-startup-id scrot -zu

Because the key symbol of the Print key is actually Sys_Req when when Alt is pressed.


Kernel configuration: It is also possible that the MAGIC_SYSRQ configuration option is enabled in your Linux kernel. Depending on your distribution and kernel configuration, you may be able to check this with one of these lines:

grep CONFIG_MAGIC_SYSRQ /boot/config*
zgrep CONFIG_MAGIC_SYSRQ /proc/config.gz

With this option enableMod1+Print is caught by the kernel as part of the Magic System Request Keys, which all follow the pattern Alt+Print+[b-z0-9].

As it is caught by the kernel itself, the only thing you could do, would be to use a kernel that has this option disabled or disable it temporarily (until next boot) with sysctl -w kernel.sysrq=0. (Credits for the sysctl-workaround go to beanaroo)

edit flag offensive delete link more

Comments

Oh, cool! You are spot on. I knew they existed but never bothered learning about it. Thanks for the link. Curious how GNOME catches the key combo first.

beanaroo gravatar imagebeanaroo ( 2015-11-15 23:27:04 +0000 )edit

Hmmm. Looks like I was too hasty. I have tried `sudo sysctl -w kernel.sysrq=0` as well as a kernel with it disabled. `Mod1+Print` just doesn't work in i3. It does work with xbindkeys, however.

beanaroo gravatar imagebeanaroo ( 2015-11-16 00:42:49 +0000 )edit

Thank you for the update. It is confusing because xev and xbindkeys report Print as Print when Alt is pressed but as you say, changing the bindsym to `Mod1+Sys_Req` creates the expected behaviour and solves the issue. I really appreciate your assistance.

beanaroo gravatar imagebeanaroo ( 2015-11-18 09:18:17 +0000 )edit

Strange, on my machine `xev` reports Print as Sys_Req when Alt is pressed, which actually reminded me of the recent change. Checking the source repository of xev does not reveal any (obvious) changes that would explain this. But as long as it works now, I am glad I was able to help.

Adaephon gravatar imageAdaephon ( 2015-11-19 01:09:34 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-30 03:50:19 +0000

Seen: 160 times

Last updated: Nov 16