wmfocus icon indicating copy to clipboard operation
wmfocus copied to clipboard

Feature discussion: Window functions

Open CMJones001 opened this issue 3 years ago • 4 comments

I'd like to add the ability to run more complex functions on the selected windows, inspired by the Emacs packages avy and ace-window.

In short, in addition to the list of hint characters,sadfjklewcmpgh, there is also some (user configurable) HashMap of functions acting on the window, for example, {"x": wm::WindowCommand::Kill, "F": wm::WindowCommand::FloatToggle}. Then pressing the key d would jump to window d as usual, but xd would instead kill window d.

I've got a basic implementation of this working, if you're interested in a pull request?

CMJones001 avatar Jun 05 '22 08:06 CMJones001

I think that'd be rather cool if you can come up with a generic solution.

svenstaro avatar Jun 05 '22 09:06 svenstaro

I don't get why this is better than configuring kill and float and whatever else in your i3 config and just using wmfocus to choose the window.

plurry avatar Jul 06 '22 09:07 plurry

Mostly action economy, with this approach the window action can be performed with a single extra key, instead of: launch wmfocus; select window; run i3 kill command and launching wmfocus again to jump back to the original window.

CMJones001 avatar Jul 07 '22 13:07 CMJones001

I dunno.

You could make a binding mode and put your single key actions there, with i3-msg and [id=$(wmfocus -p)] to perform them. I guess you'd lose focus being the default action, but I bet there's even a way to set that up too.

Or if kill and float are really all you need, you could just give them their own dedicated shortcuts without even entering a binding mode.

But it's not like kill and float are the only cool verbs. Almost all the i3 window commands make sense in this context, and some of them have a more complicated syntax. If wmfocus starts trying to implement them, there would soon be so many options that there should be a file somewhere to save them in.

Which is what i3's config file already is. And leaving that to i3 lets wmfocus do its one thing and do it well.

plurry avatar Jul 08 '22 09:07 plurry