i3 / i3lock

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

suggestion: white rectangle instead of "no input" #181

Closed domo141 closed 5 years ago

domo141 commented 6 years ago

Hi Michael,

This feature of showing any kind of indication when backspace is pressed is great! I pulled the repo in order to patch something there but something better that I thought was already done :+1:

You asked in commit 6b53758e142c3628c24a53d0ed5994dddf309e9a for a suggestion how to "improve" this. My suggestion would be just a white rectangle...

... to make it look like some pictures here: https://en.wikipedia.org/wiki/Prohibitory_traffic_sign

That would make it also locale-agnostic. No need to think translations ;)

It would be pretty simple to use cairo to stroke a white rectangle. I did hack my version with some unicode magic:

--- a/unlock_indicator.c
+++ b/unlock_indicator.c
@@ -229,7 +229,8 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
                 break;
             default:
                 if (unlock_state == STATE_NOTHING_TO_DELETE) {
-                    text = "no input";
+                    cairo_set_source_rgb(ctx, 1, 1, 1);
+                    text = "██████";
                 }
                 if (show_failed_attempts && failed_attempts > 0) {
                     if (failed_attempts > 999) {

Tomi

PS: to get this compiled on Fedora 27 had to install following packages on top of the packages I've already installed (so no means complete, but may help someone...)

18  18:29  0:04  sudo dnf install autotools
29  18:32  0:05  sudo dnf install automake
64  18:54  0:03  sudo dnf install libev-devel
69  18:55  0:04  sudo dnf install xcb-util-image-devel.x86_64
72  18:57  0:04  sudo dnf install xcb-util-devel.x86_64
79  18:58  0:04  sudo dnf install libxkbcommon-x11-devel.x86_64
90  19:01  0:04  sudo dnf install pam-devel
93  19:02  0:02  ./configure
Airblader commented 6 years ago

Do you have a screenshot?

Apart from the discussion on whether text is better here or not, I think that if we want to draw a rectangle, we should draw a rectangle (not a Unicode text).

domo141 commented 6 years ago

Yes, drawing rectangle with cairo is pretty simple, I just did the quickest hack possible.

Here is the (clipped) shot. IMO the white rectangle is a bit too large, but good enough for an example...

no-input

EDIT: my command line: i3lock -n -c 222200

domo141 commented 6 years ago

Hmm, I partially withdraw my suggestion -- this sign could be shown when password were given incorrectly (instead of "Wrong"), and something else for the "no input" case. So, IMO status quo is better than first using this for 'no input' and then changing, if that were ever going to happen...

stapelberg commented 5 years ago

Thanks for the suggestion. I think for the time being, we’ll stick with what we have, as that’s more descriptive.

domo141 commented 5 years ago

Yes. actually In system where I use self-patched i3lock I already use something else than 'no input' or the above (both were too disturbing to my taste). I might, however, create change which uses the above rectangle (with less bright colors) whenever pasword found incorrect. Thanks for your interest, and i3lock :D