i3 - improved tiling WM


add nopass option

Patch status: rejected

Patch by Travis Cardwell

Long description:

It is sometimes convenient to blank the screen without locking it.  For
example, one might blank the screen when talking to a coworker, without
leaving the desk.  It would be nice to have the feature in i3lock for
when DPMS is not available.

Example configuration:

    # blank the screen
    bindsym $mod+z exec i3lock -d -N -c 111111
    # lock the screen
    bindsym $mod+Shift+z exec i3lock -d -c 111111

To apply this patch, use:
curl http://cr.i3wm.org/patch/195/raw.patch | git am

b/i3lock.c

25
@@ -49,6 +49,7 @@ bool debug_mode = false;
26
 static bool dpms = false;
27
 bool unlock_indicator = true;
28
 static bool dont_fork = false;
29
+static bool nopass = false;
30
 struct ev_loop *main_loop;
31
 static struct ev_timer *clear_pam_wrong_timeout;
32
 extern unlock_state_t unlock_state;
33
@@ -255,6 +256,9 @@ static void handle_key_press(xcb_key_press_event_t *event) {
34
     int n;
35
     bool ctrl;
36
 
37
+    if (nopass)
38
+        exit(0);
39
+
40
     ksym = xkb_state_key_get_one_sym(xkb_state, event->detail);
41
     ctrl = xkb_state_mod_name_is_active(xkb_state, "Control", XKB_STATE_MODS_DEPRESSED);
42
     xkb_state_update_key(xkb_state, event->detail, XKB_KEY_DOWN);
43
@@ -524,6 +528,7 @@ int main(int argc, char *argv[]) {
44
     struct option longopts[] = {
45
         {"version", no_argument, NULL, 'v'},
46
         {"nofork", no_argument, NULL, 'n'},
47
+        {"nopass", no_argument, NULL, 'N'},
48
         {"beep", no_argument, NULL, 'b'},
49
         {"dpms", no_argument, NULL, 'd'},
50
         {"color", required_argument, NULL, 'c'},
51
@@ -539,13 +544,16 @@ int main(int argc, char *argv[]) {
52
     if ((username = getenv("USER")) == NULL)
53
         errx(1, "USER environment variable not set, please set it.\n");
54
 
55
-    while ((o = getopt_long(argc, argv, "hvnbdc:p:ui:t", longopts, &optind)) != -1) {
56
+    while ((o = getopt_long(argc, argv, "hvnNbdc:p:ui:t", longopts, &optind)) != -1) {
57
         switch (o) {
58
         case 'v':
59
             errx(EXIT_SUCCESS, "version " VERSION " © 2010-2012 Michael Stapelberg");
60
         case 'n':
61
             dont_fork = true;
62
             break;
63
+        case 'N':
64
+            nopass = true;
65
+            break;
66
         case 'b':
67
             beep = true;
68
             break;