You are not logged in.

#1 2012-06-17 18:27:52

crunchytheory
Member
Registered: 2012-03-05
Posts: 5

i3 wm config - toggle options

I'm trying to figure out how to use a shared keybinding to essentially toggle options in i3 window manager. Specifically, I want to use mod1+v to toggle between split window horizontal and split vertical. The reason for this being that the default movement keys for i3 are j,k,l,; but I changed them to more closely resemble vim with h,j,k,l (so h becomes unavailable). Anyone know how to do this?

Offline

#2 2012-06-17 19:17:11

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: i3 wm config - toggle options

I couldn't find a suitable command, so you could try to modify commands.c and compile i3wm yourself. (you can find it as i3-git in the AUR)
I think it should be something like this, although I did not get it to work yet.

/
void cmd_split(I3_CMD, char *direction) {
    if (direction[0] == 't')
        tree_split(focused, (con_orientation(focused) == VERT) ? HORIZ : VERT);

Edit: Don't forget to add the new strings to parser-specs/commands.spec:

state SPLIT:
  direction = 'horizontal', 'vertical', 'toggle', 'v', 'h', 't'

Last edited by progandy (2012-06-17 19:57:30)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2012-06-17 21:30:31

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: i3 wm config - toggle options

Do you mean that if you use mod+v to split vertically, the next time you use mod+v it splits horizontally, then vertically again? I can think of several reasons why this might not be a good idea (most notably, what if I want to split vertically twice in a row?).

You could always remap split horizontal to something that is still available -- what about mod+v splits vertical and mod+shift+v splits horizontal? (Or something similar.)

Offline

Board footer

Powered by FluxBB