swaywm / swaylock

Screen locker for Wayland
MIT License
851 stars 202 forks source link

issue #262

Closed notwidow closed 10 months ago

notwidow commented 2 years ago

Hi, When i enter wrong password at first attempt then on second attempt after corect password. My terminal is still on the swaylock command. I have an alias which execute swaylock with my config. so when i type swaylock alias in terminal and then if the 1st attempt is not correct then on 2nd attempt it unlocks but my cursor still stuck on the swaylock command . i have to press ctrl+c to start another command. IMG20221121120525

smlx commented 2 years ago

What is the alias?

notwidow commented 2 years ago

What is the alias?

the alias activate swaylock from my config in ~/.config/sway/scripts/lockscreen

notwidow commented 2 years ago

What is the alias?

i keep all the sway config in ~/.config/sway so i just need to copy sway in ~/.config in new OS and run the shell script which install the required packages... but recently i added the command in my script which will automatically copy sway to .config and all done. I love shell scripts and automate my work with it. EDIT my alias name if you want is.

sl

which executes the lockscreen file

notwidow commented 2 years ago

What is the alias?

a tip for you. whenver write a shell script always write in shell and not bash or zsh etc. why? because bash is not installed in every os by default like openbsd but sh is installed in all unix os and your script will work in every unix -like os. !#/bin/sh

SpectralFlame commented 1 year ago

It's not actually "stuck" on the swaylock command, it just looks that way because it was run in detached mode by passing the -f or --deamonize flag. Check if this is the case for you by typing alias sl in your terminal.

You could still run any command just fine even though it does not look that way:

➜  ~ swaylock -f
➜  ~ 2023-02-09 15:28:49 - [swaylock-1.7.2/pam.c:105] pam_authenticate failed: invalid credentials
echo "test"
test
➜  ~

Running swaylock without the flag would result in the output you'd expect:

➜  ~ swaylock
2023-02-09 15:30:39 - [swaylock-1.7.2/pam.c:105] pam_authenticate failed: invalid credentials
➜  ~ echo "test"
test
➜  ~

I am not sure what the desired behavior of a detached process is so I don't know if this is an issue or not. I can think of three behaviors:

  1. Do not print to the terminal since it was detached from it
  2. Print to the terminal disregarding where it is being printed (current behavior)
  3. Print to the terminal on its own line, i.e. nicer output (not sure if this is possible if detached?)

Personally I would expect behavior 1.

emersion commented 10 months ago

If you want swaylock to block, yeah, you need to use the -f flag. I think it's reasonable to still print any error message to stderr even if detached.