f0s3 / i3-autokeymap

Don't think about switching between layouts when switching to another workspace. Let this app do it for you.
2 stars 3 forks source link

IndexError: list index out of range #13

Open zenny opened 4 years ago

zenny commented 4 years ago

Hi,

@f0s3 Thanks for useful script, but didn't work at my end with the following error :(

~/.config/i3-autokeymap]$ python3 keymap.py
Traceback (most recent call last):
  File "keymap.py", line 38, in <module>
    if shell("xkblayout-state print %s") != config["workspaces"][currentWorkspace][currentWorkspace]:
IndexError: list index out of range

I have the following in the config.json:

[zenny@MACHINE-GA-970A-D3 ~cf/i3-autokeymap]$ cat config/config.json 
{ 
        "workspaces": [ 
                { 0: "eu" }, 
                { 1: "eu" }, 
                { 2: "eu" }, 
                { 3: "eu" }, 
                { 4: "eu" }, 
                { 5: "us" }, 
                { 6: "np" }, 
                { 7: "de -variant bone" }, 
                { 8: "ru" } 
        ], 
        "programs": [ 
                { "dmenu": "us" }, 
                { "i3lock-fancy": "us" }, 
                { "i3lock": "us" } 
        ] 
} 

I need to install 'bonevariant of German keyboardde. However, specifying basicde` layout gave same error, too, fyi.

Any clue?

Cheers, and stay safe, /z

zenny commented 4 years ago

An Update: the error is with i3blocks, but with i3status as a bar, there is no error, yet the keyboard layout did NOT switch even under i3status without errors! Hmmmmm.... Thanks!

The keymap.py dies with the following error when moved to workspace 7:

$ cd ~/.config/i3-autokeymap && python3 keymap.py
Traceback (most recent call last):
  File "keymap.py", line 39, in <module>
    os.system("xkblayout-state set {}".format(layoutOrder[config["workspaces"][currentWorkspace][currentWorkspace]]))
KeyError: 'de'

The process dies with same error when moved to workspaces 5 (us), 6 (np) and 8 (ru), fyi.

However, setxkbmap de or setxkbmap de -variant bone works as it should! So it has to do with this script.

f0s3 commented 4 years ago

@zenny I will look into that, thanks.

f0s3 commented 4 years ago

@zenny Let's try to gather some info about that. Please git checkout 13-implement-error-logging and run the application from cli. Reproduce the issue (list index out of range). You should be able to see logs before exception is thrown. I need those.