elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.37k stars 382 forks source link

[FEATURE] Keyboard Navigation #997

Open Natr1x opened 10 months ago

Natr1x commented 10 months ago

Description of the requested feature

I think there should be some way to make focusable windows/widgets navigable with key events.

Proposed configuration syntax

I am unsure what would be the simplest way to implement this feature. Maybe add an optional :focusid <nr> or :focuscoord "<x> <y>" and then add eww focus <window> <id/coord> and eww movefocus <direction> [<direction>...].

The reason for having a :focuscoord with x and y coordinates instead of just a :focusid is that it would allow two dimensional directions for eww movefocus but it's also more work which could probably be handled by some user script.

eww movefocus could probably also be left to the user to implement.

Focusing something in a window would not necessarily have to actually take the focus in the actual window manager. It would only be a way to tell the eww window that a widget has "focus" for the purposes of css and tooltips. Actually interacting with the widget could probably be handled with existing commands like eww update.

If this feature is implemented this way it may also be desirable to add a :onkey and :capturekey property to eventbox or directly on the window. For the purposes of capturing arbitrary keypresses. (:capturekey if key event should not be propagated to the children of the eventbox).

Additional context

I would like to be able to build menus for things like selecting wifi network, audio output, etc, but I don't see much point if it will always be faster to just open up a terminal and typing whatever command I need to run.

So I would like the buttons in my eww-bar to be navigable with vim keys. Something that I can focus with a keybinding in my window manager.

LelouBil commented 8 months ago

+1 I just built a powermenu with eww and it would be great if I could focus and press buttons with keyboard navigation