Merge branch 'master' of https://github.com/i3/i3lock into i3-master

This commit is contained in:
Raymond Li 2020-03-09 13:27:54 -04:00
commit ed30001174
No known key found for this signature in database
GPG Key ID: A014EA89B62BBB1B
7 changed files with 64 additions and 22 deletions

View File

@ -1,3 +1,11 @@
2019-07-21 i3lock 2.12
• remove stray \n from error messages
• capitalize unlock indicator contents
• set WM_CLASS property
• reference modifier as “Super”, not “Win”
• add --raw option to read image as raw bytes
2018-10-18 i3lock 2.11.1
• Fix dist tarball by including I3LOCK_VERSION

View File

@ -1 +1 @@
2.12.c-non-git
2.13.c-non-git

View File

@ -19,7 +19,7 @@
![GitHub watchers](https://img.shields.io/github/watchers/Raymo111/i3lock-color)
![Maintenance](https://img.shields.io/maintenance/yes/2020)
**A re-patched version of i3lock with color functionality by [eBrnd](https://github.com/eBrnd/i3lock-color), started by [PandorasFox](https://github.com/PandorasFox/) (2015-2020), and now maintained by [Raymo111](https://github.com/Raymo111)**
**A re-patched version of i3lock with color functionality by [eBrnd](https://github.com/eBrnd/i3lock-color), started by [PandorasFox](https://github.com/PandorasFox/) (2015-2020), and now maintained and being developed by [Raymo111](https://github.com/Raymo111)**
![i3lock-color in action](screenshot.png "Screenshot sample")
@ -27,9 +27,8 @@ i3lock is a simple screen locker like slock. After starting it, you will see a w
Many little improvements have been made to i3lock over time:
- i3lock forks, so you can combine it with an alias to suspend to RAM (run "i3lock && echo mem > /sys/power/state" to get a locked screen
after waking up your computer from suspend to RAM)
- You can specify either a background color or an image (JPG or PNG), which will be displayed while your screen is locked.
- i3lock forks, so you can combine it with an alias to suspend to RAM (run "i3lock && echo mem > /sys/power/state" to get a locked screen after waking up your computer from suspend to RAM)
- You can specify either a background color or an image (JPG or PNG), which will be displayed while your screen is locked. Note that i3lock is not an image manipulation software. If you need to resize the image to fill the screen or similar, use existing tooling to do this before passing it to i3lock. I hope to add this functionality to i3lock-color in the near future.
- You can specify whether i3lock should bell upon a wrong password.
- i3lock uses PAM and therefore is compatible with LDAP etc. On OpenBSD, i3lock uses the bsd\_auth(3) framework.
@ -83,7 +82,7 @@ A [sample script](lock.sh) is included in this repository. [See the script in ac
On OpenBSD the `i3lock` binary needs to be setgid `auth` to call the authentication helpers, e.g. `/usr/libexec/auth/login_passwd`.
## Building i3lock
First install the dependencies listed in requirements section, then run these commands (might need to be adapted to your OS):
First install the dependencies above, then run these commands (might need to be adapted to your OS):
```
autoreconf --force --install

View File

@ -2,7 +2,7 @@
# Run autoreconf -fi to generate a configure script from this file.
AC_PREREQ([2.69])
AC_INIT([i3lock-color], [2.12], [https://github.com/PandorasFox/i3lock-color/issues])
AC_INIT([i3lock-color], [2.13.c], [https://github.com/Raymo11/i3lock-color/issues])
# For AX_EXTEND_SRCDIR
AX_ENABLE_BUILDDIR
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2])

View File

@ -64,7 +64,7 @@ Enable beeping. Be sure to not do this when you are about to annoy other people,
like when opening your laptop in a boring lecture.
.TP
.B \-u, \-\-no-unlock-indicator
.B \-u, \-\-no\-unlock\-indicator
Disable the unlock indicator. i3lock will by default show an unlock indicator
after pressing keys. This will give feedback for every keypress and it will
show you the current PAM state (whether your password is currently being
@ -121,7 +121,7 @@ displays a hardcoded Windows-Pointer (thus enabling you to mess with your
friends by using a screenshot of a Windows desktop as a locking-screen).
.TP
.B \-e, \-\-ignore-empty-password
.B \-e, \-\-ignore\-empty\-password
When an empty password is provided by the user, do not validate
it. Without this option, the empty password will be provided to PAM
and, if invalid, the user will have to wait a few seconds before
@ -130,7 +130,7 @@ put a laptop to sleep and bounce on resume or if you happen to wake up
your computer with the enter key.
.TP
.B \-f, \-\-show-failed-attempts
.B \-f, \-\-show\-failed\-attempts
Show the number of failed attempts, if any.
.TP
@ -177,17 +177,17 @@ Displays the clock. \-\-force\-clock also displays the clock when there's indica
Some compositors have problems with i3lock trying to render over them, so this argument is disabled by default. However, some will work properly with it, so it's been left enabled.
.TP
.B \-\-pass-media-keys
.B \-\-pass\-media\-keys
Allow the following keys to be used while the screen is locked by passing them through:
XF86AudioPlay, XF86AudioPause, XF86AudioStop, XF86AudioPrev, XF86AudioNext, XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume.
.TP
.B \-\-pass-screen-keys
.B \-\-pass\-screen\-keys
Allow the following keys to be used while the screen is locked by passing them through:
XF86MonBrightnessUp, XF86MonBrightnessDown.
.TP
.B \-\-pass-power-keys
.B \-\-pass\-power\-keys
Allow the following keys to be used while the screen is locked by passing them through:
XF86PowerDown, XF86PowerOff, XF86Sleep.
@ -315,7 +315,7 @@ Sets the color of the date in the clock.
Sets the format used for generating the date string. See strftime(3) for a full list of format specifiers.
.TP
.B \-\-{time, date, layout, verif, wrong, greeter}\-font=sans-serif
.B \-\-{time, date, layout, verif, wrong, greeter}\-font=sans\-serif
Sets the font used to render various strings.
.TP
@ -348,7 +348,7 @@ Sets the color of the greeter text.
Sets the position for the date string. All the variables from \-\-indpos and \-\-timepos may be used.
.TP
.B \-\-refresh\-rate=seconds-as-double
.B \-\-refresh\-rate=seconds\-as\-double
The refresh rate of the indicator, given in seconds. This should automatically align itself, but is somewhat buggy currently. Values less than one will work, but may result in poor system performance.
.TP
@ -446,7 +446,7 @@ use a wrapper script around i3lock like the following:
\& revert
.Ve
The \-I (-\-inactivity-timeout=seconds) was removed because it only makes sense with DPMS.
The \-I (-\-inactivity\-timeout=seconds) was removed because it only makes sense with DPMS.
.SH SEE ALSO
.IR xautolock(1)
@ -461,3 +461,5 @@ Michael Stapelberg <michael+i3lock at stapelberg dot de>
Jan-Erik Rediger <badboy at archlinux.us>
Pandora <pandora at techfo dot xyz>
Raymond Li <hi at raymond.li>

View File

@ -187,6 +187,7 @@ xcb_window_t win;
static xcb_cursor_t cursor;
#ifndef __OpenBSD__
static pam_handle_t *pam_handle;
static bool pam_cleanup;
#endif
int input_position = 0;
/* Holds the password you enter (in UTF-8). */
@ -522,7 +523,7 @@ static void input_done(void) {
* credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the
* refresh of the credentials failed. */
pam_setcred(pam_handle, PAM_REFRESH_CRED);
pam_end(pam_handle, PAM_SUCCESS);
pam_cleanup = true;
ev_break(EV_DEFAULT, EVBREAK_ALL);
return;
@ -1354,11 +1355,6 @@ int main(int argc, char *argv[]) {
int ret;
struct pam_conv conv = {conv_callback, NULL};
#endif
#if defined(__linux__)
bool lock_tty_switching = false;
int term = -1;
#endif
int curs_choice = CURS_NONE;
int o;
int longoptind = 0;
@ -2294,6 +2290,12 @@ int main(int argc, char *argv[]) {
}
ev_loop(main_loop, 0);
#ifndef __OpenBSD__
if (pam_cleanup) {
pam_end(pam_handle, PAM_SUCCESS);
}
#endif
if (stolen_focus == XCB_NONE) {
return 0;
}

31
xcb.c
View File

@ -37,6 +37,26 @@ extern bool debug_mode;
xcb_connection_t *conn;
xcb_screen_t *screen;
static xcb_atom_t _NET_WM_BYPASS_COMPOSITOR = XCB_NONE;
void _init_net_wm_bypass_compositor(xcb_connection_t *conn) {
if (_NET_WM_BYPASS_COMPOSITOR != XCB_NONE) {
/* already initialized */
return;
}
xcb_generic_error_t *err;
xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(
conn,
xcb_intern_atom(conn, 0, strlen("_NET_WM_BYPASS_COMPOSITOR"), "_NET_WM_BYPASS_COMPOSITOR"),
&err);
if (atom_reply == NULL) {
fprintf(stderr, "X11 Error %d\n", err->error_code);
free(err);
return;
}
_NET_WM_BYPASS_COMPOSITOR = atom_reply->atom;
free(atom_reply);
}
#define curs_invisible_width 8
#define curs_invisible_height 8
@ -191,6 +211,17 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
2 * (strlen("i3lock") + 1),
"i3lock\0i3lock\0");
const uint32_t bypass_compositor = 1; /* disable compositing */
_init_net_wm_bypass_compositor(conn);
xcb_change_property(conn,
XCB_PROP_MODE_REPLACE,
win,
_NET_WM_BYPASS_COMPOSITOR,
XCB_ATOM_CARDINAL,
32,
1,
&bypass_compositor);
/* Map the window (= make it visible) */
xcb_map_window(conn, win);