diff options
| author | Simeon Simeonov | 2020-03-19 16:51:23 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2020-03-19 16:51:23 +0100 |
| commit | eba48b7cec388325b237fd1b5a3c6d2e04deba12 (patch) | |
| tree | 3e6a57a3ffec9310c2a769adcfc6e5f8e272572f | |
| parent | 69a05d516bd0c7e369a0ba1fb78aac57a5ea26f2 (diff) | |
Initial merge i3lock-extended -> i3lock
| -rw-r--r-- | CHANGELOG | 188 | ||||
| -rw-r--r-- | COPYING | 674 | ||||
| -rw-r--r-- | I3LOCK_VERSION | 2 | ||||
| -rw-r--r-- | INSTALL.md | 76 | ||||
| -rw-r--r-- | LICENSE | 20 | ||||
| -rw-r--r-- | Makefile.am | 17 | ||||
| -rw-r--r-- | README.md | 86 | ||||
| -rw-r--r-- | configure.ac | 4 | ||||
| -rw-r--r-- | extras.c | 448 | ||||
| -rw-r--r-- | extras.h | 102 | ||||
| -rw-r--r-- | i3lock-extended.1 (renamed from i3lock.1) | 215 | ||||
| -rw-r--r-- | i3lock.c | 287 | ||||
| -rw-r--r-- | pam/i3lock-extended (renamed from pam/i3lock) | 0 | ||||
| -rw-r--r-- | unlock_indicator.c | 81 |
14 files changed, 1882 insertions, 318 deletions
| @@ -1,187 +1,3 @@ | |||
| 1 | 2019-07-21 i3lock 2.12 | 1 | 2020-03-19 i3lock-extended 1.2.12 |
| 2 | 2 | ||
| 3 | • remove stray \n from error messages | 3 | • Initial import and functionality |
| 4 | • capitalize unlock indicator contents | ||
| 5 | • set WM_CLASS property | ||
| 6 | • reference modifier as “Super”, not “Win” | ||
| 7 | • add --raw option to read image as raw bytes | ||
| 8 | |||
| 9 | 2018-10-18 i3lock 2.11.1 | ||
| 10 | |||
| 11 | • Fix dist tarball by including I3LOCK_VERSION | ||
| 12 | |||
| 13 | 2018-10-10 i3lock 2.11 | ||
| 14 | |||
| 15 | • Switch to autotools | ||
| 16 | • Display an error when backspace is pressed without any input | ||
| 17 | • Print an error when a non-PNG file is opened | ||
| 18 | (i3lock only supports PNG files) (Thanks eplanet) | ||
| 19 | • Don’t unnecessarily check the xcb_connect return value, | ||
| 20 | it is known never to be NULL (Thanks SegFault42) | ||
| 21 | • Fix memory leak when grabbing fails (Thanks karulont) | ||
| 22 | • Respect Xft.dpi for determining the unlock indicator’s scale factor | ||
| 23 | • Discard pending password verification attempts | ||
| 24 | when a new password is entered (Thanks layus) | ||
| 25 | |||
| 26 | 2017-11-25 i3lock 2.10 | ||
| 27 | |||
| 28 | • Only use -lpam when not on OpenBSD (Thanks Kaashif) | ||
| 29 | • locale: treat empty string same as unset (Thanks Ran) | ||
| 30 | • Fix overwrite of getopt optind (Thanks jakob) | ||
| 31 | • Immediately hide the unlock indicator after ESC / C-u (Thanks Orestis) | ||
| 32 | • Measure wall-clock time instead of CPU time for “locking” indicator. | ||
| 33 | • SetInputFocus to the i3lock window to force-close context menus | ||
| 34 | • Use RandR for learning about attached monitors | ||
| 35 | |||
| 36 | 2017-06-21 i3lock 2.9.1 | ||
| 37 | |||
| 38 | • Fix version number mechanism (for --version) | ||
| 39 | • Revert the fix for composited notifications, as it causes more issues than | ||
| 40 | it solves: | ||
| 41 | https://github.com/i3/i3lock/issues/130 | ||
| 42 | https://github.com/i3/i3lock/issues/128 | ||
| 43 | |||
| 44 | 2017-05-26 i3lock 2.9 | ||
| 45 | |||
| 46 | • i3lock.1: use signal names without SIG prefix | ||
| 47 | • Removed obsolete inactivity timeout | ||
| 48 | • Added version files for release tarball. | ||
| 49 | • Set font face | ||
| 50 | • Automatically unlock (without having to press <Enter>) one attempt which was | ||
| 51 | entered while authenticating | ||
| 52 | • Stop leaking the image_path dup | ||
| 53 | • Displaying locking message when grabbing the pointer/keyboard | ||
| 54 | • Display error message when locking failed | ||
| 55 | • Add Enter on C-m | ||
| 56 | • Change input slices to be exactly pi/3 in size instead of slightly more | ||
| 57 | • Fix covering of composited notifications using the XComposite extension | ||
| 58 | • Remove last traces of DPMS | ||
| 59 | • Use bsd_auth(3) instead of PAM on OpenBSD | ||
| 60 | • Restore intended behaviour and don't use mlock(2) on OpenBSD. | ||
| 61 | |||
| 62 | 2016-06-04 i3lock 2.8 | ||
| 63 | |||
| 64 | • Remove DPMS support in favor of a wrapper script and xset(1). | ||
| 65 | • Indicate that the --inactivity-timeout option takes an argument. (Thanks | ||
| 66 | Kenneth Lyons) | ||
| 67 | • fix pam_securetty: set PAM_TTY to getenv("DISPLAY") | ||
| 68 | • Eat XKB_KEY_Delete and XKB_KEY_KP_Delete (Thanks bebehei) | ||
| 69 | • Show unlock indicator if password was entered during PAM verification | ||
| 70 | • Allow CTRL+J as enter and CTRL+H as backspace (Thanks Karl Tarbe) | ||
| 71 | • Flush xcb connection after opening fullscreen window (Thanks martin) | ||
| 72 | • Add support for `xss-lock --transfer-sleep-lock' | ||
| 73 | |||
| 74 | 2015-05-20 i3lock 2.7 | ||
| 75 | |||
| 76 | • Die when the X11 connection breaks during runtime (Thanks Eduan) | ||
| 77 | • Implement logging the number of failed attempts (Thanks koebi) | ||
| 78 | • Ignore password validation is pam is in wrong state (Thanks Neodyblue) | ||
| 79 | • Get current user with getpwuid() instead of using $ENV{USER} (Thanks Martin) | ||
| 80 | • Add support for Compose and dead-keys with libxkbcommon. | ||
| 81 | Requires libxkbcommon ≥ 0.5.0 (Thanks Daniel) | ||
| 82 | • Format the source using clang-format. | ||
| 83 | • Refresh pam credentials on successful authentication (for Kerberos and the | ||
| 84 | like) (Thanks James) | ||
| 85 | • List pressed modifiers on failed authentication (Thanks Deiz, Alexandre) | ||
| 86 | • Only redraw the screen if the unlock indicator is actually used | ||
| 87 | (Thanks Ingo) | ||
| 88 | • Make pkg-config configurable for cross-compilation (Thanks Nikolay) | ||
| 89 | |||
| 90 | 2014-07-18 i3lock 2.6 | ||
| 91 | |||
| 92 | • NEW DEPENDENCY: use libxkbcommon-x11 instead of libX11 | ||
| 93 | This helps us get rid of all code that directly uses libX11 | ||
| 94 | • Use cairo_status_to_string for descriptive errors. | ||
| 95 | • Add `-e` option to not validate empty password. | ||
| 96 | • Bugfix: update the initial keyboard modifier state (Thanks lee, Ran) | ||
| 97 | • Re-raise i3lock when obscured in a separate process | ||
| 98 | • Turn on the screen on successful authentication | ||
| 99 | • Delay to turn off the screen after wrong passwd | ||
| 100 | • Discard half-entered passwd after some inactivity | ||
| 101 | • Ignore empty passwd after repeated Enter keypress | ||
| 102 | • Scale the unlock indicator (for retina displays) | ||
| 103 | |||
| 104 | 2013-06-09 i3lock 2.5 | ||
| 105 | |||
| 106 | • NEW DEPENDENCY: Use libxkbcommon for input handling | ||
| 107 | This makes input handling much better for many edge cases. | ||
| 108 | • Bugfix: fix argument parsing on ARM (s/char/int/) | ||
| 109 | • Bugfix: free(reply) to avoid memory leak | ||
| 110 | • Bugfix: Use ev_loop_fork after fork, fixes forking on kqueue based OSes | ||
| 111 | • Bugfix: Fix centering the indicator in the no-xinerama case | ||
| 112 | • Only use mlock() on Linux, FreeBSD (for example) requires root | ||
| 113 | • promote the "could not load image" message from debug to normal | ||
| 114 | • s/pam_message/pam_response/ (Thanks Tucos) | ||
| 115 | • remove support for NOLIBCAIRO, cairo-xcb is widespread by now | ||
| 116 | • Allow XKB_KEY_XF86ScreenSaver as synonym for enter | ||
| 117 | This keysym is generated on convertible tablets by pressing a hardware | ||
| 118 | lock/unlock button. | ||
| 119 | • Allow passwordless PAM conversations (e.g. fingerprint) | ||
| 120 | • Add ctrl+u password reset | ||
| 121 | • Set window name to i3lock | ||
| 122 | |||
| 123 | 2012-06-02 i3lock 2.4.1 | ||
| 124 | |||
| 125 | • Bugfix: Correctly center unlock indicator after reconfiguring screens | ||
| 126 | (Thanks xeen) | ||
| 127 | • Bugfix: Revert shift lock handling (broke uppercase letters) | ||
| 128 | • Bugfix: Skip shift when getting the modifier mask (Thanks SardemFF7) | ||
| 129 | |||
| 130 | 2012-04-01 i3lock 2.4 | ||
| 131 | |||
| 132 | • Bugfix: Fix background color when using cairo (Thanks Pascal) | ||
| 133 | • Only output text when in debug mode (fixes problems with xautolock) | ||
| 134 | • fallback when the image cannot be loaded | ||
| 135 | • Use (void) instead of () for functions without args (Thanks fernandotcl) | ||
| 136 | |||
| 137 | 2012-03-15 i3lock 2.3.1 | ||
| 138 | |||
| 139 | • Fix compilation on some systems | ||
| 140 | |||
| 141 | 2012-03-15 i3lock 2.3 | ||
| 142 | |||
| 143 | • Implement a visual unlock indicator | ||
| 144 | • Support ISO_Level5_Shift and Caps Lock | ||
| 145 | • Lock the password buffer in memory, clear it in RAM after verifying | ||
| 146 | • Fork after the window is visible, not before | ||
| 147 | • Bugfix: Copy the color depth from parent (root) window instead of | ||
| 148 | hardcoding a depth of 24 | ||
| 149 | |||
| 150 | 2011-11-06 i3lock 2.2 | ||
| 151 | |||
| 152 | • Don’t re-grab pointer/keyboard on MappingNotify. In some rare situations, | ||
| 153 | this lead to some keypresses "slipping through" to the last focused window. | ||
| 154 | • Correctly handle Mode_switch/ISO_Level3_Shift | ||
| 155 | • Render to a pixmap which is used as background for the window instead of | ||
| 156 | copying contents on every expose event | ||
| 157 | • Handle screen resolution changes while screen is locked | ||
| 158 | • Manpage: document arguments for every option | ||
| 159 | |||
| 160 | 2011-05-13 i3lock 2.1 | ||
| 161 | |||
| 162 | • Accept return/backspace when the buffer of 512 bytes is full | ||
| 163 | • Handle numpad keys correctly | ||
| 164 | • Handle MappingNotify events | ||
| 165 | • Correctly check for errors when connecting to X11 | ||
| 166 | • Add i3lock.pam to not rely on debian’s /etc/pam.d/other anymore | ||
| 167 | • don’t display debug output | ||
| 168 | • add NOLIBCAIRO flag to permit compilation without cairo | ||
| 169 | |||
| 170 | 2010-09-05 i3lock 2.0 | ||
| 171 | |||
| 172 | • Complete rewrite of i3lock. Now using xcb instead of Xlib. | ||
| 173 | • When a window obscures i3lock, it pushes itself back to the top again. | ||
| 174 | • Display version when starting with -v | ||
| 175 | |||
| 176 | 2009-08-02 i3lock 1.1 | ||
| 177 | |||
| 178 | • Implement background pictures (-i) and colors (-c) | ||
| 179 | |||
| 180 | 2009-05-10 i3lock 1.0 | ||
| 181 | |||
| 182 | • Implement PAM support | ||
| 183 | • Implement options for forking, beeping, DPMS | ||
| 184 | |||
| 185 | 2009-05-01 i3lock 0.9 | ||
| 186 | |||
| 187 | • First release, forked from slock 0.9 | ||
| @@ -0,0 +1,674 @@ | |||
| 1 | GNU GENERAL PUBLIC LICENSE | ||
| 2 | Version 3, 29 June 2007 | ||
| 3 | |||
| 4 | Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> | ||
| 5 | Everyone is permitted to copy and distribute verbatim copies | ||
| 6 | of this license document, but changing it is not allowed. | ||
| 7 | |||
| 8 | Preamble | ||
| 9 | |||
| 10 | The GNU General Public License is a free, copyleft license for | ||
| 11 | software and other kinds of works. | ||
| 12 | |||
| 13 | The licenses for most software and other practical works are designed | ||
| 14 | to take away your freedom to share and change the works. By contrast, | ||
| 15 | the GNU General Public License is intended to guarantee your freedom to | ||
| 16 | share and change all versions of a program--to make sure it remains free | ||
| 17 | software for all its users. We, the Free Software Foundation, use the | ||
| 18 | GNU General Public License for most of our software; it applies also to | ||
| 19 | any other work released this way by its authors. You can apply it to | ||
| 20 | your programs, too. | ||
| 21 | |||
| 22 | When we speak of free software, we are referring to freedom, not | ||
| 23 | price. Our General Public Licenses are designed to make sure that you | ||
| 24 | have the freedom to distribute copies of free software (and charge for | ||
| 25 | them if you wish), that you receive source code or can get it if you | ||
| 26 | want it, that you can change the software or use pieces of it in new | ||
| 27 | free programs, and that you know you can do these things. | ||
| 28 | |||
| 29 | To protect your rights, we need to prevent others from denying you | ||
| 30 | these rights or asking you to surrender the rights. Therefore, you have | ||
| 31 | certain responsibilities if you distribute copies of the software, or if | ||
| 32 | you modify it: responsibilities to respect the freedom of others. | ||
| 33 | |||
| 34 | For example, if you distribute copies of such a program, whether | ||
| 35 | gratis or for a fee, you must pass on to the recipients the same | ||
| 36 | freedoms that you received. You must make sure that they, too, receive | ||
| 37 | or can get the source code. And you must show them these terms so they | ||
| 38 | know their rights. | ||
| 39 | |||
| 40 | Developers that use the GNU GPL protect your rights with two steps: | ||
| 41 | (1) assert copyright on the software, and (2) offer you this License | ||
| 42 | giving you legal permission to copy, distribute and/or modify it. | ||
| 43 | |||
| 44 | For the developers' and authors' protection, the GPL clearly explains | ||
| 45 | that there is no warranty for this free software. For both users' and | ||
| 46 | authors' sake, the GPL requires that modified versions be marked as | ||
| 47 | changed, so that their problems will not be attributed erroneously to | ||
| 48 | authors of previous versions. | ||
| 49 | |||
| 50 | Some devices are designed to deny users access to install or run | ||
| 51 | modified versions of the software inside them, although the manufacturer | ||
| 52 | can do so. This is fundamentally incompatible with the aim of | ||
| 53 | protecting users' freedom to change the software. The systematic | ||
| 54 | pattern of such abuse occurs in the area of products for individuals to | ||
| 55 | use, which is precisely where it is most unacceptable. Therefore, we | ||
| 56 | have designed this version of the GPL to prohibit the practice for those | ||
| 57 | products. If such problems arise substantially in other domains, we | ||
| 58 | stand ready to extend this provision to those domains in future versions | ||
| 59 | of the GPL, as needed to protect the freedom of users. | ||
| 60 | |||
| 61 | Finally, every program is threatened constantly by software patents. | ||
| 62 | States should not allow patents to restrict development and use of | ||
| 63 | software on general-purpose computers, but in those that do, we wish to | ||
| 64 | avoid the special danger that patents applied to a free program could | ||
| 65 | make it effectively proprietary. To prevent this, the GPL assures that | ||
| 66 | patents cannot be used to render the program non-free. | ||
| 67 | |||
| 68 | The precise terms and conditions for copying, distribution and | ||
| 69 | modification follow. | ||
| 70 | |||
| 71 | TERMS AND CONDITIONS | ||
| 72 | |||
| 73 | 0. Definitions. | ||
| 74 | |||
| 75 | "This License" refers to version 3 of the GNU General Public License. | ||
| 76 | |||
| 77 | "Copyright" also means copyright-like laws that apply to other kinds of | ||
| 78 | works, such as semiconductor masks. | ||
| 79 | |||
| 80 | "The Program" refers to any copyrightable work licensed under this | ||
| 81 | License. Each licensee is addressed as "you". "Licensees" and | ||
| 82 | "recipients" may be individuals or organizations. | ||
| 83 | |||
| 84 | To "modify" a work means to copy from or adapt all or part of the work | ||
| 85 | in a fashion requiring copyright permission, other than the making of an | ||
| 86 | exact copy. The resulting work is called a "modified version" of the | ||
| 87 | earlier work or a work "based on" the earlier work. | ||
| 88 | |||
| 89 | A "covered work" means either the unmodified Program or a work based | ||
| 90 | on the Program. | ||
| 91 | |||
| 92 | To "propagate" a work means to do anything with it that, without | ||
| 93 | permission, would make you directly or secondarily liable for | ||
| 94 | infringement under applicable copyright law, except executing it on a | ||
| 95 | computer or modifying a private copy. Propagation includes copying, | ||
| 96 | distribution (with or without modification), making available to the | ||
| 97 | public, and in some countries other activities as well. | ||
| 98 | |||
| 99 | To "convey" a work means any kind of propagation that enables other | ||
| 100 | parties to make or receive copies. Mere interaction with a user through | ||
| 101 | a computer network, with no transfer of a copy, is not conveying. | ||
| 102 | |||
| 103 | An interactive user interface displays "Appropriate Legal Notices" | ||
| 104 | to the extent that it includes a convenient and prominently visible | ||
| 105 | feature that (1) displays an appropriate copyright notice, and (2) | ||
| 106 | tells the user that there is no warranty for the work (except to the | ||
| 107 | extent that warranties are provided), that licensees may convey the | ||
| 108 | work under this License, and how to view a copy of this License. If | ||
| 109 | the interface presents a list of user commands or options, such as a | ||
| 110 | menu, a prominent item in the list meets this criterion. | ||
| 111 | |||
| 112 | 1. Source Code. | ||
| 113 | |||
| 114 | The "source code" for a work means the preferred form of the work | ||
| 115 | for making modifications to it. "Object code" means any non-source | ||
| 116 | form of a work. | ||
| 117 | |||
| 118 | A "Standard Interface" means an interface that either is an official | ||
| 119 | standard defined by a recognized standards body, or, in the case of | ||
| 120 | interfaces specified for a particular programming language, one that | ||
| 121 | is widely used among developers working in that language. | ||
| 122 | |||
| 123 | The "System Libraries" of an executable work include anything, other | ||
| 124 | than the work as a whole, that (a) is included in the normal form of | ||
| 125 | packaging a Major Component, but which is not part of that Major | ||
| 126 | Component, and (b) serves only to enable use of the work with that | ||
| 127 | Major Component, or to implement a Standard Interface for which an | ||
| 128 | implementation is available to the public in source code form. A | ||
| 129 | "Major Component", in this context, means a major essential component | ||
| 130 | (kernel, window system, and so on) of the specific operating system | ||
| 131 | (if any) on which the executable work runs, or a compiler used to | ||
| 132 | produce the work, or an object code interpreter used to run it. | ||
| 133 | |||
| 134 | The "Corresponding Source" for a work in object code form means all | ||
| 135 | the source code needed to generate, install, and (for an executable | ||
| 136 | work) run the object code and to modify the work, including scripts to | ||
| 137 | control those activities. However, it does not include the work's | ||
| 138 | System Libraries, or general-purpose tools or generally available free | ||
| 139 | programs which are used unmodified in performing those activities but | ||
| 140 | which are not part of the work. For example, Corresponding Source | ||
| 141 | includes interface definition files associated with source files for | ||
| 142 | the work, and the source code for shared libraries and dynamically | ||
| 143 | linked subprograms that the work is specifically designed to require, | ||
| 144 | such as by intimate data communication or control flow between those | ||
| 145 | subprograms and other parts of the work. | ||
| 146 | |||
| 147 | The Corresponding Source need not include anything that users | ||
| 148 | can regenerate automatically from other parts of the Corresponding | ||
| 149 | Source. | ||
| 150 | |||
| 151 | The Corresponding Source for a work in source code form is that | ||
| 152 | same work. | ||
| 153 | |||
| 154 | 2. Basic Permissions. | ||
| 155 | |||
| 156 | All rights granted under this License are granted for the term of | ||
| 157 | copyright on the Program, and are irrevocable provided the stated | ||
| 158 | conditions are met. This License explicitly affirms your unlimited | ||
| 159 | permission to run the unmodified Program. The output from running a | ||
| 160 | covered work is covered by this License only if the output, given its | ||
| 161 | content, constitutes a covered work. This License acknowledges your | ||
| 162 | rights of fair use or other equivalent, as provided by copyright law. | ||
| 163 | |||
| 164 | You may make, run and propagate covered works that you do not | ||
| 165 | convey, without conditions so long as your license otherwise remains | ||
| 166 | in force. You may convey covered works to others for the sole purpose | ||
| 167 | of having them make modifications exclusively for you, or provide you | ||
| 168 | with facilities for running those works, provided that you comply with | ||
| 169 | the terms of this License in conveying all material for which you do | ||
| 170 | not control copyright. Those thus making or running the covered works | ||
| 171 | for you must do so exclusively on your behalf, under your direction | ||
| 172 | and control, on terms that prohibit them from making any copies of | ||
| 173 | your copyrighted material outside their relationship with you. | ||
| 174 | |||
| 175 | Conveying under any other circumstances is permitted solely under | ||
| 176 | the conditions stated below. Sublicensing is not allowed; section 10 | ||
| 177 | makes it unnecessary. | ||
| 178 | |||
| 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
| 180 | |||
| 181 | No covered work shall be deemed part of an effective technological | ||
| 182 | measure under any applicable law fulfilling obligations under article | ||
| 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
| 184 | similar laws prohibiting or restricting circumvention of such | ||
| 185 | measures. | ||
| 186 | |||
| 187 | When you convey a covered work, you waive any legal power to forbid | ||
| 188 | circumvention of technological measures to the extent such circumvention | ||
| 189 | is effected by exercising rights under this License with respect to | ||
| 190 | the covered work, and you disclaim any intention to limit operation or | ||
| 191 | modification of the work as a means of enforcing, against the work's | ||
| 192 | users, your or third parties' legal rights to forbid circumvention of | ||
| 193 | technological measures. | ||
| 194 | |||
| 195 | 4. Conveying Verbatim Copies. | ||
| 196 | |||
| 197 | You may convey verbatim copies of the Program's source code as you | ||
| 198 | receive it, in any medium, provided that you conspicuously and | ||
| 199 | appropriately publish on each copy an appropriate copyright notice; | ||
| 200 | keep intact all notices stating that this License and any | ||
| 201 | non-permissive terms added in accord with section 7 apply to the code; | ||
| 202 | keep intact all notices of the absence of any warranty; and give all | ||
| 203 | recipients a copy of this License along with the Program. | ||
| 204 | |||
| 205 | You may charge any price or no price for each copy that you convey, | ||
| 206 | and you may offer support or warranty protection for a fee. | ||
| 207 | |||
| 208 | 5. Conveying Modified Source Versions. | ||
| 209 | |||
| 210 | You may convey a work based on the Program, or the modifications to | ||
| 211 | produce it from the Program, in the form of source code under the | ||
| 212 | terms of section 4, provided that you also meet all of these conditions: | ||
| 213 | |||
| 214 | a) The work must carry prominent notices stating that you modified | ||
| 215 | it, and giving a relevant date. | ||
| 216 | |||
| 217 | b) The work must carry prominent notices stating that it is | ||
| 218 | released under this License and any conditions added under section | ||
| 219 | 7. This requirement modifies the requirement in section 4 to | ||
| 220 | "keep intact all notices". | ||
| 221 | |||
| 222 | c) You must license the entire work, as a whole, under this | ||
| 223 | License to anyone who comes into possession of a copy. This | ||
| 224 | License will therefore apply, along with any applicable section 7 | ||
| 225 | additional terms, to the whole of the work, and all its parts, | ||
| 226 | regardless of how they are packaged. This License gives no | ||
| 227 | permission to license the work in any other way, but it does not | ||
| 228 | invalidate such permission if you have separately received it. | ||
| 229 | |||
| 230 | d) If the work has interactive user interfaces, each must display | ||
| 231 | Appropriate Legal Notices; however, if the Program has interactive | ||
| 232 | interfaces that do not display Appropriate Legal Notices, your | ||
| 233 | work need not make them do so. | ||
| 234 | |||
| 235 | A compilation of a covered work with other separate and independent | ||
| 236 | works, which are not by their nature extensions of the covered work, | ||
| 237 | and which are not combined with it such as to form a larger program, | ||
| 238 | in or on a volume of a storage or distribution medium, is called an | ||
| 239 | "aggregate" if the compilation and its resulting copyright are not | ||
| 240 | used to limit the access or legal rights of the compilation's users | ||
| 241 | beyond what the individual works permit. Inclusion of a covered work | ||
| 242 | in an aggregate does not cause this License to apply to the other | ||
| 243 | parts of the aggregate. | ||
| 244 | |||
| 245 | 6. Conveying Non-Source Forms. | ||
| 246 | |||
| 247 | You may convey a covered work in object code form under the terms | ||
| 248 | of sections 4 and 5, provided that you also convey the | ||
| 249 | machine-readable Corresponding Source under the terms of this License, | ||
| 250 | in one of these ways: | ||
| 251 | |||
| 252 | a) Convey the object code in, or embodied in, a physical product | ||
| 253 | (including a physical distribution medium), accompanied by the | ||
| 254 | Corresponding Source fixed on a durable physical medium | ||
| 255 | customarily used for software interchange. | ||
| 256 | |||
| 257 | b) Convey the object code in, or embodied in, a physical product | ||
| 258 | (including a physical distribution medium), accompanied by a | ||
| 259 | written offer, valid for at least three years and valid for as | ||
| 260 | long as you offer spare parts or customer support for that product | ||
| 261 | model, to give anyone who possesses the object code either (1) a | ||
| 262 | copy of the Corresponding Source for all the software in the | ||
| 263 | product that is covered by this License, on a durable physical | ||
| 264 | medium customarily used for software interchange, for a price no | ||
| 265 | more than your reasonable cost of physically performing this | ||
| 266 | conveying of source, or (2) access to copy the | ||
| 267 | Corresponding Source from a network server at no charge. | ||
| 268 | |||
| 269 | c) Convey individual copies of the object code with a copy of the | ||
| 270 | written offer to provide the Corresponding Source. This | ||
| 271 | alternative is allowed only occasionally and noncommercially, and | ||
| 272 | only if you received the object code with such an offer, in accord | ||
| 273 | with subsection 6b. | ||
| 274 | |||
| 275 | d) Convey the object code by offering access from a designated | ||
| 276 | place (gratis or for a charge), and offer equivalent access to the | ||
| 277 | Corresponding Source in the same way through the same place at no | ||
| 278 | further charge. You need not require recipients to copy the | ||
| 279 | Corresponding Source along with the object code. If the place to | ||
| 280 | copy the object code is a network server, the Corresponding Source | ||
| 281 | may be on a different server (operated by you or a third party) | ||
| 282 | that supports equivalent copying facilities, provided you maintain | ||
| 283 | clear directions next to the object code saying where to find the | ||
| 284 | Corresponding Source. Regardless of what server hosts the | ||
| 285 | Corresponding Source, you remain obligated to ensure that it is | ||
| 286 | available for as long as needed to satisfy these requirements. | ||
| 287 | |||
| 288 | e) Convey the object code using peer-to-peer transmission, provided | ||
| 289 | you inform other peers where the object code and Corresponding | ||
| 290 | Source of the work are being offered to the general public at no | ||
| 291 | charge under subsection 6d. | ||
| 292 | |||
| 293 | A separable portion of the object code, whose source code is excluded | ||
| 294 | from the Corresponding Source as a System Library, need not be | ||
| 295 | included in conveying the object code work. | ||
| 296 | |||
| 297 | A "User Product" is either (1) a "consumer product", which means any | ||
| 298 | tangible personal property which is normally used for personal, family, | ||
| 299 | or household purposes, or (2) anything designed or sold for incorporation | ||
| 300 | into a dwelling. In determining whether a product is a consumer product, | ||
| 301 | doubtful cases shall be resolved in favor of coverage. For a particular | ||
| 302 | product received by a particular user, "normally used" refers to a | ||
| 303 | typical or common use of that class of product, regardless of the status | ||
| 304 | of the particular user or of the way in which the particular user | ||
| 305 | actually uses, or expects or is expected to use, the product. A product | ||
| 306 | is a consumer product regardless of whether the product has substantial | ||
| 307 | commercial, industrial or non-consumer uses, unless such uses represent | ||
| 308 | the only significant mode of use of the product. | ||
| 309 | |||
| 310 | "Installation Information" for a User Product means any methods, | ||
| 311 | procedures, authorization keys, or other information required to install | ||
| 312 | and execute modified versions of a covered work in that User Product from | ||
| 313 | a modified version of its Corresponding Source. The information must | ||
| 314 | suffice to ensure that the continued functioning of the modified object | ||
| 315 | code is in no case prevented or interfered with solely because | ||
| 316 | modification has been made. | ||
| 317 | |||
| 318 | If you convey an object code work under this section in, or with, or | ||
| 319 | specifically for use in, a User Product, and the conveying occurs as | ||
| 320 | part of a transaction in which the right of possession and use of the | ||
| 321 | User Product is transferred to the recipient in perpetuity or for a | ||
| 322 | fixed term (regardless of how the transaction is characterized), the | ||
| 323 | Corresponding Source conveyed under this section must be accompanied | ||
| 324 | by the Installation Information. But this requirement does not apply | ||
| 325 | if neither you nor any third party retains the ability to install | ||
| 326 | modified object code on the User Product (for example, the work has | ||
| 327 | been installed in ROM). | ||
| 328 | |||
| 329 | The requirement to provide Installation Information does not include a | ||
| 330 | requirement to continue to provide support service, warranty, or updates | ||
| 331 | for a work that has been modified or installed by the recipient, or for | ||
| 332 | the User Product in which it has been modified or installed. Access to a | ||
| 333 | network may be denied when the modification itself materially and | ||
| 334 | adversely affects the operation of the network or violates the rules and | ||
| 335 | protocols for communication across the network. | ||
| 336 | |||
| 337 | Corresponding Source conveyed, and Installation Information provided, | ||
| 338 | in accord with this section must be in a format that is publicly | ||
| 339 | documented (and with an implementation available to the public in | ||
| 340 | source code form), and must require no special password or key for | ||
| 341 | unpacking, reading or copying. | ||
| 342 | |||
| 343 | 7. Additional Terms. | ||
| 344 | |||
| 345 | "Additional permissions" are terms that supplement the terms of this | ||
| 346 | License by making exceptions from one or more of its conditions. | ||
| 347 | Additional permissions that are applicable to the entire Program shall | ||
| 348 | be treated as though they were included in this License, to the extent | ||
| 349 | that they are valid under applicable law. If additional permissions | ||
| 350 | apply only to part of the Program, that part may be used separately | ||
| 351 | under those permissions, but the entire Program remains governed by | ||
| 352 | this License without regard to the additional permissions. | ||
| 353 | |||
| 354 | When you convey a copy of a covered work, you may at your option | ||
| 355 | remove any additional permissions from that copy, or from any part of | ||
| 356 | it. (Additional permissions may be written to require their own | ||
| 357 | removal in certain cases when you modify the work.) You may place | ||
| 358 | additional permissions on material, added by you to a covered work, | ||
| 359 | for which you have or can give appropriate copyright permission. | ||
| 360 | |||
| 361 | Notwithstanding any other provision of this License, for material you | ||
| 362 | add to a covered work, you may (if authorized by the copyright holders of | ||
| 363 | that material) supplement the terms of this License with terms: | ||
| 364 | |||
| 365 | a) Disclaiming warranty or limiting liability differently from the | ||
| 366 | terms of sections 15 and 16 of this License; or | ||
| 367 | |||
| 368 | b) Requiring preservation of specified reasonable legal notices or | ||
| 369 | author attributions in that material or in the Appropriate Legal | ||
| 370 | Notices displayed by works containing it; or | ||
| 371 | |||
| 372 | c) Prohibiting misrepresentation of the origin of that material, or | ||
| 373 | requiring that modified versions of such material be marked in | ||
| 374 | reasonable ways as different from the original version; or | ||
| 375 | |||
| 376 | d) Limiting the use for publicity purposes of names of licensors or | ||
| 377 | authors of the material; or | ||
| 378 | |||
| 379 | e) Declining to grant rights under trademark law for use of some | ||
| 380 | trade names, trademarks, or service marks; or | ||
| 381 | |||
| 382 | f) Requiring indemnification of licensors and authors of that | ||
| 383 | material by anyone who conveys the material (or modified versions of | ||
| 384 | it) with contractual assumptions of liability to the recipient, for | ||
| 385 | any liability that these contractual assumptions directly impose on | ||
| 386 | those licensors and authors. | ||
| 387 | |||
| 388 | All other non-permissive additional terms are considered "further | ||
| 389 | restrictions" within the meaning of section 10. If the Program as you | ||
| 390 | received it, or any part of it, contains a notice stating that it is | ||
| 391 | governed by this License along with a term that is a further | ||
| 392 | restriction, you may remove that term. If a license document contains | ||
| 393 | a further restriction but permits relicensing or conveying under this | ||
| 394 | License, you may add to a covered work material governed by the terms | ||
| 395 | of that license document, provided that the further restriction does | ||
| 396 | not survive such relicensing or conveying. | ||
| 397 | |||
| 398 | If you add terms to a covered work in accord with this section, you | ||
| 399 | must place, in the relevant source files, a statement of the | ||
| 400 | additional terms that apply to those files, or a notice indicating | ||
| 401 | where to find the applicable terms. | ||
| 402 | |||
| 403 | Additional terms, permissive or non-permissive, may be stated in the | ||
| 404 | form of a separately written license, or stated as exceptions; | ||
| 405 | the above requirements apply either way. | ||
| 406 | |||
| 407 | 8. Termination. | ||
| 408 | |||
| 409 | You may not propagate or modify a covered work except as expressly | ||
| 410 | provided under this License. Any attempt otherwise to propagate or | ||
| 411 | modify it is void, and will automatically terminate your rights under | ||
| 412 | this License (including any patent licenses granted under the third | ||
| 413 | paragraph of section 11). | ||
| 414 | |||
| 415 | However, if you cease all violation of this License, then your | ||
| 416 | license from a particular copyright holder is reinstated (a) | ||
| 417 | provisionally, unless and until the copyright holder explicitly and | ||
| 418 | finally terminates your license, and (b) permanently, if the copyright | ||
| 419 | holder fails to notify you of the violation by some reasonable means | ||
| 420 | prior to 60 days after the cessation. | ||
| 421 | |||
| 422 | Moreover, your license from a particular copyright holder is | ||
| 423 | reinstated permanently if the copyright holder notifies you of the | ||
| 424 | violation by some reasonable means, this is the first time you have | ||
| 425 | received notice of violation of this License (for any work) from that | ||
| 426 | copyright holder, and you cure the violation prior to 30 days after | ||
| 427 | your receipt of the notice. | ||
| 428 | |||
| 429 | Termination of your rights under this section does not terminate the | ||
| 430 | licenses of parties who have received copies or rights from you under | ||
| 431 | this License. If your rights have been terminated and not permanently | ||
| 432 | reinstated, you do not qualify to receive new licenses for the same | ||
| 433 | material under section 10. | ||
| 434 | |||
| 435 | 9. Acceptance Not Required for Having Copies. | ||
| 436 | |||
| 437 | You are not required to accept this License in order to receive or | ||
| 438 | run a copy of the Program. Ancillary propagation of a covered work | ||
| 439 | occurring solely as a consequence of using peer-to-peer transmission | ||
| 440 | to receive a copy likewise does not require acceptance. However, | ||
| 441 | nothing other than this License grants you permission to propagate or | ||
| 442 | modify any covered work. These actions infringe copyright if you do | ||
| 443 | not accept this License. Therefore, by modifying or propagating a | ||
| 444 | covered work, you indicate your acceptance of this License to do so. | ||
| 445 | |||
| 446 | 10. Automatic Licensing of Downstream Recipients. | ||
| 447 | |||
| 448 | Each time you convey a covered work, the recipient automatically | ||
| 449 | receives a license from the original licensors, to run, modify and | ||
| 450 | propagate that work, subject to this License. You are not responsible | ||
| 451 | for enforcing compliance by third parties with this License. | ||
| 452 | |||
| 453 | An "entity transaction" is a transaction transferring control of an | ||
| 454 | organization, or substantially all assets of one, or subdividing an | ||
| 455 | organization, or merging organizations. If propagation of a covered | ||
| 456 | work results from an entity transaction, each party to that | ||
| 457 | transaction who receives a copy of the work also receives whatever | ||
| 458 | licenses to the work the party's predecessor in interest had or could | ||
| 459 | give under the previous paragraph, plus a right to possession of the | ||
| 460 | Corresponding Source of the work from the predecessor in interest, if | ||
| 461 | the predecessor has it or can get it with reasonable efforts. | ||
| 462 | |||
| 463 | You may not impose any further restrictions on the exercise of the | ||
| 464 | rights granted or affirmed under this License. For example, you may | ||
| 465 | not impose a license fee, royalty, or other charge for exercise of | ||
| 466 | rights granted under this License, and you may not initiate litigation | ||
| 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that | ||
| 468 | any patent claim is infringed by making, using, selling, offering for | ||
| 469 | sale, or importing the Program or any portion of it. | ||
| 470 | |||
| 471 | 11. Patents. | ||
| 472 | |||
| 473 | A "contributor" is a copyright holder who authorizes use under this | ||
| 474 | License of the Program or a work on which the Program is based. The | ||
| 475 | work thus licensed is called the contributor's "contributor version". | ||
| 476 | |||
| 477 | A contributor's "essential patent claims" are all patent claims | ||
| 478 | owned or controlled by the contributor, whether already acquired or | ||
| 479 | hereafter acquired, that would be infringed by some manner, permitted | ||
| 480 | by this License, of making, using, or selling its contributor version, | ||
| 481 | but do not include claims that would be infringed only as a | ||
| 482 | consequence of further modification of the contributor version. For | ||
| 483 | purposes of this definition, "control" includes the right to grant | ||
| 484 | patent sublicenses in a manner consistent with the requirements of | ||
| 485 | this License. | ||
| 486 | |||
| 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
| 488 | patent license under the contributor's essential patent claims, to | ||
| 489 | make, use, sell, offer for sale, import and otherwise run, modify and | ||
| 490 | propagate the contents of its contributor version. | ||
| 491 | |||
| 492 | In the following three paragraphs, a "patent license" is any express | ||
| 493 | agreement or commitment, however denominated, not to enforce a patent | ||
| 494 | (such as an express permission to practice a patent or covenant not to | ||
| 495 | sue for patent infringement). To "grant" such a patent license to a | ||
| 496 | party means to make such an agreement or commitment not to enforce a | ||
| 497 | patent against the party. | ||
| 498 | |||
| 499 | If you convey a covered work, knowingly relying on a patent license, | ||
| 500 | and the Corresponding Source of the work is not available for anyone | ||
| 501 | to copy, free of charge and under the terms of this License, through a | ||
| 502 | publicly available network server or other readily accessible means, | ||
| 503 | then you must either (1) cause the Corresponding Source to be so | ||
| 504 | available, or (2) arrange to deprive yourself of the benefit of the | ||
| 505 | patent license for this particular work, or (3) arrange, in a manner | ||
| 506 | consistent with the requirements of this License, to extend the patent | ||
| 507 | license to downstream recipients. "Knowingly relying" means you have | ||
| 508 | actual knowledge that, but for the patent license, your conveying the | ||
| 509 | covered work in a country, or your recipient's use of the covered work | ||
| 510 | in a country, would infringe one or more identifiable patents in that | ||
| 511 | country that you have reason to believe are valid. | ||
| 512 | |||
| 513 | If, pursuant to or in connection with a single transaction or | ||
| 514 | arrangement, you convey, or propagate by procuring conveyance of, a | ||
| 515 | covered work, and grant a patent license to some of the parties | ||
| 516 | receiving the covered work authorizing them to use, propagate, modify | ||
| 517 | or convey a specific copy of the covered work, then the patent license | ||
| 518 | you grant is automatically extended to all recipients of the covered | ||
| 519 | work and works based on it. | ||
| 520 | |||
| 521 | A patent license is "discriminatory" if it does not include within | ||
| 522 | the scope of its coverage, prohibits the exercise of, or is | ||
| 523 | conditioned on the non-exercise of one or more of the rights that are | ||
| 524 | specifically granted under this License. You may not convey a covered | ||
| 525 | work if you are a party to an arrangement with a third party that is | ||
| 526 | in the business of distributing software, under which you make payment | ||
| 527 | to the third party based on the extent of your activity of conveying | ||
| 528 | the work, and under which the third party grants, to any of the | ||
| 529 | parties who would receive the covered work from you, a discriminatory | ||
| 530 | patent license (a) in connection with copies of the covered work | ||
| 531 | conveyed by you (or copies made from those copies), or (b) primarily | ||
| 532 | for and in connection with specific products or compilations that | ||
| 533 | contain the covered work, unless you entered into that arrangement, | ||
| 534 | or that patent license was granted, prior to 28 March 2007. | ||
| 535 | |||
| 536 | Nothing in this License shall be construed as excluding or limiting | ||
| 537 | any implied license or other defenses to infringement that may | ||
| 538 | otherwise be available to you under applicable patent law. | ||
| 539 | |||
| 540 | 12. No Surrender of Others' Freedom. | ||
| 541 | |||
| 542 | If conditions are imposed on you (whether by court order, agreement or | ||
| 543 | otherwise) that contradict the conditions of this License, they do not | ||
| 544 | excuse you from the conditions of this License. If you cannot convey a | ||
| 545 | covered work so as to satisfy simultaneously your obligations under this | ||
| 546 | License and any other pertinent obligations, then as a consequence you may | ||
| 547 | not convey it at all. For example, if you agree to terms that obligate you | ||
| 548 | to collect a royalty for further conveying from those to whom you convey | ||
| 549 | the Program, the only way you could satisfy both those terms and this | ||
| 550 | License would be to refrain entirely from conveying the Program. | ||
| 551 | |||
| 552 | 13. Use with the GNU Affero General Public License. | ||
| 553 | |||
| 554 | Notwithstanding any other provision of this License, you have | ||
| 555 | permission to link or combine any covered work with a work licensed | ||
| 556 | under version 3 of the GNU Affero General Public License into a single | ||
| 557 | combined work, and to convey the resulting work. The terms of this | ||
| 558 | License will continue to apply to the part which is the covered work, | ||
| 559 | but the special requirements of the GNU Affero General Public License, | ||
| 560 | section 13, concerning interaction through a network will apply to the | ||
| 561 | combination as such. | ||
| 562 | |||
| 563 | 14. Revised Versions of this License. | ||
| 564 | |||
| 565 | The Free Software Foundation may publish revised and/or new versions of | ||
| 566 | the GNU General Public License from time to time. Such new versions will | ||
| 567 | be similar in spirit to the present version, but may differ in detail to | ||
| 568 | address new problems or concerns. | ||
| 569 | |||
| 570 | Each version is given a distinguishing version number. If the | ||
| 571 | Program specifies that a certain numbered version of the GNU General | ||
| 572 | Public License "or any later version" applies to it, you have the | ||
| 573 | option of following the terms and conditions either of that numbered | ||
| 574 | version or of any later version published by the Free Software | ||
| 575 | Foundation. If the Program does not specify a version number of the | ||
| 576 | GNU General Public License, you may choose any version ever published | ||
| 577 | by the Free Software Foundation. | ||
| 578 | |||
| 579 | If the Program specifies that a proxy can decide which future | ||
| 580 | versions of the GNU General Public License can be used, that proxy's | ||
| 581 | public statement of acceptance of a version permanently authorizes you | ||
| 582 | to choose that version for the Program. | ||
| 583 | |||
| 584 | Later license versions may give you additional or different | ||
| 585 | permissions. However, no additional obligations are imposed on any | ||
| 586 | author or copyright holder as a result of your choosing to follow a | ||
| 587 | later version. | ||
| 588 | |||
| 589 | 15. Disclaimer of Warranty. | ||
| 590 | |||
| 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
| 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
| 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | ||
| 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | ||
| 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | ||
| 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | ||
| 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
| 599 | |||
| 600 | 16. Limitation of Liability. | ||
| 601 | |||
| 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
| 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | ||
| 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | ||
| 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | ||
| 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | ||
| 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | ||
| 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | ||
| 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||
| 610 | SUCH DAMAGES. | ||
| 611 | |||
| 612 | 17. Interpretation of Sections 15 and 16. | ||
| 613 | |||
| 614 | If the disclaimer of warranty and limitation of liability provided | ||
| 615 | above cannot be given local legal effect according to their terms, | ||
| 616 | reviewing courts shall apply local law that most closely approximates | ||
| 617 | an absolute waiver of all civil liability in connection with the | ||
| 618 | Program, unless a warranty or assumption of liability accompanies a | ||
| 619 | copy of the Program in return for a fee. | ||
| 620 | |||
| 621 | END OF TERMS AND CONDITIONS | ||
| 622 | |||
| 623 | How to Apply These Terms to Your New Programs | ||
| 624 | |||
| 625 | If you develop a new program, and you want it to be of the greatest | ||
| 626 | possible use to the public, the best way to achieve this is to make it | ||
| 627 | free software which everyone can redistribute and change under these terms. | ||
| 628 | |||
| 629 | To do so, attach the following notices to the program. It is safest | ||
| 630 | to attach them to the start of each source file to most effectively | ||
| 631 | state the exclusion of warranty; and each file should have at least | ||
| 632 | the "copyright" line and a pointer to where the full notice is found. | ||
| 633 | |||
| 634 | <one line to give the program's name and a brief idea of what it does.> | ||
| 635 | Copyright (C) <year> <name of author> | ||
| 636 | |||
| 637 | This program is free software: you can redistribute it and/or modify | ||
| 638 | it under the terms of the GNU General Public License as published by | ||
| 639 | the Free Software Foundation, either version 3 of the License, or | ||
| 640 | (at your option) any later version. | ||
| 641 | |||
| 642 | This program is distributed in the hope that it will be useful, | ||
| 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 645 | GNU General Public License for more details. | ||
| 646 | |||
| 647 | You should have received a copy of the GNU General Public License | ||
| 648 | along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 649 | |||
| 650 | Also add information on how to contact you by electronic and paper mail. | ||
| 651 | |||
| 652 | If the program does terminal interaction, make it output a short | ||
| 653 | notice like this when it starts in an interactive mode: | ||
| 654 | |||
| 655 | <program> Copyright (C) <year> <name of author> | ||
| 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
| 657 | This is free software, and you are welcome to redistribute it | ||
| 658 | under certain conditions; type `show c' for details. | ||
| 659 | |||
| 660 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
| 661 | parts of the General Public License. Of course, your program's commands | ||
| 662 | might be different; for a GUI interface, you would use an "about box". | ||
| 663 | |||
| 664 | You should also get your employer (if you work as a programmer) or school, | ||
| 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. | ||
| 666 | For more information on this, and how to apply and follow the GNU GPL, see | ||
| 667 | <https://www.gnu.org/licenses/>. | ||
| 668 | |||
| 669 | The GNU General Public License does not permit incorporating your program | ||
| 670 | into proprietary programs. If your program is a subroutine library, you | ||
| 671 | may consider it more useful to permit linking proprietary applications with | ||
| 672 | the library. If this is what you want to do, use the GNU Lesser General | ||
| 673 | Public License instead of this License. But first, please read | ||
| 674 | <https://www.gnu.org/licenses/why-not-lgpl.html>. | ||
diff --git a/I3LOCK_VERSION b/I3LOCK_VERSION index 19462c2..f8f4f03 100644 --- a/I3LOCK_VERSION +++ b/I3LOCK_VERSION | |||
| @@ -1 +1 @@ | |||
| 2.12-non-git | 1.12.1 | ||
diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..cb2cde9 --- /dev/null +++ b/INSTALL.md | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | i3lock - improved screen locker | ||
| 2 | =============================== | ||
| 3 | [i3lock](https://i3wm.org/i3lock/)> is a simple screen locker like slock. | ||
| 4 | After starting it, you will see a white screen (you can configure the | ||
| 5 | color/an image). You can return to your screen by entering your password. | ||
| 6 | |||
| 7 | Many little improvements have been made to i3lock over time: | ||
| 8 | |||
| 9 | - i3lock forks, so you can combine it with an alias to suspend to RAM | ||
| 10 | (run "i3lock && echo mem > /sys/power/state" to get a locked screen | ||
| 11 | after waking up your computer from suspend to RAM) | ||
| 12 | |||
| 13 | - You can specify either a background color or a PNG image which will be | ||
| 14 | displayed while your screen is locked. Note that i3lock is not an image | ||
| 15 | manipulation software. If you need to resize the image to fill the screen | ||
| 16 | or similar, use existing tooling to do this before passing it to i3lock. | ||
| 17 | |||
| 18 | - You can specify whether i3lock should bell upon a wrong password. | ||
| 19 | |||
| 20 | - i3lock uses PAM and therefore is compatible with LDAP etc. | ||
| 21 | On OpenBSD i3lock uses the bsd_auth(3) framework. | ||
| 22 | |||
| 23 | Install | ||
| 24 | ------- | ||
| 25 | |||
| 26 | See [the i3lock home page](https://i3wm.org/i3lock/). | ||
| 27 | |||
| 28 | Requirements | ||
| 29 | ------------ | ||
| 30 | - pkg-config | ||
| 31 | - libxcb | ||
| 32 | - libxcb-util | ||
| 33 | - libpam-dev | ||
| 34 | - libcairo-dev | ||
| 35 | - libxcb-xinerama | ||
| 36 | - libxcb-randr | ||
| 37 | - libev | ||
| 38 | - libx11-dev | ||
| 39 | - libx11-xcb-dev | ||
| 40 | - libxkbcommon >= 0.5.0 | ||
| 41 | - libxkbcommon-x11 >= 0.5.0 | ||
| 42 | - libxcb-image | ||
| 43 | - libxcb-xrm | ||
| 44 | |||
| 45 | Running i3lock | ||
| 46 | ------------- | ||
| 47 | Simply invoke the 'i3lock' command. To get out of it, enter your password and | ||
| 48 | press enter. | ||
| 49 | |||
| 50 | On OpenBSD the `i3lock` binary needs to be setgid `auth` to call the | ||
| 51 | authentication helpers, e.g. `/usr/libexec/auth/login_passwd`. | ||
| 52 | |||
| 53 | Building i3lock | ||
| 54 | --------------- | ||
| 55 | We recommend you use the provided package from your distribution. Do not build | ||
| 56 | i3lock unless you have a reason to do so. | ||
| 57 | |||
| 58 | First install the dependencies listed in requirements section, then run these | ||
| 59 | commands (might need to be adapted to your OS): | ||
| 60 | ``` | ||
| 61 | autoreconf --force --install | ||
| 62 | |||
| 63 | rm -rf build/ | ||
| 64 | mkdir -p build && cd build/ | ||
| 65 | |||
| 66 | ../configure \ | ||
| 67 | --prefix=/usr \ | ||
| 68 | --sysconfdir=/etc \ | ||
| 69 | --disable-sanitizers | ||
| 70 | |||
| 71 | make | ||
| 72 | ``` | ||
| 73 | |||
| 74 | Upstream | ||
| 75 | -------- | ||
| 76 | Please submit pull requests to https://github.com/i3/i3lock | ||
| @@ -1,3 +1,23 @@ | |||
| 1 | i3lock-extended | ||
| 2 | Copyright (C) 2020 Simeon Simeonov | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 3 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | |||
| 17 | |||
| 18 | This software includes software copyrighted by Michael Stapelberg and | ||
| 19 | distributed under the following license: | ||
| 20 | |||
| 1 | Copyright © 2010-2011, Michael Stapelberg | 21 | Copyright © 2010-2011, Michael Stapelberg |
| 2 | All rights reserved. | 22 | All rights reserved. |
| 3 | 23 | ||
diff --git a/Makefile.am b/Makefile.am index 5847975..f9323b8 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -3,18 +3,18 @@ | |||
| 3 | echo-version: | 3 | echo-version: |
| 4 | @echo "@I3LOCK_VERSION@" | 4 | @echo "@I3LOCK_VERSION@" |
| 5 | 5 | ||
| 6 | bin_PROGRAMS = i3lock | 6 | bin_PROGRAMS = i3lock-extended |
| 7 | 7 | ||
| 8 | dist_man1_MANS = i3lock.1 | 8 | dist_man1_MANS = i3lock-extended.1 |
| 9 | 9 | ||
| 10 | pamddir = $(sysconfdir)/pam.d | 10 | pamddir = $(sysconfdir)/pam.d |
| 11 | pamd_files = pam/i3lock | 11 | pamd_files = pam/i3lock-extended |
| 12 | pamd_DATA = $(pamd_files) | 12 | pamd_DATA = $(pamd_files) |
| 13 | 13 | ||
| 14 | AM_CPPFLAGS = \ | 14 | AM_CPPFLAGS = \ |
| 15 | @AX_EXTEND_SRCDIR_CPPFLAGS@ | 15 | @AX_EXTEND_SRCDIR_CPPFLAGS@ |
| 16 | 16 | ||
| 17 | i3lock_CFLAGS = \ | 17 | i3lock_extended_CFLAGS = \ |
| 18 | $(AM_CFLAGS) \ | 18 | $(AM_CFLAGS) \ |
| 19 | $(XCB_CFLAGS) \ | 19 | $(XCB_CFLAGS) \ |
| 20 | $(XCB_IMAGE_CFLAGS) \ | 20 | $(XCB_IMAGE_CFLAGS) \ |
| @@ -22,13 +22,14 @@ i3lock_CFLAGS = \ | |||
| 22 | $(XCB_UTIL_XRM_CFLAGS) \ | 22 | $(XCB_UTIL_XRM_CFLAGS) \ |
| 23 | $(XKBCOMMON_CFLAGS) \ | 23 | $(XKBCOMMON_CFLAGS) \ |
| 24 | $(CAIRO_CFLAGS) \ | 24 | $(CAIRO_CFLAGS) \ |
| 25 | -DEXTRAS \ | ||
| 25 | $(CODE_COVERAGE_CFLAGS) | 26 | $(CODE_COVERAGE_CFLAGS) |
| 26 | 27 | ||
| 27 | i3lock_CPPFLAGS = \ | 28 | i3lock_extended_CPPFLAGS = \ |
| 28 | $(AM_CPPFLAGS) \ | 29 | $(AM_CPPFLAGS) \ |
| 29 | $(CODE_COVERAGE_CPPFLAGS) | 30 | $(CODE_COVERAGE_CPPFLAGS) |
| 30 | 31 | ||
| 31 | i3lock_LDADD = \ | 32 | i3lock_extended_LDADD = \ |
| 32 | $(XCB_LIBS) \ | 33 | $(XCB_LIBS) \ |
| 33 | $(XCB_IMAGE_LIBS) \ | 34 | $(XCB_IMAGE_LIBS) \ |
| 34 | $(XCB_UTIL_LIBS) \ | 35 | $(XCB_UTIL_LIBS) \ |
| @@ -37,10 +38,12 @@ i3lock_LDADD = \ | |||
| 37 | $(CAIRO_LIBS) \ | 38 | $(CAIRO_LIBS) \ |
| 38 | $(CODE_COVERAGE_LDFLAGS) | 39 | $(CODE_COVERAGE_LDFLAGS) |
| 39 | 40 | ||
| 40 | i3lock_SOURCES = \ | 41 | i3lock_extended_SOURCES = \ |
| 41 | cursors.h \ | 42 | cursors.h \ |
| 42 | dpi.c \ | 43 | dpi.c \ |
| 43 | dpi.h \ | 44 | dpi.h \ |
| 45 | extras.c \ | ||
| 46 | extras.h \ | ||
| 44 | i3lock.c \ | 47 | i3lock.c \ |
| 45 | i3lock.h \ | 48 | i3lock.h \ |
| 46 | randr.c \ | 49 | randr.c \ |
| @@ -1,76 +1,34 @@ | |||
| 1 | i3lock - improved screen locker | 1 | ## i3lock-extended |
| 2 | =============================== | ||
| 3 | [i3lock](https://i3wm.org/i3lock/)> is a simple screen locker like slock. | ||
| 4 | After starting it, you will see a white screen (you can configure the | ||
| 5 | color/an image). You can return to your screen by entering your password. | ||
| 6 | 2 | ||
| 7 | Many little improvements have been made to i3lock over time: | 3 | i3lock-extended is a fork of i3lock (https://github.com/i3/i3lock). |
| 4 | It was started by Simeon Simeonov (https://simeon.simeonov.no) as a small hack, | ||
| 5 | implementing a LED-clock on top of an existing and robust screensaver. | ||
| 8 | 6 | ||
| 9 | - i3lock forks, so you can combine it with an alias to suspend to RAM | 7 | i3lock-extended adds some additional functionality and is a free-software |
| 10 | (run "i3lock && echo mem > /sys/power/state" to get a locked screen | 8 | licenced under the GPL3+. Most of the code is copyrighted by Michael Stapelberg |
| 11 | after waking up your computer from suspend to RAM) | 9 | under a different license. See LICENSE for more information\! |
| 12 | 10 | ||
| 13 | - You can specify either a background color or a PNG image which will be | 11 | The original README.md file from i3lock, containing installation instructions |
| 14 | displayed while your screen is locked. Note that i3lock is not an image | 12 | can be found as INSTALL.md. |
| 15 | manipulation software. If you need to resize the image to fill the screen | ||
| 16 | or similar, use existing tooling to do this before passing it to i3lock. | ||
| 17 | 13 | ||
| 18 | - You can specify whether i3lock should bell upon a wrong password. | ||
| 19 | 14 | ||
| 20 | - i3lock uses PAM and therefore is compatible with LDAP etc. | 15 | ### Additional features |
| 21 | On OpenBSD i3lock uses the bsd_auth(3) framework. | ||
| 22 | 16 | ||
| 23 | Install | 17 | - LED-clock |
| 24 | ------- | 18 | - Digital clock |
| 19 | - Elapsed time since activation | ||
| 20 | - Display-text | ||
| 25 | 21 | ||
| 26 | See [the i3lock home page](https://i3wm.org/i3lock/). | 22 | i3lock-extended includes all of the original code and features of i3lock. |
| 27 | 23 | ||
| 28 | Requirements | 24 | Please refer to the manual page for more details and information about the different parameters\! |
| 29 | ------------ | ||
| 30 | - pkg-config | ||
| 31 | - libxcb | ||
| 32 | - libxcb-util | ||
| 33 | - libpam-dev | ||
| 34 | - libcairo-dev | ||
| 35 | - libxcb-xinerama | ||
| 36 | - libxcb-randr | ||
| 37 | - libev | ||
| 38 | - libx11-dev | ||
| 39 | - libx11-xcb-dev | ||
| 40 | - libxkbcommon >= 0.5.0 | ||
| 41 | - libxkbcommon-x11 >= 0.5.0 | ||
| 42 | - libxcb-image | ||
| 43 | - libxcb-xrm | ||
| 44 | 25 | ||
| 45 | Running i3lock | ||
| 46 | ------------- | ||
| 47 | Simply invoke the 'i3lock' command. To get out of it, enter your password and | ||
| 48 | press enter. | ||
| 49 | 26 | ||
| 50 | On OpenBSD the `i3lock` binary needs to be setgid `auth` to call the | 27 | ### Versioning |
| 51 | authentication helpers, e.g. `/usr/libexec/auth/login_passwd`. | ||
| 52 | 28 | ||
| 53 | Building i3lock | 29 | i3lock-extended will merge the changes and fixes coming to i3lock in the |
| 54 | --------------- | 30 | future. |
| 55 | We recommend you use the provided package from your distribution. Do not build | ||
| 56 | i3lock unless you have a reason to do so. | ||
| 57 | 31 | ||
| 58 | First install the dependencies listed in requirements section, then run these | 32 | In order to create more clarity the version format for i3lock-extended will be: |
| 59 | commands (might need to be adapted to your OS): | 33 | \<extended version starting from 1>.\<i3lock version that is merged in\>[a-z |
| 60 | ``` | 34 | extended revision if used]. |
| 61 | autoreconf --force --install | ||
| 62 | |||
| 63 | rm -rf build/ | ||
| 64 | mkdir -p build && cd build/ | ||
| 65 | |||
| 66 | ../configure \ | ||
| 67 | --prefix=/usr \ | ||
| 68 | --sysconfdir=/etc \ | ||
| 69 | --disable-sanitizers | ||
| 70 | |||
| 71 | make | ||
| 72 | ``` | ||
| 73 | |||
| 74 | Upstream | ||
| 75 | -------- | ||
| 76 | Please submit pull requests to https://github.com/i3/i3lock | ||
diff --git a/configure.ac b/configure.ac index 474f750..5fe3e33 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Run autoreconf -fi to generate a configure script from this file. | 2 | # Run autoreconf -fi to generate a configure script from this file. |
| 3 | 3 | ||
| 4 | AC_PREREQ([2.69]) | 4 | AC_PREREQ([2.69]) |
| 5 | AC_INIT([i3lock], [2.12], [https://github.com/i3/i3lock/issues]) | 5 | AC_INIT([i3lock-extended], [1.2.12], [https://simeon.simeonov.no]) |
| 6 | # For AX_EXTEND_SRCDIR | 6 | # For AX_EXTEND_SRCDIR |
| 7 | AX_ENABLE_BUILDDIR | 7 | AX_ENABLE_BUILDDIR |
| 8 | AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2]) | 8 | AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2]) |
| @@ -141,7 +141,7 @@ echo \ | |||
| 141 | "-------------------------------------------------------------------------------- | 141 | "-------------------------------------------------------------------------------- |
| 142 | build configured: | 142 | build configured: |
| 143 | 143 | ||
| 144 | AS_HELP_STRING([i3lock version:], [`echo ${I3LOCK_VERSION} | sed 's,\\\\,,g'`]) | 144 | AS_HELP_STRING([i3lock-extended version:], [`echo ${I3LOCK_VERSION} | sed 's,\\\\,,g'`]) |
| 145 | AS_HELP_STRING([is release version:], [${is_release}]) | 145 | AS_HELP_STRING([is release version:], [${is_release}]) |
| 146 | 146 | ||
| 147 | AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}]) | 147 | AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}]) |
diff --git a/extras.c b/extras.c new file mode 100644 index 0000000..37819f5 --- /dev/null +++ b/extras.c | |||
| @@ -0,0 +1,448 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of i3lock-extended | ||
| 3 | * Copyright (C) 2020 Simeon Simeonov | ||
| 4 | |||
| 5 | * i3lock-extended is free software: you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation, either version 3 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | |||
| 10 | * i3lock-extended is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | |||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdint.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | |||
| 24 | #include <cairo.h> | ||
| 25 | |||
| 26 | #include <xcb/xcb.h> | ||
| 27 | #include <xcb/xcb_aux.h> | ||
| 28 | #include <xcb/randr.h> | ||
| 29 | |||
| 30 | #include "randr.h" | ||
| 31 | #include "extras.h" | ||
| 32 | |||
| 33 | |||
| 34 | extern int failed_attempts; | ||
| 35 | |||
| 36 | |||
| 37 | static void i3lock_color_to_array(double *rgb16, const char *color) { | ||
| 38 | |||
| 39 | char strgroups[3][3] = {{color[0], color[1], '\0'}, | ||
| 40 | {color[2], color[3], '\0'}, | ||
| 41 | {color[4], color[5], '\0'}}; | ||
| 42 | *rgb16 = strtol(strgroups[0], NULL, 16) / 255.0; | ||
| 43 | *(rgb16 + 1) = strtol(strgroups[1], NULL, 16) / 255.0; | ||
| 44 | *(rgb16 + 2) = strtol(strgroups[2], NULL, 16) / 255.0; | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | static void i3clock_fetch_digital_clock_xy(int *x, | ||
| 50 | int *y, | ||
| 51 | const i3lock_digital_clock_t *dc, | ||
| 52 | const uint32_t *resolution, | ||
| 53 | int text_length) { | ||
| 54 | |||
| 55 | /* x */ | ||
| 56 | if (dc->horizontal_alignment == I3LOCK_ALIGN_CENTER) { | ||
| 57 | *x = resolution[0] / 2 - text_length * dc->text_size / 2; | ||
| 58 | } else if (dc->horizontal_alignment == I3LOCK_ALIGN_RIGHT) { | ||
| 59 | *x = resolution[0] - resolution[0] / 10 - text_length * dc->text_size; | ||
| 60 | } else { | ||
| 61 | /* left */ | ||
| 62 | *x = resolution[0] / 10; /* 10% */ | ||
| 63 | } | ||
| 64 | |||
| 65 | /* y */ | ||
| 66 | if (dc->vertical_alignment == I3LOCK_ALIGN_MIDDLE) { | ||
| 67 | *y = resolution[1] / 2 - dc->text_size / 2; | ||
| 68 | } else if (dc->vertical_alignment == I3LOCK_ALIGN_BOTTOM) { | ||
| 69 | *y = resolution[1] - resolution[1] / 10 - dc->text_size; | ||
| 70 | } else { | ||
| 71 | /* top */ | ||
| 72 | *y = resolution[1] / 10; /* 10% */ | ||
| 73 | } | ||
| 74 | |||
| 75 | } | ||
| 76 | |||
| 77 | |||
| 78 | static void i3clock_fetch_led_clock_xy(int *x, | ||
| 79 | int *y, | ||
| 80 | const i3lock_led_clock_t *lc, | ||
| 81 | const uint32_t *resolution) { | ||
| 82 | int clock_length, clock_height; | ||
| 83 | |||
| 84 | /* x */ | ||
| 85 | clock_length = 6 * resolution[1] / I3LOCK_SCALE_LED_SPACING + \ | ||
| 86 | 5 * resolution[1] / I3LOCK_SCALE_LED_LENGTH; | ||
| 87 | if (lc->horizontal_alignment == I3LOCK_ALIGN_CENTER) { | ||
| 88 | *x = resolution[0] / 2 - clock_length / 2; | ||
| 89 | } else if (lc->horizontal_alignment == I3LOCK_ALIGN_RIGHT) { | ||
| 90 | *x = resolution[0] - resolution[0] / 10 - clock_length; | ||
| 91 | } else { | ||
| 92 | /* left */ | ||
| 93 | *x = resolution[0] / 10; /* 10% */ | ||
| 94 | } | ||
| 95 | |||
| 96 | /* y */ | ||
| 97 | clock_height = 3 * resolution[1] / I3LOCK_SCALE_LED_SPACING + \ | ||
| 98 | 2 * resolution[1] / I3LOCK_SCALE_LED_LENGTH; | ||
| 99 | if (lc->vertical_alignment == I3LOCK_ALIGN_MIDDLE) { | ||
| 100 | *y = resolution[1] / 2 - clock_height / 2; | ||
| 101 | } else if (lc->vertical_alignment == I3LOCK_ALIGN_BOTTOM) { | ||
| 102 | *y = resolution[1] - resolution[1] / 10 - clock_height; | ||
| 103 | } else { | ||
| 104 | /* top */ | ||
| 105 | *y = resolution[1] / 10; /* 10% */ | ||
| 106 | } | ||
| 107 | |||
| 108 | } | ||
| 109 | |||
| 110 | |||
| 111 | static void i3lock_draw_led(cairo_t *cr, | ||
| 112 | double x, | ||
| 113 | double y, | ||
| 114 | double length, | ||
| 115 | int type, | ||
| 116 | const i3lock_led_clock_t *lc) { | ||
| 117 | double border_color[3], face_color[3]; | ||
| 118 | i3lock_color_to_array(border_color, lc->led_border_color); | ||
| 119 | if (type) { | ||
| 120 | /* LED on */ | ||
| 121 | i3lock_color_to_array(face_color, lc->led_on_color); | ||
| 122 | } else { | ||
| 123 | i3lock_color_to_array(face_color, lc->led_off_color); | ||
| 124 | } | ||
| 125 | cairo_set_line_width(cr, 2); | ||
| 126 | cairo_rectangle(cr, x, y, length, length); | ||
| 127 | cairo_set_source_rgb(cr, face_color[0], face_color[1], face_color[2]); | ||
| 128 | cairo_fill(cr); | ||
| 129 | cairo_rectangle(cr, x, y, length, length); | ||
| 130 | cairo_set_source_rgb(cr, border_color[0], border_color[1], border_color[2]); | ||
| 131 | cairo_stroke(cr); | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | void i3lock_draw_digital_clock(cairo_t *cr, | ||
| 136 | const i3lock_digital_clock_t *dc, | ||
| 137 | const uint32_t *resolution, | ||
| 138 | const struct tm *brokentime) { | ||
| 139 | double rgb16[3]; | ||
| 140 | char current_time_str[128]; | ||
| 141 | int x, y; | ||
| 142 | strftime(current_time_str, | ||
| 143 | 128, | ||
| 144 | dc->template, | ||
| 145 | brokentime); | ||
| 146 | i3lock_color_to_array(rgb16, dc->color); | ||
| 147 | cairo_set_source_rgb(cr, | ||
| 148 | rgb16[0], | ||
| 149 | rgb16[1], | ||
| 150 | rgb16[2]); | ||
| 151 | cairo_set_font_size(cr, dc->text_size); | ||
| 152 | if (xr_screens > 0) { | ||
| 153 | /* xinerama */ | ||
| 154 | int screen; | ||
| 155 | uint32_t screen_resolution[2]; | ||
| 156 | for (screen = 0; screen < xr_screens; ++screen) { | ||
| 157 | screen_resolution[0] = xr_resolutions[screen].width; | ||
| 158 | screen_resolution[1] = xr_resolutions[screen].height; | ||
| 159 | i3clock_fetch_digital_clock_xy(&x, | ||
| 160 | &y, | ||
| 161 | dc, | ||
| 162 | screen_resolution, | ||
| 163 | strlen(current_time_str)); | ||
| 164 | cairo_move_to(cr, | ||
| 165 | x + xr_resolutions[screen].x, | ||
| 166 | y + xr_resolutions[screen].y); | ||
| 167 | cairo_show_text(cr, current_time_str); | ||
| 168 | } | ||
| 169 | return; | ||
| 170 | } | ||
| 171 | |||
| 172 | i3clock_fetch_digital_clock_xy(&x, | ||
| 173 | &y, | ||
| 174 | dc, | ||
| 175 | resolution, | ||
| 176 | strlen(current_time_str)); | ||
| 177 | /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ | ||
| 178 | cairo_move_to(cr, x, y); | ||
| 179 | cairo_show_text(cr, current_time_str); | ||
| 180 | |||
| 181 | } | ||
| 182 | |||
| 183 | |||
| 184 | void i3lock_draw_string(cairo_t *cr, | ||
| 185 | const char *formatted_string, | ||
| 186 | const i3lock_elapsed_time_t *et, | ||
| 187 | const uint32_t *resolution) { | ||
| 188 | double rgb16[3]; | ||
| 189 | int x, y; | ||
| 190 | |||
| 191 | /* create a dummy i3lock_digital_clock_t structure in order to reuse | ||
| 192 | i3clock_fetch_digital_clock_xy */ | ||
| 193 | i3lock_digital_clock_t dc = {et->text_size, | ||
| 194 | "", | ||
| 195 | "", | ||
| 196 | et->horizontal_alignment, | ||
| 197 | et->vertical_alignment}; | ||
| 198 | i3lock_color_to_array(rgb16, et->color); | ||
| 199 | cairo_set_source_rgb(cr, | ||
| 200 | rgb16[0], | ||
| 201 | rgb16[1], | ||
| 202 | rgb16[2]); | ||
| 203 | cairo_set_font_size(cr, et->text_size); | ||
| 204 | if (xr_screens > 0) { | ||
| 205 | /* xinerama */ | ||
| 206 | int screen; | ||
| 207 | uint32_t screen_resolution[2]; | ||
| 208 | for (screen = 0; screen < xr_screens; ++screen) { | ||
| 209 | screen_resolution[0] = xr_resolutions[screen].width; | ||
| 210 | screen_resolution[1] = xr_resolutions[screen].height; | ||
| 211 | i3clock_fetch_digital_clock_xy(&x, | ||
| 212 | &y, | ||
| 213 | &dc, | ||
| 214 | screen_resolution, | ||
| 215 | strlen(formatted_string)); | ||
| 216 | cairo_move_to(cr, | ||
| 217 | x + xr_resolutions[screen].x, | ||
| 218 | y + xr_resolutions[screen].y); | ||
| 219 | cairo_show_text(cr, formatted_string); | ||
| 220 | } | ||
| 221 | return; | ||
| 222 | } | ||
| 223 | |||
| 224 | i3clock_fetch_digital_clock_xy(&x, | ||
| 225 | &y, | ||
| 226 | &dc, | ||
| 227 | resolution, | ||
| 228 | strlen(formatted_string)); | ||
| 229 | /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ | ||
| 230 | cairo_move_to(cr, x, y); | ||
| 231 | cairo_show_text(cr, formatted_string); | ||
| 232 | |||
| 233 | } | ||
| 234 | |||
| 235 | |||
| 236 | void i3lock_draw_elapsed_time(cairo_t *cr, | ||
| 237 | const i3lock_elapsed_time_t *et, | ||
| 238 | const uint32_t *resolution, | ||
| 239 | const time_t *now) { | ||
| 240 | double rgb16[3]; | ||
| 241 | char elapsed_time_str[128]; | ||
| 242 | int x, y, seconds, minutes, hours, diff_seconds; | ||
| 243 | |||
| 244 | /* create a dummy i3lock_digital_clock_t structure in ordet to reuse | ||
| 245 | i3clock_fetch_digital_clock_xy */ | ||
| 246 | i3lock_digital_clock_t dc = {et->text_size, | ||
| 247 | "", | ||
| 248 | "", | ||
| 249 | et->horizontal_alignment, | ||
| 250 | et->vertical_alignment}; | ||
| 251 | |||
| 252 | diff_seconds = (int) difftime(*now, et->start_time); | ||
| 253 | hours = diff_seconds / 3600; | ||
| 254 | minutes = (diff_seconds - hours * 3600) / 60; | ||
| 255 | seconds = diff_seconds - hours * 3600 - minutes * 60; | ||
| 256 | if (hours) { | ||
| 257 | snprintf(elapsed_time_str, | ||
| 258 | 128, | ||
| 259 | "%d:%02d:%02d", | ||
| 260 | hours, | ||
| 261 | minutes, | ||
| 262 | seconds); | ||
| 263 | } else { | ||
| 264 | snprintf(elapsed_time_str, 128, "%02d:%02d", minutes, seconds); | ||
| 265 | } | ||
| 266 | if (failed_attempts) { | ||
| 267 | char failed_attempts_str[16]; /* ... that many attempts */ | ||
| 268 | snprintf(failed_attempts_str, | ||
| 269 | 16, | ||
| 270 | " (%d)", | ||
| 271 | failed_attempts); | ||
| 272 | strncat(elapsed_time_str, failed_attempts_str, 16); | ||
| 273 | } | ||
| 274 | i3lock_color_to_array(rgb16, et->color); | ||
| 275 | cairo_set_source_rgb(cr, | ||
| 276 | rgb16[0], | ||
| 277 | rgb16[1], | ||
| 278 | rgb16[2]); | ||
| 279 | cairo_set_font_size(cr, et->text_size); | ||
| 280 | if (xr_screens > 0) { | ||
| 281 | /* xinerama */ | ||
| 282 | int screen; | ||
| 283 | uint32_t screen_resolution[2]; | ||
| 284 | for (screen = 0; screen < xr_screens; ++screen) { | ||
| 285 | screen_resolution[0] = xr_resolutions[screen].width; | ||
| 286 | screen_resolution[1] = xr_resolutions[screen].height; | ||
| 287 | i3clock_fetch_digital_clock_xy(&x, | ||
| 288 | &y, | ||
| 289 | &dc, | ||
| 290 | screen_resolution, | ||
| 291 | strlen(elapsed_time_str)); | ||
| 292 | cairo_move_to(cr, | ||
| 293 | x + xr_resolutions[screen].x, | ||
| 294 | y + xr_resolutions[screen].y); | ||
| 295 | cairo_show_text(cr, elapsed_time_str); | ||
| 296 | } | ||
| 297 | return; | ||
| 298 | } | ||
| 299 | |||
| 300 | i3clock_fetch_digital_clock_xy(&x, | ||
| 301 | &y, | ||
| 302 | &dc, | ||
| 303 | resolution, | ||
| 304 | strlen(elapsed_time_str)); | ||
| 305 | /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ | ||
| 306 | cairo_move_to(cr, x, y); | ||
| 307 | cairo_show_text(cr, elapsed_time_str); | ||
| 308 | |||
| 309 | } | ||
| 310 | |||
| 311 | |||
| 312 | void i3lock_draw_led_clock(cairo_t *cr, | ||
| 313 | const i3lock_led_clock_t *lc, | ||
| 314 | const uint32_t *resolution, | ||
| 315 | const struct tm *brokentime) { | ||
| 316 | int side_length, space_length, base_x, base_y; | ||
| 317 | int base_x_h; /* used to make the code more readable */ | ||
| 318 | if (xr_screens > 0) { | ||
| 319 | /* xinerama */ | ||
| 320 | int screen; | ||
| 321 | uint32_t screen_resolution[2]; | ||
| 322 | for (screen = 0; screen < xr_screens; ++screen) { | ||
| 323 | screen_resolution[0] = xr_resolutions[screen].width; | ||
| 324 | screen_resolution[1] = xr_resolutions[screen].height; | ||
| 325 | side_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_SPACING; | ||
| 326 | space_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_LENGTH; | ||
| 327 | i3clock_fetch_led_clock_xy(&base_x, | ||
| 328 | &base_y, | ||
| 329 | lc, | ||
| 330 | screen_resolution); | ||
| 331 | base_x += xr_resolutions[screen].x; | ||
| 332 | base_y += xr_resolutions[screen].y; | ||
| 333 | base_x_h = base_x + space_length / 2 + side_length / 2; | ||
| 334 | |||
| 335 | /* hours */ | ||
| 336 | i3lock_draw_led(cr, | ||
| 337 | base_x_h, | ||
| 338 | base_y, | ||
| 339 | side_length, | ||
| 340 | brokentime->tm_hour & 16, | ||
| 341 | lc); | ||
| 342 | i3lock_draw_led(cr, | ||
| 343 | base_x_h + space_length + side_length, | ||
| 344 | base_y, | ||
| 345 | side_length, | ||
| 346 | brokentime->tm_hour & 8, | ||
| 347 | lc); | ||
| 348 | i3lock_draw_led(cr, | ||
| 349 | base_x_h + 2 * (space_length + side_length), | ||
| 350 | base_y, | ||
| 351 | side_length, | ||
| 352 | brokentime->tm_hour & 4, | ||
| 353 | lc); | ||
| 354 | i3lock_draw_led(cr, | ||
| 355 | base_x_h + 3 * (space_length + side_length), | ||
| 356 | base_y, | ||
| 357 | side_length, | ||
| 358 | brokentime->tm_hour & 2, | ||
| 359 | lc); | ||
| 360 | i3lock_draw_led(cr, | ||
| 361 | base_x_h + 4 * (space_length + side_length), | ||
| 362 | base_y, | ||
| 363 | side_length, | ||
| 364 | brokentime->tm_hour & 1, | ||
| 365 | lc); | ||
| 366 | |||
| 367 | /* minutes */ | ||
| 368 | i3lock_draw_led(cr, | ||
| 369 | base_x, | ||
| 370 | base_y + side_length + space_length, | ||
| 371 | side_length, | ||
| 372 | brokentime->tm_min & 32, | ||
| 373 | lc); | ||
| 374 | i3lock_draw_led(cr, | ||
| 375 | base_x + side_length + space_length, | ||
| 376 | base_y + side_length + space_length, | ||
| 377 | side_length, | ||
| 378 | brokentime->tm_min & 16, | ||
| 379 | lc); | ||
| 380 | i3lock_draw_led(cr, | ||
| 381 | base_x + 2 * (side_length + space_length), | ||
| 382 | base_y + side_length + space_length, | ||
| 383 | side_length, | ||
| 384 | brokentime->tm_min & 8, | ||
| 385 | lc); | ||
| 386 | i3lock_draw_led(cr, | ||
| 387 | base_x + 3 * (side_length + space_length), | ||
| 388 | base_y + side_length + space_length, | ||
| 389 | side_length, | ||
| 390 | brokentime->tm_min & 4, | ||
| 391 | lc); | ||
| 392 | i3lock_draw_led(cr, | ||
| 393 | base_x + 4 * (side_length + space_length), | ||
| 394 | base_y + side_length + space_length, | ||
| 395 | side_length, | ||
| 396 | brokentime->tm_min & 2, | ||
| 397 | lc); | ||
| 398 | i3lock_draw_led(cr, | ||
| 399 | base_x + 5 * (side_length + space_length), | ||
| 400 | base_y + side_length + space_length, | ||
| 401 | side_length, | ||
| 402 | brokentime->tm_min & 1, | ||
| 403 | lc); | ||
| 404 | |||
| 405 | /* seconds */ | ||
| 406 | i3lock_draw_led(cr, | ||
| 407 | base_x, | ||
| 408 | base_y + 2 * (side_length + space_length), | ||
| 409 | side_length, | ||
| 410 | brokentime->tm_sec & 32, | ||
| 411 | lc); | ||
| 412 | i3lock_draw_led(cr, | ||
| 413 | base_x + side_length + space_length, | ||
| 414 | base_y + 2 * (side_length + space_length), | ||
| 415 | side_length, | ||
| 416 | brokentime->tm_sec & 16, | ||
| 417 | lc); | ||
| 418 | i3lock_draw_led(cr, | ||
| 419 | base_x + 2 * (side_length + space_length), | ||
| 420 | base_y + 2 * (side_length + space_length), | ||
| 421 | side_length, | ||
| 422 | brokentime->tm_sec & 8, | ||
| 423 | lc); | ||
| 424 | i3lock_draw_led(cr, | ||
| 425 | base_x + 3 * (side_length + space_length), | ||
| 426 | base_y + 2 * (side_length + space_length), | ||
| 427 | side_length, | ||
| 428 | brokentime->tm_sec & 4, | ||
| 429 | lc); | ||
| 430 | i3lock_draw_led(cr, | ||
| 431 | base_x + 4 * (side_length + space_length), | ||
| 432 | base_y + 2 * (side_length + space_length), | ||
| 433 | side_length, | ||
| 434 | brokentime->tm_sec & 2, | ||
| 435 | lc); | ||
| 436 | i3lock_draw_led(cr, | ||
| 437 | base_x + 5 * (side_length + space_length), | ||
| 438 | base_y + 2 * (side_length + space_length), | ||
| 439 | side_length, | ||
| 440 | brokentime->tm_sec & 1, | ||
| 441 | lc); | ||
| 442 | } | ||
| 443 | return; | ||
| 444 | } | ||
| 445 | |||
| 446 | } | ||
| 447 | |||
| 448 | |||
diff --git a/extras.h b/extras.h new file mode 100644 index 0000000..d4a353e --- /dev/null +++ b/extras.h | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of i3lock-extended | ||
| 3 | * Copyright (C) 2020 Simeon Simeonov | ||
| 4 | |||
| 5 | * i3lock-extended is free software: you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation, either version 3 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | |||
| 10 | * i3lock-extended is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | |||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef EXTRAS_H | ||
| 20 | #define EXTRAS_H | ||
| 21 | |||
| 22 | #include <time.h> | ||
| 23 | |||
| 24 | |||
| 25 | #define I3LOCK_SCALE_LED_LENGTH 60 | ||
| 26 | #define I3LOCK_SCALE_LED_SPACING 30 | ||
| 27 | |||
| 28 | |||
| 29 | typedef enum { | ||
| 30 | |||
| 31 | I3LOCK_ALIGN_LEFT = 0, | ||
| 32 | I3LOCK_ALIGN_CENTER, | ||
| 33 | I3LOCK_ALIGN_RIGHT | ||
| 34 | |||
| 35 | } i3lock_horizontal_alignment; | ||
| 36 | |||
| 37 | |||
| 38 | typedef enum { | ||
| 39 | |||
| 40 | I3LOCK_ALIGN_TOP = 0, | ||
| 41 | I3LOCK_ALIGN_MIDDLE, | ||
| 42 | I3LOCK_ALIGN_BOTTOM | ||
| 43 | |||
| 44 | } i3lock_vertical_alignment; | ||
| 45 | |||
| 46 | |||
| 47 | typedef struct i3lock_digital_clock_t_ { | ||
| 48 | |||
| 49 | int text_size; | ||
| 50 | char color[7]; | ||
| 51 | char *template; | ||
| 52 | i3lock_horizontal_alignment horizontal_alignment; | ||
| 53 | i3lock_vertical_alignment vertical_alignment; | ||
| 54 | |||
| 55 | } i3lock_digital_clock_t; | ||
| 56 | |||
| 57 | |||
| 58 | typedef struct i3lock_elapsed_time_t_ { | ||
| 59 | |||
| 60 | int text_size; | ||
| 61 | char color[7]; | ||
| 62 | time_t start_time; | ||
| 63 | i3lock_horizontal_alignment horizontal_alignment; | ||
| 64 | i3lock_vertical_alignment vertical_alignment; | ||
| 65 | |||
| 66 | } i3lock_elapsed_time_t; | ||
| 67 | |||
| 68 | |||
| 69 | typedef struct i3lock_led_clock_t_ { | ||
| 70 | |||
| 71 | char led_on_color[7]; | ||
| 72 | char led_off_color[7]; | ||
| 73 | char led_border_color[7]; | ||
| 74 | i3lock_horizontal_alignment horizontal_alignment; | ||
| 75 | i3lock_vertical_alignment vertical_alignment; | ||
| 76 | |||
| 77 | } i3lock_led_clock_t; | ||
| 78 | |||
| 79 | |||
| 80 | void i3lock_draw_digital_clock(cairo_t *cr, | ||
| 81 | const i3lock_digital_clock_t *dc, | ||
| 82 | const uint32_t *resolution, | ||
| 83 | const struct tm *brokentime); | ||
| 84 | |||
| 85 | |||
| 86 | void i3lock_draw_elapsed_time(cairo_t *cr, | ||
| 87 | const i3lock_elapsed_time_t *et, | ||
| 88 | const uint32_t *resolution, | ||
| 89 | const time_t *now); | ||
| 90 | |||
| 91 | |||
| 92 | void i3lock_draw_led_clock(cairo_t *cr, | ||
| 93 | const i3lock_led_clock_t *lc, | ||
| 94 | const uint32_t *resolution, | ||
| 95 | const struct tm *brokentime); | ||
| 96 | |||
| 97 | |||
| 98 | void i3lock_draw_string(cairo_t *cr, | ||
| 99 | const char *formatted_string, | ||
| 100 | const i3lock_elapsed_time_t *et, | ||
| 101 | const uint32_t *resolution); | ||
| 102 | #endif | ||
diff --git a/i3lock.1 b/i3lock-extended.1 index cefd0d8..b0f51a7 100644 --- a/i3lock.1 +++ b/i3lock-extended.1 | |||
| @@ -8,31 +8,67 @@ | |||
| 8 | .fi | 8 | .fi |
| 9 | .. | 9 | .. |
| 10 | 10 | ||
| 11 | .TH i3lock 1 "JANUARY 2012" Linux "User Manuals" | 11 | .TH i3lock\-extended 1 "MARCH 2020" Linux "User Manuals" |
| 12 | 12 | ||
| 13 | .SH NAME | 13 | .SH NAME |
| 14 | i3lock \- improved screen locker | 14 | i3lock\-extended \- improved screen locker |
| 15 | 15 | ||
| 16 | .SH SYNOPSIS | 16 | .SH SYNOPSIS |
| 17 | .B i3lock | 17 | .B i3lock\-extended |
| 18 | .RB [\|\-v\|] | 18 | .RB [\|\-B |
| 19 | .RB [\|\-n\|] | 19 | .IR color \|] |
| 20 | .RB [\|\-b\|] | 20 | .RB [\|\-b\|] |
| 21 | .RB [\|\-c | ||
| 22 | .IR color \|] | ||
| 23 | .RB [\|\-D\|] | ||
| 24 | .RB [\|\-E\|] | ||
| 25 | .RB [\|\-e\|] | ||
| 26 | .RB [\|\-F | ||
| 27 | .IR color \|] | ||
| 28 | .RB [\|\-f\|] | ||
| 29 | .RB [\|\-G | ||
| 30 | .IR color \|] | ||
| 21 | .RB [\|\-i | 31 | .RB [\|\-i |
| 22 | .IR image.png \|] | 32 | .IR image.png \|] |
| 23 | .RB [\|\-c | 33 | .RB [\|\-J |
| 34 | .IR text \|] | ||
| 35 | .RB [\|\-L\|] | ||
| 36 | .RB [\|\-n\|] | ||
| 37 | .RB [\|\-O | ||
| 24 | .IR color \|] | 38 | .IR color \|] |
| 25 | .RB [\|\-t\|] | ||
| 26 | .RB [\|\-p | 39 | .RB [\|\-p |
| 27 | .IR pointer\|] | 40 | .IR pointer\|] |
| 41 | .RB [\|\-R | ||
| 42 | .IR color \|] | ||
| 43 | .RB [\|\-r | ||
| 44 | .IR refresh rate \|] | ||
| 45 | .RB [\|\-S | ||
| 46 | .IR size \|] | ||
| 47 | .RB [\|\-T | ||
| 48 | .IR template \|] | ||
| 49 | .RB [\|\-t\|] | ||
| 28 | .RB [\|\-u\|] | 50 | .RB [\|\-u\|] |
| 29 | .RB [\|\-e\|] | 51 | .RB [\|\-v\|] |
| 30 | .RB [\|\-f\|] | 52 | .RB [\|\-W |
| 53 | .IR halign \|] | ||
| 54 | .RB [\|\-X | ||
| 55 | .IR halign \|] | ||
| 56 | .RB [\|\-x | ||
| 57 | .IR halign \|] | ||
| 58 | .RB [\|\-Y | ||
| 59 | .IR valign \|] | ||
| 60 | .RB [\|\-y | ||
| 61 | .IR valign \|] | ||
| 62 | .RB [\|\-Z | ||
| 63 | .IR valign \|] | ||
| 31 | 64 | ||
| 32 | .SH DESCRIPTION | 65 | .SH DESCRIPTION |
| 33 | .B i3lock | 66 | .B i3lock-extended |
| 34 | is a simple screen locker like slock. After starting it, you will see a white | 67 | is a fork of i3lock which is a simple screen locker like slock. |
| 35 | screen (you can configure the color/an image). You can return to your screen by | 68 | i3lock-extended has all the i3lock features and some additional ones. |
| 69 | Hence this manual will refer to i3lock-extended only when describing these | ||
| 70 | additional features. After starting it, you will see a white screen | ||
| 71 | (you can configure the color/an image). You can return to your screen by | ||
| 36 | entering your password. | 72 | entering your password. |
| 37 | 73 | ||
| 38 | .SH IMPROVEMENTS | 74 | .SH IMPROVEMENTS |
| @@ -46,16 +82,24 @@ You can specify whether i3lock should bell upon a wrong password. | |||
| 46 | .IP \[bu] | 82 | .IP \[bu] |
| 47 | i3lock uses PAM and therefore is compatible with LDAP, etc. | 83 | i3lock uses PAM and therefore is compatible with LDAP, etc. |
| 48 | 84 | ||
| 85 | .SH EXTENDED FUNCTIONALITY | ||
| 86 | .B i3lock\-extended | ||
| 87 | provides the following additional functionality: | ||
| 49 | 88 | ||
| 50 | .SH OPTIONS | 89 | .IP \[bu] 2 |
| 51 | .TP | 90 | LED-clock |
| 52 | .B \-v, \-\-version | 91 | .IP \[bu] |
| 53 | Display the version of your | 92 | Digital clock |
| 54 | .B i3lock | 93 | .IP \[bu] |
| 94 | Elapsed time since activation | ||
| 95 | .IP \[bu] | ||
| 96 | Display-text | ||
| 55 | 97 | ||
| 98 | .SH OPTIONS | ||
| 56 | .TP | 99 | .TP |
| 57 | .B \-n, \-\-nofork | 100 | .BI \-B\ rrggbb \fR,\ \fB\-\-led\-border\-color= rrggbb |
| 58 | Don't fork after starting. | 101 | The border color of the LED clock. |
| 102 | format: rrggbb (i.e. ff0000 is red). Default: 000000 (black). | ||
| 59 | 103 | ||
| 60 | .TP | 104 | .TP |
| 61 | .B \-b, \-\-beep | 105 | .B \-b, \-\-beep |
| @@ -63,17 +107,82 @@ Enable beeping. Be sure to not do this when you are about to annoy other people, | |||
| 63 | like when opening your laptop in a boring lecture. | 107 | like when opening your laptop in a boring lecture. |
| 64 | 108 | ||
| 65 | .TP | 109 | .TP |
| 66 | .B \-u, \-\-no-unlock-indicator | 110 | .BI \-c\ rrggbb \fR,\ \fB\-\-color= rrggbb |
| 67 | Disable the unlock indicator. i3lock will by default show an unlock indicator | 111 | Turn the screen into the given color instead of white. |
| 68 | after pressing keys. This will give feedback for every keypress and it will | 112 | Color must be given in 3-byte. Default: ffffff (white). |
| 69 | show you the current PAM state (whether your password is currently being | 113 | |
| 70 | verified or whether it is wrong). | 114 | .TP |
| 115 | .B \-D, \-\-digital\-clock | ||
| 116 | Display digital clock. | ||
| 117 | |||
| 118 | .TP | ||
| 119 | .B \-\-debug | ||
| 120 | Enables debug logging. | ||
| 121 | Note, that this will log the password used for authentication to stdout. | ||
| 122 | |||
| 123 | .TP | ||
| 124 | .B \-E, \-\-elapsed\-time | ||
| 125 | Display the elapsed time since i3lock-extended was activated. | ||
| 126 | |||
| 127 | .TP | ||
| 128 | .B \-e, \-\-ignore-empty-password | ||
| 129 | When an empty password is provided by the user, do not validate | ||
| 130 | it. Without this option, the empty password will be provided to PAM | ||
| 131 | and, if invalid, the user will have to wait a few seconds before | ||
| 132 | another try. This can be useful if the XF86ScreenSaver key is used to | ||
| 133 | put a laptop to sleep and bounce on resume or if you happen to wake up | ||
| 134 | your computer with the enter key. | ||
| 135 | |||
| 136 | .TP | ||
| 137 | .BI \-F\ rrggbb \fR,\ \fB\-\-led\-off\-color= rrggbb | ||
| 138 | The color of the off-LED in the LED-clock. Default: 7f7f7f. | ||
| 139 | |||
| 140 | .TP | ||
| 141 | .B \-f, \-\-show-failed-attempts | ||
| 142 | Show the number of failed attempts, if any. | ||
| 143 | |||
| 144 | .TP | ||
| 145 | .BI \-G\ rrggbb \fR,\ \fB\-\-digital\-clock\-color= rrggbb | ||
| 146 | The color of the digital-clock (text). Default: 000000 (black). | ||
| 71 | 147 | ||
| 72 | .TP | 148 | .TP |
| 73 | .BI \-i\ path \fR,\ \fB\-\-image= path | 149 | .BI \-i\ path \fR,\ \fB\-\-image= path |
| 74 | Display the given PNG image instead of a blank screen. | 150 | Display the given PNG image instead of a blank screen. |
| 75 | 151 | ||
| 76 | .TP | 152 | .TP |
| 153 | .BI \-J\ text \fR,\ \fB\-\-display\-text= text | ||
| 154 | Display text instead of elapsed time, using the same color and alignment. | ||
| 155 | |||
| 156 | .TP | ||
| 157 | .B \-L, \-\-led\-clock | ||
| 158 | Display LED-clock. | ||
| 159 | |||
| 160 | .TP | ||
| 161 | .B \-n, \-\-nofork | ||
| 162 | Don't fork after starting. | ||
| 163 | |||
| 164 | .TP | ||
| 165 | .BI \-O\ rrggbb \fR,\ \fB\-\-led\-on\-color= rrggbb | ||
| 166 | The color of the on-LED in the LED-clock. Default: ffff00 (yellow). | ||
| 167 | |||
| 168 | .TP | ||
| 169 | .BI \-p\ win|default \fR,\ \fB\-\-pointer= win|default | ||
| 170 | If you specify "default", | ||
| 171 | .B i3lock | ||
| 172 | does not hide your mouse pointer. If you specify "win", | ||
| 173 | .B i3lock | ||
| 174 | displays a hardcoded Windows-Pointer (thus enabling you to mess with your | ||
| 175 | friends by using a screenshot of a Windows desktop as a locking-screen). | ||
| 176 | |||
| 177 | .TP | ||
| 178 | .BI \-R\ rrggbb \fR,\ \fB\-\-elapsed\-time\-color= rrggbb | ||
| 179 | The color of the elapsed time (text). Default: 000000 (black). | ||
| 180 | |||
| 181 | .TP | ||
| 182 | .BI \-r\ rate \fR,\ \fB\-\-refresh\-rate= rate | ||
| 183 | Rate is the amount of times per second we refresh the screen. Default: 2. | ||
| 184 | |||
| 185 | .TP | ||
| 77 | .BI \fB\-\-raw= format | 186 | .BI \fB\-\-raw= format |
| 78 | Read the image given by \-\-image as a raw image instead of PNG. The argument is the image's format | 187 | Read the image given by \-\-image as a raw image instead of PNG. The argument is the image's format |
| 79 | as <width>x<height>:<pixfmt>. The supported pixel formats are: | 188 | as <width>x<height>:<pixfmt>. The supported pixel formats are: |
| @@ -101,9 +210,12 @@ This allows you to load a variety of image formats without i3lock having to | |||
| 101 | support each one explicitly. | 210 | support each one explicitly. |
| 102 | 211 | ||
| 103 | .TP | 212 | .TP |
| 104 | .BI \-c\ rrggbb \fR,\ \fB\-\-color= rrggbb | 213 | .BI \-S\ size \fR,\ \fB\-\-text\-size= size |
| 105 | Turn the screen into the given color instead of white. Color must be given in 3-byte | 214 | The text size for elapsed time, digital clock and display-text. Default: 28. |
| 106 | format: rrggbb (i.e. ff0000 is red). | 215 | |
| 216 | .TP | ||
| 217 | .BI \-T\ template \fR,\ \fB\-\-digital\-clock\-template= template | ||
| 218 | The date(time) template for the digital clock. Default: %H:%M:%S. | ||
| 107 | 219 | ||
| 108 | .TP | 220 | .TP |
| 109 | .B \-t, \-\-tiling | 221 | .B \-t, \-\-tiling |
| @@ -111,31 +223,42 @@ If an image is specified (via \-i) it will display the image tiled all over the | |||
| 111 | (if it is a multi-monitor setup, the image is visible on all screens). | 223 | (if it is a multi-monitor setup, the image is visible on all screens). |
| 112 | 224 | ||
| 113 | .TP | 225 | .TP |
| 114 | .BI \-p\ win|default \fR,\ \fB\-\-pointer= win|default | 226 | .B \-u, \-\-no-unlock-indicator |
| 115 | If you specify "default", | 227 | Disable the unlock indicator. i3lock will by default show an unlock indicator |
| 116 | .B i3lock | 228 | after pressing keys. This will give feedback for every keypress and it will |
| 117 | does not hide your mouse pointer. If you specify "win", | 229 | show you the current PAM state (whether your password is currently being |
| 230 | verified or whether it is wrong). | ||
| 231 | |||
| 232 | .TP | ||
| 233 | .B \-v, \-\-version | ||
| 234 | Display the version of your | ||
| 118 | .B i3lock | 235 | .B i3lock |
| 119 | displays a hardcoded Windows-Pointer (thus enabling you to mess with your | ||
| 120 | friends by using a screenshot of a Windows desktop as a locking-screen). | ||
| 121 | 236 | ||
| 122 | .TP | 237 | .TP |
| 123 | .B \-e, \-\-ignore-empty-password | 238 | .BI \-W\ halign \fR,\ \fB\-\-elapsed\-time\-halign= halign |
| 124 | When an empty password is provided by the user, do not validate | 239 | The horizontal alignment for elapsed time and display-text. |
| 125 | it. Without this option, the empty password will be provided to PAM | 240 | Valid halign values: left, center, right. Default: right |
| 126 | and, if invalid, the user will have to wait a few seconds before | ||
| 127 | another try. This can be useful if the XF86ScreenSaver key is used to | ||
| 128 | put a laptop to sleep and bounce on resume or if you happen to wake up | ||
| 129 | your computer with the enter key. | ||
| 130 | 241 | ||
| 131 | .TP | 242 | .TP |
| 132 | .B \-f, \-\-show-failed-attempts | 243 | .BI \-X\ halign \fR,\ \fB\-\-led\-clock\-halign= halign |
| 133 | Show the number of failed attempts, if any. | 244 | The horizontal alignment for the LED-clock. Default: center |
| 134 | 245 | ||
| 135 | .TP | 246 | .TP |
| 136 | .B \-\-debug | 247 | .BI \-x\ halign \fR,\ \fB\-\-digital\-clock\-halign= halign |
| 137 | Enables debug logging. | 248 | The horizontal alignment for the digital clock. Default: left |
| 138 | Note, that this will log the password used for authentication to stdout. | 249 | |
| 250 | .TP | ||
| 251 | .BI \-Y\ valign \fR,\ \fB\-\-led\-clock\-valign= valign | ||
| 252 | The vertical alignment for the LED-clock. | ||
| 253 | Valid valign values: top, middle, bottom. Default: bottom | ||
| 254 | |||
| 255 | .TP | ||
| 256 | .BI \-y\ valign \fR,\ \fB\-\-digital\-clock\-valign= valign | ||
| 257 | The vertical alignment for the digital clock. Default: top | ||
| 258 | |||
| 259 | .TP | ||
| 260 | .BI \-Z\ valign \fR,\ \fB\-\-elapsed\-time\-valign= valign | ||
| 261 | The vertical alignment for elapsed time and display-text. Default: bottom | ||
| 139 | 262 | ||
| 140 | .SH DPMS | 263 | .SH DPMS |
| 141 | 264 | ||
| @@ -171,3 +294,5 @@ The \-I (-\-inactivity-timeout=seconds) was removed because it only makes sense | |||
| 171 | Michael Stapelberg <michael+i3lock at stapelberg dot de> | 294 | Michael Stapelberg <michael+i3lock at stapelberg dot de> |
| 172 | 295 | ||
| 173 | Jan-Erik Rediger <badboy at archlinux.us> | 296 | Jan-Erik Rediger <badboy at archlinux.us> |
| 297 | |||
| 298 | Simeon Simeonov <sgs (AT) pichove (DOT) org> | ||
| @@ -1,11 +1,30 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * vim:ts=4:sw=4:expandtab | 2 | * This file is part of i3lock-extended |
| 3 | * Copyright (C) 2020 Simeon Simeonov | ||
| 4 | |||
| 5 | * i3lock-extended is free software: you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation, either version 3 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | |||
| 10 | * i3lock-extended is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | |||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | /* This file includes software copyrighted by Michael Stapelberg and | ||
| 20 | * distributed under the following license: See LICENSE for more information | ||
| 3 | * | 21 | * |
| 4 | * © 2010 Michael Stapelberg | 22 | * © 2010 Michael Stapelberg |
| 5 | * | 23 | * |
| 6 | * See LICENSE for licensing information | 24 | * See LICENSE for licensing information |
| 7 | * | 25 | * |
| 8 | */ | 26 | */ |
| 27 | |||
| 9 | #include <config.h> | 28 | #include <config.h> |
| 10 | 29 | ||
| 11 | #include <stdio.h> | 30 | #include <stdio.h> |
| @@ -48,6 +67,10 @@ | |||
| 48 | #include "randr.h" | 67 | #include "randr.h" |
| 49 | #include "dpi.h" | 68 | #include "dpi.h" |
| 50 | 69 | ||
| 70 | #ifdef EXTRAS | ||
| 71 | #include "extras.h" | ||
| 72 | #endif | ||
| 73 | |||
| 51 | #define TSTAMP_N_SECS(n) (n * 1.0) | 74 | #define TSTAMP_N_SECS(n) (n * 1.0) |
| 52 | #define TSTAMP_N_MINS(n) (60 * TSTAMP_N_SECS(n)) | 75 | #define TSTAMP_N_MINS(n) (60 * TSTAMP_N_SECS(n)) |
| 53 | #define START_TIMER(timer_obj, timeout, callback) \ | 76 | #define START_TIMER(timer_obj, timeout, callback) \ |
| @@ -58,6 +81,31 @@ | |||
| 58 | typedef void (*ev_callback_t)(EV_P_ ev_timer *w, int revents); | 81 | typedef void (*ev_callback_t)(EV_P_ ev_timer *w, int revents); |
| 59 | static void input_done(void); | 82 | static void input_done(void); |
| 60 | 83 | ||
| 84 | #ifdef EXTRAS | ||
| 85 | bool digital_clock = false; | ||
| 86 | bool led_clock = false; | ||
| 87 | bool elapsed_time = false; | ||
| 88 | int refresh_rate = 2; /* 2 frames per second */ | ||
| 89 | i3lock_digital_clock_t i3lock_digital_clock = {28, | ||
| 90 | "000000", | ||
| 91 | "%H:%M:%S", | ||
| 92 | I3LOCK_ALIGN_LEFT, | ||
| 93 | I3LOCK_ALIGN_TOP}; | ||
| 94 | |||
| 95 | i3lock_elapsed_time_t i3lock_elapsed_time = {28, | ||
| 96 | "000000", | ||
| 97 | 0, | ||
| 98 | I3LOCK_ALIGN_RIGHT, | ||
| 99 | I3LOCK_ALIGN_BOTTOM}; | ||
| 100 | |||
| 101 | i3lock_led_clock_t i3lock_led_clock = {"ffff00", | ||
| 102 | "7f7f7f", | ||
| 103 | "000000", | ||
| 104 | I3LOCK_ALIGN_CENTER, | ||
| 105 | I3LOCK_ALIGN_BOTTOM}; | ||
| 106 | char *display_text = NULL; | ||
| 107 | #endif | ||
| 108 | |||
| 61 | char color[7] = "ffffff"; | 109 | char color[7] = "ffffff"; |
| 62 | uint32_t last_resolution[2]; | 110 | uint32_t last_resolution[2]; |
| 63 | xcb_window_t win; | 111 | xcb_window_t win; |
| @@ -305,7 +353,10 @@ static void input_done(void) { | |||
| 305 | return; | 353 | return; |
| 306 | } | 354 | } |
| 307 | #endif | 355 | #endif |
| 308 | 356 | #ifdef EXTRAS | |
| 357 | /* reset the time elapsed counter */ | ||
| 358 | i3lock_elapsed_time.start_time = time(NULL); | ||
| 359 | #endif | ||
| 309 | if (debug_mode) | 360 | if (debug_mode) |
| 310 | fprintf(stderr, "Authentication failure\n"); | 361 | fprintf(stderr, "Authentication failure\n"); |
| 311 | 362 | ||
| @@ -1005,6 +1056,15 @@ static void raise_loop(xcb_window_t window) { | |||
| 1005 | } | 1056 | } |
| 1006 | } | 1057 | } |
| 1007 | 1058 | ||
| 1059 | #ifdef EXTRAS | ||
| 1060 | /* called periodically by the ticking system */ | ||
| 1061 | static void refresh_tick_cb (EV_P_ ev_timer *w, int revents) { | ||
| 1062 | |||
| 1063 | redraw_screen(); | ||
| 1064 | |||
| 1065 | } | ||
| 1066 | #endif | ||
| 1067 | |||
| 1008 | int main(int argc, char *argv[]) { | 1068 | int main(int argc, char *argv[]) { |
| 1009 | struct passwd *pw; | 1069 | struct passwd *pw; |
| 1010 | char *username; | 1070 | char *username; |
| @@ -1023,6 +1083,26 @@ int main(int argc, char *argv[]) { | |||
| 1023 | {"beep", no_argument, NULL, 'b'}, | 1083 | {"beep", no_argument, NULL, 'b'}, |
| 1024 | {"dpms", no_argument, NULL, 'd'}, | 1084 | {"dpms", no_argument, NULL, 'd'}, |
| 1025 | {"color", required_argument, NULL, 'c'}, | 1085 | {"color", required_argument, NULL, 'c'}, |
| 1086 | #ifdef EXTRAS | ||
| 1087 | {"digital-clock", no_argument, NULL, 'D'}, | ||
| 1088 | {"digital-clock-color", required_argument, NULL, 'G'}, | ||
| 1089 | {"digital-clock-template", required_argument, NULL, 'T'}, | ||
| 1090 | {"digital-clock-halign", required_argument, NULL, 'x'}, | ||
| 1091 | {"digital-clock-valign", required_argument, NULL, 'y'}, | ||
| 1092 | {"display-text", no_argument, NULL, 'J'}, | ||
| 1093 | {"elapsed-time", no_argument, NULL, 'E'}, | ||
| 1094 | {"elapsed-time-color", required_argument, NULL, 'R'}, | ||
| 1095 | {"elapsed-time-halign", required_argument, NULL, 'W'}, | ||
| 1096 | {"elapsed-time-valign", required_argument, NULL, 'Z'}, | ||
| 1097 | {"led-clock", no_argument, NULL, 'L'}, | ||
| 1098 | {"led-clock-halign", required_argument, NULL, 'X'}, | ||
| 1099 | {"led-clock-valign", required_argument, NULL, 'Y'}, | ||
| 1100 | {"led-border-color", required_argument, NULL, 'B'}, | ||
| 1101 | {"led-off-color", required_argument, NULL, 'F'}, | ||
| 1102 | {"led-on-color", required_argument, NULL, 'O'}, | ||
| 1103 | {"refresh-rate", required_argument, NULL, 'r'}, | ||
| 1104 | {"text-size", required_argument, NULL, 'S'}, | ||
| 1105 | #endif | ||
| 1026 | {"pointer", required_argument, NULL, 'p'}, | 1106 | {"pointer", required_argument, NULL, 'p'}, |
| 1027 | {"debug", no_argument, NULL, 0}, | 1107 | {"debug", no_argument, NULL, 0}, |
| 1028 | {"help", no_argument, NULL, 'h'}, | 1108 | {"help", no_argument, NULL, 'h'}, |
| @@ -1040,11 +1120,15 @@ int main(int argc, char *argv[]) { | |||
| 1040 | if ((username = pw->pw_name) == NULL) | 1120 | if ((username = pw->pw_name) == NULL) |
| 1041 | errx(EXIT_FAILURE, "pw->pw_name is NULL."); | 1121 | errx(EXIT_FAILURE, "pw->pw_name is NULL."); |
| 1042 | 1122 | ||
| 1123 | #ifdef EXTRAS | ||
| 1124 | char *optstring = "hvnbDdELc:B:G:F:J:O:R:r:S:T:W:X:x:Y:y:Z:p:ui:teI:f"; | ||
| 1125 | #else | ||
| 1043 | char *optstring = "hvnbdc:p:ui:teI:f"; | 1126 | char *optstring = "hvnbdc:p:ui:teI:f"; |
| 1127 | #endif | ||
| 1044 | while ((o = getopt_long(argc, argv, optstring, longopts, &longoptind)) != -1) { | 1128 | while ((o = getopt_long(argc, argv, optstring, longopts, &longoptind)) != -1) { |
| 1045 | switch (o) { | 1129 | switch (o) { |
| 1046 | case 'v': | 1130 | case 'v': |
| 1047 | errx(EXIT_SUCCESS, "version " I3LOCK_VERSION " © 2010 Michael Stapelberg"); | 1131 | errx(EXIT_SUCCESS, "version " I3LOCK_VERSION " © 2010 Michael Stapelberg, 2017-2020 Simeon Simeonov"); |
| 1048 | case 'n': | 1132 | case 'n': |
| 1049 | dont_fork = true; | 1133 | dont_fork = true; |
| 1050 | break; | 1134 | break; |
| @@ -1052,10 +1136,10 @@ int main(int argc, char *argv[]) { | |||
| 1052 | beep = true; | 1136 | beep = true; |
| 1053 | break; | 1137 | break; |
| 1054 | case 'd': | 1138 | case 'd': |
| 1055 | fprintf(stderr, "DPMS support has been removed from i3lock. Please see the manpage i3lock(1).\n"); | 1139 | fprintf(stderr, "DPMS support has been removed from i3lock. Please see the manpage i3lock-extended(1).\n"); |
| 1056 | break; | 1140 | break; |
| 1057 | case 'I': { | 1141 | case 'I': { |
| 1058 | fprintf(stderr, "Inactivity timeout only makes sense with DPMS, which was removed. Please see the manpage i3lock(1).\n"); | 1142 | fprintf(stderr, "Inactivity timeout only makes sense with DPMS, which was removed. Please see the manpage i3lock-extended(1).\n"); |
| 1059 | break; | 1143 | break; |
| 1060 | } | 1144 | } |
| 1061 | case 'c': { | 1145 | case 'c': { |
| @@ -1070,6 +1154,181 @@ int main(int argc, char *argv[]) { | |||
| 1070 | 1154 | ||
| 1071 | break; | 1155 | break; |
| 1072 | } | 1156 | } |
| 1157 | #ifdef EXTRAS | ||
| 1158 | case 'D': | ||
| 1159 | digital_clock = true; | ||
| 1160 | break; | ||
| 1161 | case 'E': | ||
| 1162 | elapsed_time = true; | ||
| 1163 | i3lock_elapsed_time.start_time = time(NULL); | ||
| 1164 | break; | ||
| 1165 | case 'L': | ||
| 1166 | led_clock = true; | ||
| 1167 | break; | ||
| 1168 | case 'B': { | ||
| 1169 | char *arg = optarg; | ||
| 1170 | |||
| 1171 | /* Skip # if present */ | ||
| 1172 | if (arg[0] == '#') | ||
| 1173 | arg++; | ||
| 1174 | |||
| 1175 | if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", i3lock_led_clock.led_border_color) != 1) | ||
| 1176 | errx(EXIT_FAILURE, "led-border-color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n"); | ||
| 1177 | DEBUG("led-border-color: %s\n", i3lock_led_clock.led_border_color); | ||
| 1178 | break; | ||
| 1179 | } | ||
| 1180 | case 'G': { /* digital-clock-color */ | ||
| 1181 | char *arg = optarg; | ||
| 1182 | |||
| 1183 | /* Skip # if present */ | ||
| 1184 | if (arg[0] == '#') | ||
| 1185 | arg++; | ||
| 1186 | |||
| 1187 | if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", i3lock_digital_clock.color) != 1) | ||
| 1188 | errx(EXIT_FAILURE, "digital-clock-color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n"); | ||
| 1189 | DEBUG("digital-clock-color: %s\n", i3lock_digital_clock.color); | ||
| 1190 | break; | ||
| 1191 | } | ||
| 1192 | case 'F': { /* led-off-color */ | ||
| 1193 | char *arg = optarg; | ||
| 1194 | |||
| 1195 | /* Skip # if present */ | ||
| 1196 | if (arg[0] == '#') | ||
| 1197 | arg++; | ||
| 1198 | |||
| 1199 | if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", i3lock_led_clock.led_off_color) != 1) | ||
| 1200 | errx(EXIT_FAILURE, "led-off-color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n"); | ||
| 1201 | DEBUG("led-off-color: %s\n", i3lock_led_clock.led_off_color); | ||
| 1202 | break; | ||
| 1203 | } | ||
| 1204 | case 'J': { | ||
| 1205 | display_text = strdup(optarg); | ||
| 1206 | if (display_text == NULL) { | ||
| 1207 | errx(EXIT_FAILURE, | ||
| 1208 | "Unable to initialize display_text\n"); | ||
| 1209 | } | ||
| 1210 | DEBUG("display_text: %s\n", display_text); | ||
| 1211 | break; | ||
| 1212 | } | ||
| 1213 | case 'O': { /* led-on-color */ | ||
| 1214 | char *arg = optarg; | ||
| 1215 | |||
| 1216 | /* Skip # if present */ | ||
| 1217 | if (arg[0] == '#') | ||
| 1218 | arg++; | ||
| 1219 | |||
| 1220 | if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", i3lock_led_clock.led_on_color) != 1) | ||
| 1221 | errx(EXIT_FAILURE, "led-on-color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n"); | ||
| 1222 | DEBUG("led-on-color: %s\n", i3lock_led_clock.led_on_color); | ||
| 1223 | break; | ||
| 1224 | } | ||
| 1225 | case 'R': { /* elapsed-time-color */ | ||
| 1226 | char *arg = optarg; | ||
| 1227 | |||
| 1228 | /* Skip # if present */ | ||
| 1229 | if (arg[0] == '#') | ||
| 1230 | arg++; | ||
| 1231 | |||
| 1232 | if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", i3lock_elapsed_time.color) != 1) | ||
| 1233 | errx(EXIT_FAILURE, "elapsed-time-color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n"); | ||
| 1234 | DEBUG("elapsed-time-color: %s\n", i3lock_elapsed_time.color); | ||
| 1235 | break; | ||
| 1236 | } | ||
| 1237 | case 'r': /* refresh-rate */ | ||
| 1238 | if (atoi(optarg)) /* not nice with 0 */ | ||
| 1239 | refresh_rate = atoi(optarg); | ||
| 1240 | DEBUG("refresh-rate: %d\n", | ||
| 1241 | refresh_rate); | ||
| 1242 | break; | ||
| 1243 | case 'S': /* text-size */ | ||
| 1244 | i3lock_elapsed_time.text_size = i3lock_digital_clock.text_size = atoi(optarg); | ||
| 1245 | DEBUG("text-size: %d\n", | ||
| 1246 | i3lock_digital_clock.text_size); | ||
| 1247 | break; | ||
| 1248 | case 'T': /* digital-clock-template */ | ||
| 1249 | i3lock_digital_clock.template = strdup(optarg); | ||
| 1250 | DEBUG("digital-clock-template: %s\n", | ||
| 1251 | i3lock_digital_clock.template); | ||
| 1252 | break; | ||
| 1253 | case 'W': /* elapsed-time-halign */ | ||
| 1254 | /* the default is right */ | ||
| 1255 | if (strcasecmp(optarg, "left") == 0) { | ||
| 1256 | i3lock_elapsed_time.horizontal_alignment = I3LOCK_ALIGN_LEFT; | ||
| 1257 | DEBUG("elapsed-time-halign: left\n"); | ||
| 1258 | } else if (strcasecmp(optarg, "center") == 0) { | ||
| 1259 | i3lock_elapsed_time.horizontal_alignment = I3LOCK_ALIGN_CENTER; | ||
| 1260 | DEBUG("elapsed-time-halign: center\n"); | ||
| 1261 | } else { | ||
| 1262 | /* value already set */ | ||
| 1263 | DEBUG("elapsed-time-halign: right\n"); | ||
| 1264 | } | ||
| 1265 | break; | ||
| 1266 | case 'X': /* led-clock-halign */ | ||
| 1267 | /* the default is center */ | ||
| 1268 | if (strcasecmp(optarg, "left") == 0) { | ||
| 1269 | i3lock_led_clock.horizontal_alignment = I3LOCK_ALIGN_LEFT; | ||
| 1270 | DEBUG("led-clock-halign: left\n"); | ||
| 1271 | } else if (strcasecmp(optarg, "right") == 0) { | ||
| 1272 | i3lock_led_clock.horizontal_alignment = I3LOCK_ALIGN_RIGHT; | ||
| 1273 | DEBUG("led-clock-halign: right\n"); | ||
| 1274 | } else { | ||
| 1275 | /* value already set */ | ||
| 1276 | DEBUG("led-clock-halign: center\n"); | ||
| 1277 | } | ||
| 1278 | break; | ||
| 1279 | case 'Y': /* led-clock-valign */ | ||
| 1280 | /* the default is bottom */ | ||
| 1281 | if (strcasecmp(optarg, "middle") == 0) { | ||
| 1282 | i3lock_led_clock.vertical_alignment = I3LOCK_ALIGN_MIDDLE; | ||
| 1283 | DEBUG("led-clock-valign: middle\n"); | ||
| 1284 | } else if (strcasecmp(optarg, "top") == 0) { | ||
| 1285 | i3lock_led_clock.vertical_alignment = I3LOCK_ALIGN_TOP; | ||
| 1286 | DEBUG("led-clock-valign: top\n"); | ||
| 1287 | } else { | ||
| 1288 | /* value already set */ | ||
| 1289 | DEBUG("led-clock-valign: bottom\n"); | ||
| 1290 | } | ||
| 1291 | break; | ||
| 1292 | case 'x': /* digital-clock-halign */ | ||
| 1293 | /* the default is left */ | ||
| 1294 | if (strcasecmp(optarg, "center") == 0) { | ||
| 1295 | i3lock_digital_clock.horizontal_alignment = I3LOCK_ALIGN_CENTER; | ||
| 1296 | DEBUG("digital-clock-halign: center\n"); | ||
| 1297 | } else if (strcasecmp(optarg, "right") == 0) { | ||
| 1298 | i3lock_digital_clock.horizontal_alignment = I3LOCK_ALIGN_RIGHT; | ||
| 1299 | DEBUG("digital-clock-halign: right\n"); | ||
| 1300 | } else { | ||
| 1301 | /* value already set */ | ||
| 1302 | DEBUG("digital-clock-halign: left\n"); | ||
| 1303 | } | ||
| 1304 | break; | ||
| 1305 | case 'y': /* digital-clock-valign */ | ||
| 1306 | /* the default is top */ | ||
| 1307 | if (strcasecmp(optarg, "middle") == 0) { | ||
| 1308 | i3lock_digital_clock.vertical_alignment = I3LOCK_ALIGN_MIDDLE; | ||
| 1309 | DEBUG("digital-clock-valign: middle\n"); | ||
| 1310 | } else if (strcasecmp(optarg, "bottom") == 0) { | ||
| 1311 | i3lock_digital_clock.vertical_alignment = I3LOCK_ALIGN_BOTTOM; | ||
| 1312 | DEBUG("digital-clock-valign: bottom\n"); | ||
| 1313 | } else { | ||
| 1314 | /* value already set */ | ||
| 1315 | DEBUG("digital-clock-valign: top\n"); | ||
| 1316 | } | ||
| 1317 | break; | ||
| 1318 | case 'Z': /* elapsed-time-valign */ | ||
| 1319 | /* the default is bottom */ | ||
| 1320 | if (strcasecmp(optarg, "middle") == 0) { | ||
| 1321 | i3lock_elapsed_time.vertical_alignment = I3LOCK_ALIGN_MIDDLE; | ||
| 1322 | DEBUG("elapsed-time-valign: middle\n"); | ||
| 1323 | } else if (strcasecmp(optarg, "top") == 0) { | ||
| 1324 | i3lock_elapsed_time.vertical_alignment = I3LOCK_ALIGN_TOP; | ||
| 1325 | DEBUG("elapsed-time-valign: top\n"); | ||
| 1326 | } else { | ||
| 1327 | /* value already set */ | ||
| 1328 | DEBUG("elapsed-time-valign: bottom\n"); | ||
| 1329 | } | ||
| 1330 | break; | ||
| 1331 | #endif | ||
| 1073 | case 'u': | 1332 | case 'u': |
| 1074 | unlock_indicator = false; | 1333 | unlock_indicator = false; |
| 1075 | break; | 1334 | break; |
| @@ -1101,8 +1360,21 @@ int main(int argc, char *argv[]) { | |||
| 1101 | show_failed_attempts = true; | 1360 | show_failed_attempts = true; |
| 1102 | break; | 1361 | break; |
| 1103 | default: | 1362 | default: |
| 1363 | #ifdef EXTRAS | ||
| 1364 | errx( | ||
| 1365 | EXIT_FAILURE, | ||
| 1366 | "Syntax: i3lock-extended [-v] [-n] [-b] [-D] [-d] [-E] " | ||
| 1367 | "[-L] [-c color] [-B color] [-F color] [-G color] " | ||
| 1368 | "[-J text] [-O color] [-R color] [-r refresh rate] [-u] " | ||
| 1369 | "[-W horizontal-alignment] [-X horizontal-alignment] " | ||
| 1370 | "[-x horizontal-alignment] [-Y vertical-alignment] " | ||
| 1371 | "[-y vertical-alignment] [-Z vertical-alignment] " | ||
| 1372 | "[-p win|default] [-i image.png] [-t] [-e] [-I timeout] " | ||
| 1373 | "[-f]"); | ||
| 1374 | #else | ||
| 1104 | errx(EXIT_FAILURE, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-u] [-p win|default]" | 1375 | errx(EXIT_FAILURE, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-u] [-p win|default]" |
| 1105 | " [-i image.png] [-t] [-e] [-I timeout] [-f]"); | 1376 | " [-i image.png] [-t] [-e] [-I timeout] [-f]"); |
| 1377 | #endif | ||
| 1106 | } | 1378 | } |
| 1107 | } | 1379 | } |
| 1108 | 1380 | ||
| @@ -1291,6 +1563,11 @@ int main(int argc, char *argv[]) { | |||
| 1291 | ev_prepare_init(xcb_prepare, xcb_prepare_cb); | 1563 | ev_prepare_init(xcb_prepare, xcb_prepare_cb); |
| 1292 | ev_prepare_start(main_loop, xcb_prepare); | 1564 | ev_prepare_start(main_loop, xcb_prepare); |
| 1293 | 1565 | ||
| 1566 | #ifdef EXTRAS | ||
| 1567 | ev_timer refresh_tick_watcher; | ||
| 1568 | ev_timer_init (&refresh_tick_watcher, refresh_tick_cb, 1.0, 1.0 / refresh_rate); | ||
| 1569 | ev_timer_start (main_loop, &refresh_tick_watcher); | ||
| 1570 | #endif | ||
| 1294 | /* Invoke the event callback once to catch all the events which were | 1571 | /* Invoke the event callback once to catch all the events which were |
| 1295 | * received up until now. ev will only pick up new events (when the X11 | 1572 | * received up until now. ev will only pick up new events (when the X11 |
| 1296 | * file descriptor becomes readable). */ | 1573 | * file descriptor becomes readable). */ |
diff --git a/pam/i3lock b/pam/i3lock-extended index 6eb8e68..6eb8e68 100644 --- a/pam/i3lock +++ b/pam/i3lock-extended | |||
diff --git a/unlock_indicator.c b/unlock_indicator.c index d6237ed..3d98a5f 100644 --- a/unlock_indicator.c +++ b/unlock_indicator.c | |||
| @@ -1,11 +1,30 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * vim:ts=4:sw=4:expandtab | 2 | * This file is part of i3lock-extended |
| 3 | * Copyright (C) 2020 Simeon Simeonov | ||
| 4 | |||
| 5 | * i3lock-extended is free software: you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation, either version 3 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | |||
| 10 | * i3lock-extended is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | |||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | /* This file includes software copyrighted by Michael Stapelberg and | ||
| 20 | * distributed under the following license: See LICENSE for more information | ||
| 3 | * | 21 | * |
| 4 | * © 2010 Michael Stapelberg | 22 | * © 2010 Michael Stapelberg |
| 5 | * | 23 | * |
| 6 | * See LICENSE for licensing information | 24 | * See LICENSE for licensing information |
| 7 | * | 25 | * |
| 8 | */ | 26 | */ |
| 27 | |||
| 9 | #include <stdbool.h> | 28 | #include <stdbool.h> |
| 10 | #include <stdlib.h> | 29 | #include <stdlib.h> |
| 11 | #include <stdio.h> | 30 | #include <stdio.h> |
| @@ -22,17 +41,36 @@ | |||
| 22 | #include "randr.h" | 41 | #include "randr.h" |
| 23 | #include "dpi.h" | 42 | #include "dpi.h" |
| 24 | 43 | ||
| 44 | #ifdef EXTRAS | ||
| 45 | #include "extras.h" | ||
| 46 | #endif | ||
| 47 | |||
| 25 | #define BUTTON_RADIUS 90 | 48 | #define BUTTON_RADIUS 90 |
| 26 | #define BUTTON_SPACE (BUTTON_RADIUS + 5) | 49 | #define BUTTON_SPACE (BUTTON_RADIUS + 5) |
| 27 | #define BUTTON_CENTER (BUTTON_RADIUS + 5) | 50 | #define BUTTON_CENTER (BUTTON_RADIUS + 5) |
| 28 | #define BUTTON_DIAMETER (2 * BUTTON_SPACE) | 51 | #define BUTTON_DIAMETER (2 * BUTTON_SPACE) |
| 29 | 52 | ||
| 30 | /******************************************************************************* | 53 | /****************************************************************************** |
| 31 | * Variables defined in i3lock.c. | 54 | * Variables defined in i3lock.c. |
| 32 | ******************************************************************************/ | 55 | *****************************************************************************/ |
| 33 | 56 | ||
| 34 | extern bool debug_mode; | 57 | extern bool debug_mode; |
| 35 | 58 | ||
| 59 | #ifdef EXTRAS | ||
| 60 | /* timekeeping */ | ||
| 61 | time_t now; | ||
| 62 | struct tm *brokentime; | ||
| 63 | /* enable the digital clock */ | ||
| 64 | extern bool digital_clock; | ||
| 65 | extern bool led_clock; | ||
| 66 | extern bool elapsed_time; | ||
| 67 | extern i3lock_digital_clock_t i3lock_digital_clock; | ||
| 68 | extern i3lock_elapsed_time_t i3lock_elapsed_time; | ||
| 69 | extern i3lock_led_clock_t i3lock_led_clock; | ||
| 70 | /* display text */ | ||
| 71 | extern char *display_text; | ||
| 72 | #endif | ||
| 73 | |||
| 36 | /* The current position in the input buffer. Useful to determine if any | 74 | /* The current position in the input buffer. Useful to determine if any |
| 37 | * characters of the password have already been entered or not. */ | 75 | * characters of the password have already been entered or not. */ |
| 38 | extern int input_position; | 76 | extern int input_position; |
| @@ -62,16 +100,16 @@ extern bool show_failed_attempts; | |||
| 62 | /* Number of failed unlock attempts. */ | 100 | /* Number of failed unlock attempts. */ |
| 63 | extern int failed_attempts; | 101 | extern int failed_attempts; |
| 64 | 102 | ||
| 65 | /******************************************************************************* | 103 | /****************************************************************************** |
| 66 | * Variables defined in xcb.c. | 104 | * Variables defined in xcb.c. |
| 67 | ******************************************************************************/ | 105 | *****************************************************************************/ |
| 68 | 106 | ||
| 69 | /* The root screen, to determine the DPI. */ | 107 | /* The root screen, to determine the DPI. */ |
| 70 | extern xcb_screen_t *screen; | 108 | extern xcb_screen_t *screen; |
| 71 | 109 | ||
| 72 | /******************************************************************************* | 110 | /****************************************************************************** |
| 73 | * Local variables. | 111 | * Local variables. |
| 74 | ******************************************************************************/ | 112 | *****************************************************************************/ |
| 75 | 113 | ||
| 76 | /* Cache the screen’s visual, necessary for creating a Cairo context. */ | 114 | /* Cache the screen’s visual, necessary for creating a Cairo context. */ |
| 77 | static xcb_visualtype_t *vistype; | 115 | static xcb_visualtype_t *vistype; |
| @@ -304,7 +342,34 @@ xcb_pixmap_t draw_image(uint32_t *resolution) { | |||
| 304 | cairo_stroke(ctx); | 342 | cairo_stroke(ctx); |
| 305 | } | 343 | } |
| 306 | } | 344 | } |
| 307 | 345 | #ifdef EXTRAS | |
| 346 | now = time(NULL); | ||
| 347 | brokentime = localtime(&now); | ||
| 348 | if (led_clock) { | ||
| 349 | i3lock_draw_led_clock(xcb_ctx, | ||
| 350 | &i3lock_led_clock, | ||
| 351 | resolution, | ||
| 352 | brokentime); | ||
| 353 | } | ||
| 354 | if (digital_clock) { | ||
| 355 | i3lock_draw_digital_clock(xcb_ctx, | ||
| 356 | &i3lock_digital_clock, | ||
| 357 | resolution, | ||
| 358 | brokentime); | ||
| 359 | } | ||
| 360 | /* elapsed time or display text */ | ||
| 361 | if (elapsed_time) { | ||
| 362 | i3lock_draw_elapsed_time(xcb_ctx, | ||
| 363 | &i3lock_elapsed_time, | ||
| 364 | resolution, | ||
| 365 | &now); | ||
| 366 | } else if (display_text != NULL) { | ||
| 367 | i3lock_draw_string(xcb_ctx, | ||
| 368 | display_text, | ||
| 369 | &i3lock_elapsed_time, | ||
| 370 | resolution); | ||
| 371 | } | ||
| 372 | #endif | ||
| 308 | if (xr_screens > 0) { | 373 | if (xr_screens > 0) { |
| 309 | /* Composite the unlock indicator in the middle of each screen. */ | 374 | /* Composite the unlock indicator in the middle of each screen. */ |
| 310 | for (int screen = 0; screen < xr_screens; screen++) { | 375 | for (int screen = 0; screen < xr_screens; screen++) { |
