Re: [hackers][slock] making slock set the keyboard layout to English before locking the screen

2022-10-19 Thread Lancia Greggori
Hi, yes, thank you very much, I apologize for such a seemingly simple
solution flying over my head.

Also thanks to Augusto Castelo for responding and giving me insight about
how slock works.

On Wed, Oct 19, 2022 at 11:40 AM Daniel Littlewood <
danielittlew...@gmail.com> wrote:

> Hi Lancia. Does "setxkbmap us && slock" do what you want?
>
>
> On Tue, Oct 18, 2022 at 10:23 AM Lancia Greggori
>  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?
>
>


Re: [hackers][slock] making slock set the keyboard layout to English before locking the screen

2022-10-19 Thread Daniel Littlewood
Hi Lancia. Does "setxkbmap us && slock" do what you want?


On Tue, Oct 18, 2022 at 10:23 AM Lancia Greggori
 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?



Re: [hackers][slock] making slock set the keyboard layout to English before locking the screen

2022-10-18 Thread Augusto Castelo
Hi,

I think the problem is that the post-lock command runs as nobody​, when 
modifying slock you should run setxkbmap us​ before dropping privileges (before 
line 349 on an unpatched version).

Cheers!

[hackers][slock] making slock set the keyboard layout to English before locking the screen

2022-10-18 Thread Lancia Greggori
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?