The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

API for fetching bindings, assignments, etc.?

asked 2015-05-01 23:59:57 +0000

GenghisKen gravatar image

Are there plans to extend the API to allow retrieving the current keybinding, 'assign' directives, etc.? In other words, recover all aspects of i3's configuration from the ~/.i3/config file and any subsequent changes made through i3-msg and friends?

If there aren't, would this be a non-goal? Or something that could be submitted?


edit retag flag offensive close merge delete



I'm not an i3 developer, but I would tend to think that this would be a lot of effort for an unclear goal. What would your application of this kind of feature be? Perhaps we can suggest other solutions?

i3convert gravatar imagei3convert ( 2015-05-02 00:27:30 +0000 )edit

It is not possible to change any of *i3's* configuration options with `i3-msg`. With the exception of `i3-msg reload` and `i3-msg restart` of course, but that just loads the settings from the configuration file. So you really could only retrieve the settings that are in the config file anyway.

Adaephon gravatar imageAdaephon ( 2015-05-02 01:56:07 +0000 )edit

Retrieval is all I want at this point. And I'd rather not re-invent the parser since it's already been done.

GenghisKen gravatar imageGenghisKen ( 2015-05-04 19:13:55 +0000 )edit

1 answer

Sort by » oldest newest most voted

answered 2015-05-02 12:56:42 +0000

Airblader gravatar image

There are no set goals for this, but that is because i3 doesn't have a roadmap at all. i3 is contribution-driven, so you can suggest features and either implement them yourself or wait for someone else to do it (assuming they will be accepted).

A few weeks ago we were talking about an issue and it came up that we could add a message type to retrieve the current bindings. Michael stated that he'd be open to that. So at least that would very likely be merged. For any other information you want through the IPC, I suggest opening a feature request on github and see what the feedback is.

However, you should have usecases in mind (and explain them). We won't be adding features on the off-chance that they might be useful some day in the future.

Also note that most changes that are done through i3-msg (or any other IPC implementation) only affect the tree and not the configuration. So querying the tree will already give you a ton on information about the current state. So again, please explain your usecases for this – and also what informaiton exactly you would need.

edit flag offensive delete link more


Reasonable enough. :-) (Whoa, character limit!) Scripting for dock/undock/variable-output situations; recovery of settings if `.i3/config` is lost, *etc.*. I'm scripting with ERB and a YAML file updated whenever `xrandr` outputs change.

GenghisKen gravatar imageGenghisKen ( 2015-05-04 19:26:22 +0000 )edit

Sorry, I meant describe usecases when filing the feature request. I don't think "I lost my config file at runtime and need to recover it from the running session" is a usecase, though. Just back up your config.

Airblader gravatar imageAirblader ( 2015-05-04 21:28:15 +0000 )edit

For the scripting part I don't quite understand why you need to recover information from i3? And either way, I think it's fairly unlikely that you will have the ability to receive *all* config directives through the IPC anytime soon. I really don't quite understand your usecase yet, though.

Airblader gravatar imageAirblader ( 2015-05-04 22:16:45 +0000 )edit

Question Tools

1 follower


Asked: 2015-05-01 23:59:57 +0000

Seen: 49 times

Last updated: May 02