i3 / i3lock

improved screen locker
https://i3wm.org/i3lock
BSD 3-Clause "New" or "Revised" License
920 stars 404 forks source link

i3lock should show the green circle when user presses shift, or control, or other non-input characters #309

Closed ThomasHabets closed 2 years ago

ThomasHabets commented 2 years ago

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Other (Please describe in detail)

Current Behavior

When my screen is turned off, or even when in suspend mode, I come back to my desk after lunch and press shift and/or control a few times until the screen wakes up.

i3 doesn't react to this, and keeps the screen blank.

Expected Behavior

With every screensaver in the world, except i3lock, something is shown on the screen to indicate what's happening. Even swaylock, the i3lock of Wayland (Sway), shows "the login box" (green circle) in this case.

The reason I do this is that I don't want to start typing my password before I see that the screen is actually locked. I have been surprised in the past where the screen wasn't actually locked, and instead I'd typed my password into IRC.

Modern web apps send keystrokes immediately, and e.g. with Google Docs if I type my password "in the blind" it would be stored in the doc's history forever.

Reproduction Instructions

  1. Suspend laptop (with i3lock running).
  2. Click shift or control.
  3. Laptop unsuspends, but screen remains black
  4. Press space, now i3lock shows that it's active
  5. Press backspace, because password doesn't start with space

Environment

Output of i3lock --version:

i3lock: version 2.13 © 2010 Michael Stapelberg
stapelberg commented 2 years ago
  • Laptop unsuspends, but screen remains black

This sounds like a problem with your laptop, driver or setup. When my laptop unsuspends, the screen comes back on. I have always seen the screen come back on like that.

  • Press space, now i3lock shows that it's active

You can also press backspace instead to not modify the password buffer, but still get i3lock to show a “no input” indicator.

This should be sufficient for your use-case, right?

ThomasHabets commented 2 years ago

Maybe I used the wrong term. It remains black, but clearly with the backlight on, and pressing space or backspace does make i3lock start drawing things.

Backspace has part of the same problem that pressing any other key does. If i3lock is not running then I just started editing a document or something.

The benefit of pressing control of shift, aside from working in every other operating system and screensaver I've used, is that if the lock is not running then it's a no-op.

And it's a bit frustrating when something that has had these objective benefits, and has worked across everything for at least 30 years, doesn't work here. Or iow "I'm old, don't tell me 'you're holding it wrong'". :-)

stapelberg commented 2 years ago

Maybe I used the wrong term. It remains black, but clearly with the backlight on, and pressing space or backspace does make i3lock start drawing things.

Is this some weird DPMS setting you’re using or something like that?

I don’t recognize the behavior.

Backspace has part of the same problem that pressing any other key does. If i3lock is not running then I just started editing a document or something.

Yeah, but at least it’s easy to correct and doesn’t leak any info.

The benefit of pressing control of shift, aside from working in every other operating system and screensaver I've used, is that if the lock is not running then it's a no-op.

Agreed, pressing shift is elegant in that it doesn’t modify state (well, unless you press both shift keys, or hold them pressed, or possibly other combinations I don’t know).

At the same time, pressing shift should already show your screen, even without i3lock changing what it displays. I honestly don’t know why this doesn’t happen for you, I would certainly expect it. But I would also expect your screen to be visible without pressing any button…

To be clear, I’m not necessarily opposed to making i3lock display a message on modifier keys, but I’m not convinced it’s a good idea (and how to best implement it without confusing users) either. Currently, your argument has strong https://xkcd.com/1172/ vibes to me :)

ThomasHabets commented 2 years ago

Is this some weird DPMS setting you’re using or something like that?

Are you saying that pressing shift should make i3lock draw the circle? If not then there's no mystery. Black is just the background color.

Currently, your argument has strong https://xkcd.com/1172/ vibes to me :)

Heh. I hear it. And while "everyone else does it" is on its own not a good argument, there's something to be said for consistency.

And just showing any kind of feedback at all that yes, my keyboard is connected, and yes, the screensaver heard you, has value.

orestisfl commented 2 years ago

Black is the background color of i3lock? If yes, then you can set it to a slightly different color and you will be able to distinguish it from an unlocked state. If no, then your screen is still turned off and it's the job of xdpms to wake it up, not i3lock.

When I press Ctrl or shift my screen wakes up.

The indicator is useful to indicate the state of the password buffer. When it changes position a character had changed and when it doesn't show, the buffer is empty. To react on shift without a character would be misleading.

ThomasHabets commented 2 years ago

Black is the background color of i3lock? If yes, then you can set it to a slightly different color and you will be able to distinguish it from an unlocked state.

I can, but that's not the problem.

When I press Ctrl or shift my screen wakes up.

Like I said: Same here. But i3lock is not showing anything.

The indicator is useful to indicate the state of the password buffer.

How so? All it shows is an indicator that a key is pressed. It doesn't even reliably show if the password buffer is empty or not (e.g. pressing just space and then backspace will show a green circle for a bit even if the password buffer is empty).

Why not show for shift/control the same thing as pressing space followed by backspace? It's the same state.

orestisfl commented 2 years ago

I can, but that's not the problem.

Well, it is. You can't distinguish between the color of i3lock and your screen.

How so? All it shows is an indicator that a key is pressed. It doesn't even reliably show if the password buffer is empty or not (e.g. pressing just space and then backspace will show a green circle for a bit even if the password buffer is empty).

for a bit being the key word here

Why not show for shift/control the same thing as pressing space followed by backspace? It's the same state.

because the buffer has not changed.

ThomasHabets commented 2 years ago

Well, it is. You can't distinguish between the color of i3lock and your screen.

You're essentially telling me "your favourite colour is wrong". I don't think it's productive for you to say "you're holding it wrong".

for a bit being the key word here

How so? It's literally the exact same state. A key was pressed, the password buffer is empty => green circle for a bit.

because the buffer has not changed.

That's just defining the state to be what you have already decided according to current behaviour.

Look, if you're going to just make things up backwards working from the conclusion, then just say so. I have given examples of where this is a problem, and you have replied "yeah, well personally I don't care about stray keypresses going to the wrong app, possibly triggering "suggested edit" emails going out to a bunch of people, therefore no". And not only do you not care, you actively want the surprising behaviour that no other screensaver does. Which is fine. You're all doing this for free. But what you're doing now feels more like trolling than saying no.

Yeah, but at least [a backspace edit is] easy to correct and doesn’t leak any info.

@stapelberg to answer this: as you know, sometimes a backspace suggested edit sends emails. Sometimes they're not detected, and until the owner notices and rejects the edit, it's there forever.

Airblader commented 2 years ago

i3lock also supports background images. If you go that route, you can have a black background and just some visual indicator in the center (or anywhere else, like in the corner). That's no different from i3lock's indicator showing up, so it should basically tick all of your boxes.

orestisfl commented 2 years ago

You're essentially telling me "your favourite colour is wrong". I don't think it's productive for you to say "you're holding it wrong".

Productive or not, you can't expect the tool to adapt to your specific needs. i3lock provides ample opportunities to avoid shooting yourself in the foot in this case.

That's just defining the state to be what you have already decided according to current behaviour.

I am saying the behavior is intentional. A buffer change makes the indicator rotate, an empty buffer clears the indicator.

Look, if you're going to just make things up backwards working from the conclusion, then just say so. I have given examples of where this is a problem, and you have replied "yeah, well personally I don't care about stray keypresses going to the wrong app, possibly triggering "suggested edit" emails going out to a bunch of people, therefore no". And not only do you not care, you actively want the surprising behaviour that no other screensaver does. Which is fine. You're all doing this for free. But what you're doing now feels more like trolling than saying no.

Then provide a backwards-compatible suggestion. Your suggestion breaks my workflow and I assume others' workflow as well.

Also, I don't see how you can send an email? If the screen is locked you see black, if your screen is unlocked you see your e-mail client.

ThomasHabets commented 2 years ago

A buffer change makes the indicator rotate

Rotate?

an empty buffer clears the indicator.

After a while, yes.

Your suggestion breaks my workflow and I assume others' workflow as well.

Is your workflow to press shift or control, and requiring that the green circle doesn't show, or are you trolling?

Do you do this often? For what purpose? What workflow is broken by the screen not remaining unicolor, or showing the provided background image?

Also, I don't see how you can send an email? If the screen is locked you see black, if your screen is unlocked you see your e-mail client.

The suggested workaround from stapelberg was to press backspace. If you have a google docs open (something stapelberg would presumably be familiar with) with comment access, this creates a "suggested edit", and emails the owner of the doc.

orestisfl commented 2 years ago

I suggest you stop calling people that interact with you trolls.

Rotate?

Maybe not the best word choice, but a part of the circle is highlighted

Is your workflow to press shift or control, and requiring that the green circle doesn't show, or are you trolling?

I press ctrl/shift to make my screen wake up. The lack of a circle confirms that the password buffer is empty.

The suggested workaround from stapelberg was to press backspace. If you have a google docs open (something stapelberg would presumably be familiar with) with comment access, this creates a "suggested edit", and emails the owner of the doc.

  1. Press ctrl/shift so that xdpms wakes up your screen
  2. if you see your email client, your screen is unlocked
  3. if you see black, your screen is locked
  4. if you see black and a green circle, your screen is locked and i3lock has already saved some characters in the password buffer
ThomasHabets commented 2 years ago

I suggest you stop calling people that interact with you trolls.

Like I said I have a hard time taking your suggestions at face value. They appear indistiguishable from trolling. Your main argument seems to be "don't want that" for my subjective reasons, without addressing the objective reasons.

a part of the circle is highlighted

Only while the key is pressed.

The lack of a circle confirms that the password buffer is empty.

Or a movie is paused, but happens to be dark, or the monitor is still waking up (very common. My laptop monitor wakes up much faster than my external monitor), or a hundred other possible states.

  1. if you see black, your screen is locked

That's not a reliable indicator, and I've given examples, and I've also IRCed a password thanks to this assumption (decades ago), and therefore will not be doing that again.

Hell, I have a keyboard switch, and if i3lock doesn't show its indicator I don't even know if I woke up the right machine, or if the monitor was on (but black) the whole time. And another machine will now take my input.

Pressing ctrl/shift and getting positive confirmation is extremely useful.

Airblader commented 2 years ago

Like I said I have a hard time taking your suggestions at face value.

I haven't been involved in this discussion, but I'm also having a hard time understanding your point: you chose the black background color which is indistinguishable, are now facing the issue of it being indistinguishable, and want another solution instead when "don't use black" seems like a perfectly fine solution.

Your proposed solution isn't sufficient anyway for people who chose black, because it doesn't cover the case of also specifying -u.

Ultimately I agree that you used the configuration as a foot gun here, and the remaining argument is personal preference, not usability, and personal preference is just something we don't care about as much for i3lock.

You have yet to respond to my suggestion of just using an image.

ThomasHabets commented 2 years ago

I haven't been involved in this discussion, but I'm also having a hard time understanding your point: you chose the black background color which is indistinguishable

Screensavers, from the beginning of time, including the default Linux text console screensaver, most commonly eventually or immediately go to a black screen. It's nice to have the minimum amount of light, for example if the computer is in a bedroom. Sure, there's usually backlight bleed, but "as dark as it can get".

While burn in is not as bad as it used to be, it's not a phenomenon that's entirely gone.

With OLED I believe it also saves power.

So that's some objective reasons for choosing black in particular. I hope you don't disagree on those.

Subjectively, I also like it. If I have two monitors on my desk and one is connected to a locked machine, I want it as undistracting as possible. That'd be black.

But it's not just about black. Let's say you see whatever colour you prefer, on your monitor. I have made the mistake before of typing on a keyboard I thought was connected to the same machine as the monitor, but (say) before lunch I'd connected it elsewhere temporarily.

The solution to this is, of course, to not type the password until you get confirmation that this keyboard does in fact lead to this session of the screensaver.

To wake up every single screensaver and (where applicable) monitor, you can always press shift/ctrl. Usually you can also jiggle the mouse, but I'm glad i3lock doesn't trigger on that, since it's so easy to do inadvertenly.

So that said:

the black background color which is indistinguishable

It's only indistinguishable because i3lock doesn't (unlike every other screensaver) indicate when you press shift or control.

So it's a circular argument. My request here is that it becomes distinguishable, because of these use cases. It's only indistinguishable because it was decided that it should be indistinguishable.

Your proposed solution isn't sufficient anyway for people who chose black, because it doesn't cover the case of also specifying -u

That's true. That sounds a bit like if someone has a screenshot of a BSOD, and using -u. They don't know if it's a real BSOD. (forgive the cross-OSness)

I would not recommend that anyone type their password without any feedback that they are typing into the machine they think they are. Some would disagree, and use -u, but I wouldn't recommend it except on a laptop on its built in keyboard. No matter what colour or image the screensaver uses.

You have yet to respond to my suggestion of just using an image.

It's either that or switch screensaver, I suppose. I'll find it a bit ugly to check in images to my dotfiles. In general it's a bit of an inelegant workaround of a bug, but I guess "if it works it works".

More likely I'll switch screensaver, because after decades of pressing ctrl, and it working still on every non-i3lock machine, I still keep finding myself waiting like an idiot for the monitor to wake up, when in fact it already is awake.

And then I have to press just one key, because if I just machinegun the password I could inadvertently be typing my password into the wrong machine, if the keyboard switch is set wrong. And there it doesn't matter if I've chosen black, white or anything in between.

Surrendering your password is the same operation as testing that you're connected to the expected machine. Which is not optimal.

So:

Yes, in theory ctrl or shift could go to the wrong machine. I don't believe I've interacted with a machine where that does anything, though, except in videogames.

Airblader commented 2 years ago

It's nice to have the minimum amount of light, for example if the computer is in a bedroom. Sure, there's usually backlight bleed, but "as dark as it can get". While burn in is not as bad as it used to be, it's not a phenomenon that's entirely gone.

But those points are why you put your screen to sleep. The color of i3lock only matters when your screen has woken up.

Password could still go to the wrong machine

I don't see it as the screen locker's responsibility to make sure you're operating the correct machine. Apart from it being a very niche case, shouldn't it be the switch that tells you where it's currently routing? :-)

Personally I ultimately don't really care one way or another regarding your proposed change, the other two seem to lean towards not allowing it, though. I do think using an image provides a solution that satisfies your needs entirely, and "I don't want to check in images" to me is as silly as "don't use black" seems to be to you. :-)

stapelberg commented 2 years ago

Are you saying that pressing shift should make i3lock draw the circle? If not then there's no mystery. Black is just the background color.

No, I’m saying pressing shift should wake up your screen at the X11 level, no matter what i3lock does.

I’m still unclear as to what exactly is happening on your machine, but as I mentioned multiple times I suspect there is some sort of issue with your setup. It sounds like you’re not seeing your screen wake up from DPMS, which would be a bug outside of i3lock. If true, and once fixed, your entire line of reasoning disappears. This is why I’m not currently seriously considering changing anything.

Screensavers, from the beginning of time, including the default Linux text console screensaver, most commonly eventually or immediately go to a black screen. It's nice to have the minimum amount of light, for example if the computer is in a bedroom. Sure, there's usually backlight bleed, but "as dark as it can get".

i3lock used to default to a white screen precisely for the reason to disambiguate “computer on, screen locked” from “computer not on” or “display not working”. After much discussion we changed it to #a3a3a3 in pull request https://github.com/i3/i3lock/pull/300. I suggest you do a similar change and avoid a 100% black background.

It's only indistinguishable because i3lock doesn't (unlike every other screensaver) indicate when you press shift or control.

i3lock was originally forked from slock, which doesn’t indicate anything. I’m not saying that’s a justification for anything, but it hopefully gives you some context where we’re coming from. It’s not like we deliberately decided at some point to prevent feedback or anything, it’s just that this specific action was never implemented to trigger any feedback.

The suggested workaround from stapelberg was to press backspace. If you have a google docs open (something stapelberg would presumably be familiar with) with comment access, this creates a "suggested edit", and emails the owner of the doc.

When making a google docs suggestion accidentally, no matter how or why, just reject your own suggestion and it won’t even trigger an email. It’s really not a big deal at all.

ThomasHabets commented 2 years ago

I’m still unclear as to what exactly is happening on your machine, but as I mentioned multiple times I suspect there is some sort of issue with your setup. It sounds like you’re not seeing your screen wake up from DPMS,

It's not a DPMS issue. The machine unsuspends, the screen wakes up, the backlight in the screen turns on. If I had used a colour other than black then I would be seeing that colour. But since I chose black I see black. That's not the issue.

When making a google docs suggestion accidentally, no matter how or why, just reject your own suggestion and it won’t even trigger an email.

If you do it in time, sure. But this is just a concrete example of how the workarounds create persistent state from keystrokes being misdirected. But I'm surprised you don't agree that misdirected keystrokes isn't obviously a bad thing, without giving concrete examples.

ThomasHabets commented 2 years ago

I don't see it as the screen locker's responsibility

Responsibility? As in I'd blame the screen locker? Of course I agree. But that's a pretty low bar.

"I don't want to check in images" to me is as silly as "don't use black" seems to be to you. :-)

The silly part is to work around something that should not be a problem in the first place.

Airblader commented 2 years ago

to work around something that should not be a problem in the first place

Expecting i3lock to show an indicator when pressing the specific keys you happen to press to test your screen because you chose black as the background color, I would argue, is the same thing: working around a problem that shouldn't be a problem in the first place; just don't use the one color that makes the two cases indistinguishable from one another. But if you really really insist on using black, use an image with some indicator. It's really not worth this lengthy discussion.