r/i3wm•
Floofkitty

Can you still use emacs when using the mod key for i3?

Emacs doesn't accept any alt+ commands since I switched i3's main key to alt. Is there anyway to fix this without changing the key on i3 or emacs? Also, when I restart my PC and login, i3 mirrors my displays, I have to re login to stop the mirroring, any ideas?

Posted Feb 12, 2016, 4:44 PM UTC

16
sorennordstrom•

Have to use different modifier keys, not really any getting around that. Try arandr for your display issue. Save the configuration and put it in your .xinitrc. My config is called default, so in my xinitrc I would have ".screenlayout/default.sh &".

2
ManusX•

I used Xmodmap to just remap the Alt and Windows keys. Now when I press the physical Alt_L-Button X gets a Super_L key event and also the other way around. I did this because on my ergonomic keyboard alt is super mega duper convenient - so I wanted to use it as a modifier for i3. On the other hand I didn't want to 'lose' the Alt key, though I rarely use it.

Add

!Swap Windows (Super_L) with Alt_L
remove mod1 = Alt_L
remove mod4 = Super_L
add mod1 = Super_L
add mod4 = Alt_L

to your .Xmodmaprc or create it (~/.Xmodmaprc) and then just run Xmodmap ~/.Xmodmaprc

...or you could just use Super (aka "the windows key") as modifier.

2
Adaephon-RArch•

You could use a separate mode in i3. While inside a mode only the key bindings defined there work. So if you just set one key binding to leave the mode, you can use any other key combination for Emacs.

For example:

mode "passthrough" {
    bindsym Mod1+Alt_L mode "default"
}
bindsym Mod1+Alt_L mode "passthrough"

This will (at least on a US layout) enter the mode passthrough when pressing Left Alt while holding Right Alt (or any other key that produces Mod1). While in that mode you can use both Alt keys for any key combinations. Of course with the exception of Alt_R + Alt_L which will switch back to default mode.

This could even expanded to utilize i3 IPC in order to recognize whether Emacs is the currently active window and switch modes automatically.

2
FloofkittyOP•

This is exactly what I was looking for :D

1
EllaTheCat•

Try xcape. Sorry for terse post.

1
jwaldreparch•

Also, when I restart my PC and login, i3 mirrors my displays, I have to re login to stop the mirroring, any ideas?

I think this is the Xorg default. An efficient solution is to put an xrandr command in your .xinitrc.

Also, shameless plug for an xrandr-dmenu script I wrote (although that won't help you on startup).

1