The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

Different keyboard layot for every window

asked 2015-04-18 13:07:26 +0000

KirillTim gravatar image

Hello!
I'm new in i3 and I really love it more than other WMs. But I have an issue, which can be easy solved in other "gui" WMs: I want my change keyboard layout(from ru to us) keys switch layout only in active window, but not all X.
For example: I have terminal and chat. I type english in terminal, than switch to chat and have russian layout there(saved from previous typing) I've tried to google this issue, but failed. To be honest, i don't know which keywords should I use?

edit retag flag offensive close merge delete

Comments

This is probably doable, but might require quite a bit of work. You could write a script that keeps an assignment of layouts to windows, listens to [i3events](https://i3wm.org/docs/ipc.html#_events), and whenever a different windows receives focus, it changes the layout the the appropriate one.

i3convert gravatar imagei3convert ( 2015-04-20 06:02:34 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-04-24 00:05:30 +0000

gurkensalat gravatar image

updated 2015-04-26 16:57:09 +0000

As i3convert commented already, you could try this approach; depending on your chat program you need to adjust the class name. This uses the i3subscribe script which I made available some weeks ago:

#!/bin/bash
i3subscribe window | grep window:focus | \
while read -r line; do
    id="$(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}')"
    case "$(xprop -id "$id" WM_CLASS | cut -d\" -f4)" in
        Firefox)        kb=de ;;
        ChatProgram)    kb=ru ;;
        *)              kb=us ;;
    esac
    setxkbmap "$kb"
done

Save, make the script executable and put it into the startup-applications.

edit flag offensive delete link more

Comments

Invalid link to i3subscribe script. I even can't google it. Could you, please post that script here for me.

KirillTim gravatar imageKirillTim ( 2015-04-24 09:23:06 +0000 )edit
1

My post seems to have been edited incorrectly by someone, the link is now valid...

gurkensalat gravatar imagegurkensalat ( 2015-04-24 23:01:32 +0000 )edit

Link is valid, but "Not Found" is only what i can see on that page

KirillTim gravatar imageKirillTim ( 2015-04-26 08:03:34 +0000 )edit

didnt notice that one, updated:)

gurkensalat gravatar imagegurkensalat ( 2015-04-26 16:55:40 +0000 )edit

Question Tools

Stats

Asked: 2015-04-18 13:07:26 +0000

Seen: 229 times

Last updated: Apr 26