davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.02k stars 609 forks source link

English as default input language #263

Open vbaruh opened 8 years ago

vbaruh commented 8 years ago

Hi there,

I started using rofi on xubuntu 14.04. Currently Alt+Tab starts 'rofi -show window'. I'm also using http://goodies.xfce.org/projects/panel-plugins/xfce4-xkb-plugin for changing current input language. It is configured to keep input language per window.

What bothers me is: If I press Alt+Tab from an application in which the current input language is Bulgarian, then rofi's input language is Bulgarian.

Expected: The input language in rofi should be English, because it is the default input language in my system and because xfce4-xkb-plugin manages language per window.

I didn't find anything helpful in the man page.

Any idea/advice ?

Thanks, Vitali

DaveDavenport commented 8 years ago

To be honest I have no idea. I never use keyboard switchers. Rofi picks whatever is configured in the system, it does not 'set' anything.. You cannot tell xfce4-xkb to use English for rofi?

I would like to get the right behavior here, but given I only ever type with English keyboard, I am unsure what this behavior is.

vbaruh commented 8 years ago

Hi Dave,

I have some updates:

  1. I played with this tool https://github.com/ierton/xkb-switch I was calling 'xkb-switch -s' us before calling rofi. Unfortunately with this approach all windows whose input language is Bulgarian before executing 'xkb-switch -s us' have English as input language after that. This does not work for me.
  2. I've made a little change in rofi.c and currently testing with it. The change is to enable the -normal-widnow for all modes, not only for -dmenu mode.

The code now looks like this:

normal_window_mode = find_arg ( "-normal-window" ) >= 0;                                                                                                        
// Dmenu mode.
if ( dmenu_mode == TRUE ) {

The problem with the input language disappeared, since rofi's windows are regular. With this approach I've managed two or three times to do something that remain an opened rofi window. If there's an open rofi window it is not possible to start another instance of rofi and I need to kill it or to activate it with the mouse and close it. Since I'm working with in this mode for a day I cannot say what is the action that leads to this state.

I'll come back in several days to share experience, but I think this mode will work for me.

Can I ask what is the reason to state that -normal-mode is experimental? I'm also wondering why it is valid only for the -dmenu mode?

Thanks, Vitali

DaveDavenport commented 8 years ago

the -normal-mode turns rofi into a normal window, instead of a popup dialog.

The reason this is only allowed in dmenu mode is that with the other modes things can go out of sync. (mostly window list). Rofi indeed has a pid file to avoid multiple copies, you can however give multiple instances different pid files.

I will not make normal-mode available for non-dmenu use, we need to figure out what to set so it is picked up as a independent applicaiton with it own xkb setting.

vbaruh commented 8 years ago

I have some updates:

  1. I'm happy with my current set up - thanks for the -pid tip, I tweak that too
  2. I agree that my solution is not the right one and I dug a little bit in the source code of xfce-xkb-plugin. I found that the plug-in handles the "active-window-change" signal and then it does its all work -> to change the layout remembered for the newly activated window. Since I don't have any experience in writing apps for X, I asked about thi the author of xfce-xkb-plugin who I'm happy to be friend with.

And what he told me is that xfce-xkb-plugin uses XFCE (Wnck* something) library for handling windows events, it does not use native X API events. And he supposed that probably the window created by rofi is not managed by the XFWM manager...

and because of all these facts there's no event triggered when rofi's window is created from xfce-xkb-plugin point of view. probably this is the root cause of the problem.... now I'm not sure if this is a rofi's or xkfce-xkb-plugin's issue :)

DaveDavenport commented 8 years ago

I don't think it is a problem of either, just a side effect of how thing works. (rofi is indeed an unmanaged window, this is normally what you want in this type of app..)

I want to get this fixed, but I have to little experience with this part. When I have more time later I will investigate.

vbaruh commented 8 years ago

Sure. Whenever you have something for testing ping me - I can help on this side.

DaveDavenport commented 8 years ago

We changed a lot regarding keyboard handling and fixed some locale's bug. Can test and see the current state?

kshpytsya commented 8 years ago

This is still an issue with v1.2.0 (I have English and Ukrainian layouts). If it matters, I use "i3" as WM and "xxkb" for per window layouts.

.xxkbrc: XXkb.image.path: /usr/share/xxkb/ XXkb.mainwindow.type: tray XXkb.group.base: 1 XXkb.group.alt: 2 XXkb.mainwindow.enable: yes XXkb.mainwindow.geometry: 20x20+0+0 XXkb.mainwindow.image.1: en.svg XXkb.mainwindow.image.2: ua.svg XXkb.mainwindow.appicon: no XXkb.button.enable: no XXkb.controls.add_when_start: yes XXkb.controls.add_when_create: yes XXkb.controls.add_when_change: no XXkb.controls.focusout: no XXkb.mainwindow.label.enable: no

sardemff7 commented 7 years ago

Is this issue still there in latest release? And in master? (And if yes to both, could you try wip/wayland built with --with-display-backend=xcb)

vbaruh commented 7 years ago

Hi again,

I cannot say is the issue is there for the latest release or master. In the past when I was with xubuntu 14 I tried to build and install rofi (two different weekends long time ago), unfortunately without success. I've just got migrated my machine on xubuntu 16 and again I have troubles to build rofi, version 1.3.1. The problem with the build is missing libraries. I can't remember what ware the missing libraries for xubuntu 14, now I'm having problem with xcb-xrm. I just tried to build xkb-xrm and it didn't go smoothly and I'm giving up for now.

Otherwise I'm still using rofi, the version that comes from official ubuntu 16 repos - v 0.15.11. With this version the issue is still there, but this time I managed to workaround it with a wrapper that calls xkb-switch (https://github.com/ierton/xkb-switch) before rofi. I'm not using rofi in daemon mode, but still I'm happy to use it as simple launcher and window switcher.

Vitali

itspec-ru commented 5 years ago

Hi! @vbaruh I use i3 WM. Binding in my config for i3 for run rofi:

bindsym $mod+d exec "layout=$(xkb-switch -p); xkb-switch -s us; rofi -theme bw -modi run,drun -show run -show-icons; xkb-switch -s ${layout}"

I save layout before run rofi: layout=$(xkb-switch -p); Set layout to "us": xkb-switch -s us Run rofi: rofi -theme bw -modi run,drun -show run -show-icons; Restore layout to initial state: xkb-switch -s ${layout}".

That's what you need?

g--o commented 4 years ago

i think a much more reasonable approach would be for rofi to stop eating modifier keys and let me switch the keyboard layout or anything else i want to do

ilyachch commented 3 years ago

maybe there is some option to make ignore list of keybindings, that should be passed to system and not been eaten by rofi?

DaveDavenport commented 3 years ago

@sardemff7 any input on this?

sardemff7 commented 2 years ago

From the top of my head, I’d say doing that involves grabbing only our bindings, instead of the full input It would be a pretty big rework of the bindings stack I think There may be a simpler solution but I would need to think about it further Do not expect a solution any time soon but please keep hope :-)

Kzer-Za commented 1 year ago

Perhaps, this advice could be copied into documentation or FAQ? It saves a lot of trouble for me as a user of 2 keyboard layouts.