Hi Lancia. Does "setxkbmap us && slock" do what you want?


On Tue, Oct 18, 2022 at 10:23 AM Lancia Greggori
<[email protected]> wrote:
>
> Hi gentleman, as the title suggests, I need slock to automatically set the 
> keyboard layout to English because sometimes my keyboard layout is in another 
> language when slock locks the screen and this causes my typed password to be 
> rejected by slock as incorrect because it has been entered in foreign 
> characters.
>
> What I have tried so far:
>
> 1- using setxkbmap(1) with slock(1):
>
>        $ slock setxkbmap us
>       Authorization required, but no authorization protocol specified
>       Cannot open display ":0"
>
>       $ slock env setxkbmap us
>       Authorization required, but no authorization protocol specified
>       Cannot open display ":0"
>
> 2- editing slock.c and using system(3) to execute setxkbmap(1):
>
>         system("setxkbmap us");
>
>         /* everything is now blank. Wait for the correct password */
>         readpw(dpy, &rr, locks, nscreens, hash);
>
> output of slock(1):
>
>        Authorization required, but no authorization protocol specified
>        Cannot open display ":0"
>        Terminated ---> guess: caused by root using killall(1)
>
>
> I am not familiar with Xorg programming, but I am guessing there might be a 
> function or something that will set the keyboard layout to English.
>
> Can anyone kindly give me pointers or hints?

Reply via email to