That was helpful! The first variant works (custom binding) works as
expected. The second (via signal handling) doesn't because `menubar.get()`
returns a `menu` object, not a `wibox`. And `menu` only has two signals:
mouse::enter and mouse::leave.

I'm also thinking about xxkb which can remember layout for each window and
switch it when the corresponding window is focused. It can filter windows
by WM_CLASS and WM_NAME. I suppose the menubar is also a window.
Unfortunately it doesn't seem to have WM_CLASS or WM_NAME set according to
xprop.

I think I'll just stick with a custom keybinding for modkey+p for a time.

On Wed, Jul 24, 2013 at 12:07 PM, Zsolt Udvari <[email protected]> wrote:

> Hi Ivan,
>
> maybe you can create a keybinding with following:
>
> awful.key({...},"M",function ()
>     change_keyboard_layout_to_english()
>     menubar.show()
> end)
>
> But it has a disadvantage: after closing menu your keyboard layout
> doesn't change to previous layout.
>
> But you can use menubar.get [1] function to get menubar wibox so you
> can add a signal to visible property [2].
>
> I hope it helps you.
>
> [1]: https://awesome.naquadah.org/doc/api/modules/menubar.html#get
> [2]: https://awesome.naquadah.org/wiki/Signals#wibox
>
> 2013/7/24 Ivan Osadchii <[email protected]>:
> > Hi everybody,
> >
> > I'm trying to make awesome's menubar always use english keyboard layout
> and
> > I'm stuck. I need this because:
> >
> > 1) I don't remember myself ever using the alternative layout in the
> menubar
> > 2) Having to switch layout to simply launch an application is irritating
> > 3) This would possibly allow me to workaround this nasty bug
> > https://awesome.naquadah.org/bugs/index.php?do=details&task_id=982
> >
> > If you have any ideas, please share. Thanks!
>

Reply via email to