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

Can I bind keys conditionally, based on the container layout?

asked 2014-10-31 14:50:28 +0000

jon.reeve gravatar image

updated 2014-10-31 17:52:49 +0000

I'd like to bind Super+J and Super+K to cycling through tabs in a tabbed container, but maintain the function of Super+J and Super+K for focusing containers that aren't tabbed. So basically it's something like this (pseudo code):

if the layout of the currently focused container is tabbed: 
  bind Super+J to focus right
  bind Super+K to focus left
otherwise: 
  bind Super+J to focus down
  bind Super+K to focus up

Is there a way to do this? Basically I'd like to have the bindings that worked for stacked layouts, but maintain the appearance of tabbed layouts.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-11-20 23:56:25 +0000

teto gravatar image

This should be possible through the IPC. A python/lua wrapper can identify the layout of the current option via IPC, then it can send the appropriate command via IPC as well.

github.com/acrisci/i3ipc-glib has bindings for several languages.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-31 14:50:28 +0000

Seen: 492 times

Last updated: Nov 20 '14