Codebase list i3lock-color / 926eeeb
New upstream release. Kali Janitor 2 years ago
30 changed file(s) with 815 addition(s) and 619 deletion(s). Raw diff Collapse all Expand all
2323 ## Environment
2424 Output of `i3lock --version`:
2525 <pre>
26 i3lock version:
26 i3lock version:
2727 </pre>
2828
2929 Where'd you get i3lock-color from?
33 Closes #[issue number]
44
55 ## Description
6 -
6 -
77
88 ### Screenshots/screencaps
99 <!--
66 steps:
77 - uses: actions/checkout@v2
88 - name: Install deps
9 run: sudo apt install pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
10 - run: chmod +x build.sh
11 - run: ./build.sh
12 - run: cd build && make check
13 - run: cd build && make distcheck
9 run: |
10 sudo apt update
11 sudo apt install pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
12 - name: Build
13 run: ./build.sh
14 - name: Check and distcheck
15 run: |
16 cd build
17 make check
18 make distcheck
1419 - name: Upload binary artifact
1520 uses: actions/upload-artifact@v2
1621 with:
2020
2121 strategy:
2222 fail-fast: false
23 matrix:
23 # matrix:
2424 # Override automatic language detection by changing the below list
2525 # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
26 language: ['cpp']
26 # language: ['cpp']
2727 # Learn more...
2828 # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
2929
3737
3838 # If this run was triggered by a pull request event, then checkout
3939 # the head of the pull request instead of the merge commit.
40 - run: git checkout HEAD^2
41 if: ${{ github.event_name == 'pull_request' }}
40 # CodeQL apparently deprecated this feature and now warns on running this command
41 # - run: git checkout HEAD^2
42 # if: ${{ github.event_name == 'pull_request' }}
4243
4344 # Initializes the CodeQL tools for scanning.
4445 - name: Initialize CodeQL
4647 with:
4748 languages: ${{ matrix.language }}
4849 # If you wish to specify custom queries, you can do so here or in a config file.
49 # By default, queries listed here will override any specified in a config file.
50 # By default, queries listed here will override any specified in a config file.
5051 # Prefix the list here with "+" to use these queries and those in the config file.
5152 # queries: ./path/to/local/query, your-org/your-repo/queries@main
5253
6364 # uses a compiled language
6465
6566 - run: |
67 sudo apt-get update
6668 sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
6769 ./build.sh
6870
22 tags
33 *.swp
44 *.gz
5 /pam/i3lock
5 *~
66
77 ################################################################################
88 # https://raw.githubusercontent.com/github/gitignore/master/Autotools.gitignore
3030 /install-sh
3131 /missing
3232 /stamp-h1
33 *.in~
34 pam/i3lock
0 2.13.c.1
0 2.13.c.3
00 Copyright © 2010-2011, Michael Stapelberg
11 Copyright © 2015, Cassandra Fox
2 Copyright © 2020, Raymond Li
2 Copyright © 2021, Raymond Li
33 All rights reserved.
44
55 Redistribution and use in source and binary forms, with or without
00 # i3lock-color
11
22 ![Language count](https://img.shields.io/github/languages/count/Raymo111/i3lock-color)
3 ![Top language](https://img.shields.io/github/languages/top/Raymo111/i3lock-color)
3 [![Top language](https://img.shields.io/github/languages/top/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/search?l=c)
44 ![Repo size](https://img.shields.io/github/repo-size/Raymo111/i3lock-color)
5 ![Open issues](https://img.shields.io/github/issues-raw/Raymo111/i3lock-color)
6 ![Closed issues](https://img.shields.io/github/issues-closed-raw/Raymo111/i3lock-color?color=brightgreen)
7 ![Open PRs](https://img.shields.io/github/issues-pr-raw/Raymo111/i3lock-color?label=open%20PRs)
8 ![Closed PRs](https://img.shields.io/github/issues-pr-closed-raw/Raymo111/i3lock-color?color=brightgreen&label=closed%20PRs)
9 ![Contributor count](https://img.shields.io/github/contributors/Raymo111/i3lock-color)
10 ![GitHub Release Date](https://img.shields.io/github/release-date/Raymo111/i3lock-color?label=latest%20release)
11 ![Commits](https://img.shields.io/github/commits-since/Raymo111/i3lock-color/latest?include_prereleases&sort=semver)
5 [![Open issues](https://img.shields.io/github/issues-raw/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/issues?q=is%3Aopen+is%3Aissue)
6 [![Closed issues](https://img.shields.io/github/issues-closed-raw/Raymo111/i3lock-color?color=brightgreen)](https://github.com/Raymo111/i3lock-color/issues?q=is%3Aissue+is%3Aclosed)
7 [![Open PRs](https://img.shields.io/github/issues-pr-raw/Raymo111/i3lock-color?label=open%20PRs)](https://github.com/Raymo111/i3lock-color/pulls?q=is%3Aopen+is%3Apr)
8 [![Closed PRs](https://img.shields.io/github/issues-pr-closed-raw/Raymo111/i3lock-color?color=brightgreen&label=closed%20PRs)](https://github.com/Raymo111/i3lock-color/pulls?q=is%3Apr+is%3Aclosed)
9 [![Contributors](https://img.shields.io/github/contributors/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/graphs/contributors)
10 [![Latest release](https://img.shields.io/github/release-date/Raymo111/i3lock-color?label=latest%20release)](https://github.com/Raymo111/i3lock-color/releases/latest)
11 [![Commits](https://img.shields.io/github/commits-since/Raymo111/i3lock-color/latest?include_prereleases&sort=semver)](https://github.com/Raymo111/i3lock-color/commits/master)
1212 ![Latest commit](https://img.shields.io/github/last-commit/Raymo111/i3lock-color)
13 ![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/i3lock-color?logo=arch%20linux&label=Community%20version)
14 ![AUR git ver](https://img.shields.io/aur/version/i3lock-color-git?label=AUR%20git%20ver)
13 <!--![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/i3lock-color?logo=arch%20linux&label=Community%20version)-->
14 [![AUR release ver](https://img.shields.io/aur/version/i3lock-color?label=AUR%20release%20ver)](https://aur.archlinux.org/packages/i3lock-color/)
15 [![AUR git ver](https://img.shields.io/aur/version/i3lock-color-git?label=AUR%20git%20ver)](https://aur.archlinux.org/packages/i3lock-color-git/)
1516 ![AUR votes](https://img.shields.io/aur/votes/i3lock-color-git)
16 ![GitHub forks](https://img.shields.io/github/forks/Raymo111/i3lock-color)
17 ![GitHub stars](https://img.shields.io/github/stars/Raymo111/i3lock-color)
18 ![GitHub watchers](https://img.shields.io/github/watchers/Raymo111/i3lock-color)
19 ![Maintenance](https://img.shields.io/maintenance/yes/2020)
17 [![GitHub forks](https://img.shields.io/github/forks/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/network/members)
18 [![GitHub stars](https://img.shields.io/github/stars/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/stargazers)
19 [![GitHub watchers](https://img.shields.io/github/watchers/Raymo111/i3lock-color)](https://github.com/Raymo111/i3lock-color/watchers)
20 ![Maintained](https://img.shields.io/maintenance/yes/2021)
2021
2122 ### The world's most popular non-default computer lockscreen.
2223 **A modern version of i3lock with color functionality and other features.**
2324
24 ![i3lock-color in action](screenshot.png "Screenshot sample")
25 ![i3lock-color in action](examples/screenshot.png "Screenshot sample")
2526
2627 i3lock is a simple screen locker like slock. After starting it, you will see a white screen (you can configure the color/an image). You can return to your screen by entering your password.
2728
4546 - Key highlight color
4647 - Backspace highlight color
4748 - Text colors for most/all strings
49 - Outline colors
4850 - Changing all of the above depending on PAM's authentication status
4951 - Blurring the current screen and using that as the lock background
5052 - Showing a clock in the indicator
5153 - Refreshing on a timer, instead of on each keypress
5254 - Positioning the various UI elements
5355 - Changing the ring radius and thickness, as well as text size
54 - Passthrough media keys
56 - Options for passwordless auth, removing modkey indicator
57 - Passing through media keys
5558 - A new bar indicator, which replaces the ring indicator with its own set of options
5659 - An experimental thread for driving the redraw ticks, so that things like the bar/clock still update when PAM is blocking
60 - Any other feature you want (add it yourself through a PR or make a feature request issue!)
5761
5862 ## Dependencies
5963 The following dependencies will need to be installed for a successful build, depending on your OS/distro.
60
61 ### Ubuntu 18/20.04 LTS
62 Run this command to install all dependencies:
63 ```
64 sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
65 ```
66
67 ### Debian
68 Replace `libxcb-util-dev` with `libxcb-util0-dev` in the Ubuntu installation command:
69 ```
70 sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util0-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
71 ```
7264
7365 ### Arch Linux
7466 - autoconf
8577 - xcb-util-image
8678 - xcb-util-xrm
8779
80 ### Debian
81 Run this command to install all dependencies:
82 ```
83 sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util0-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
84 ```
85 If you still see missing packages during build after installing all of these dependencies, try following the steps [here](https://github.com/Raymo111/i3lock-color/issues/211#issuecomment-809891727).
86
8887 ### Fedora
8988 Run this command to install all dependencies:
9089
9291 sudo dnf install -y autoconf automake cairo-devel fontconfig gcc libev-devel libjpeg-turbo-devel libXinerama libxkbcommon-devel libxkbcommon-x11-devel libXrandr pam-devel pkgconf xcb-util-image-devel xcb-util-xrm-devel
9392 ```
9493
94 ### Ubuntu 18/20.04 LTS
95 Run this command to install all dependencies:
96 ```
97 sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
98 ```
99
95100 ## Building i3lock-color
96101 Before you build - check and see if there's a packaged version available for your distro (there usually is, either in a community repo/PPA).
97102
98 If there's no packaged version available - think carefully, since you're using a forked screen locker at your own risk.
103 **If you want to build a non-debug version, you should tag your build before configuring.**
99104
100 **If you want to build a non-debug version, you should tag your build before configuring.** For example: `git tag -f "git-$(git rev-parse --short HEAD)"` will add a tag with the short commit ID, which will be used for the version info. Issues asking about ASAN/complaints about i3lock-color being slow / etc will likely be closed. i3lock-color uses GNU autotools for building.
105 For example: `git tag -f "git-$(git rev-parse --short HEAD)"` will add a tag with the short commit ID, which will be used for the version info.
101106
102 To use i3lock-color, first install the dependencies listed above, then clone the repo:
107 i3lock-color uses GNU autotools for building.
108
109 To build/install i3lock-color, first install the dependencies listed above, then clone the repo:
103110 ```
104111 git clone https://github.com/Raymo111/i3lock-color.git
105112 cd i3lock-color
106113 ```
107114 To build without installing, run:
108115 ```
109 chmod +x build.sh
110116 ./build.sh
111117 ```
112 To install after building, run:
118 To build AND install, run:
113119 ```
114 chmod +x install-i3lock-color.sh
115120 ./install-i3lock-color.sh
116121 ```
117122 You may choose to modify the script based on your needs/OS/distro.
118123
119124 ## Arch Linux Packages
120 [Stable version in Community](https://www.archlinux.org/packages/community/x86_64/i3lock-color/)
125 ~~[Stable version in Community](https://www.archlinux.org/packages/community/x86_64/i3lock-color/)~~
121126
122 [Git Version on AUR](https://aur.archlinux.org/packages/i3lock-color-git/)
127 Unfortunately the previous maintainer left, and the package got dumped back into the AUR where I'm now maintaining it. I'm looking for a TU to sponsor it back into Community, but for now, get it on AUR:
128 - [Release Version on AUR](https://aur.archlinux.org/packages/i3lock-color/)
129 - [Git Version on AUR](https://aur.archlinux.org/packages/i3lock-color-git/)
130
131 ## Gentoo Package
132 i3lock-color is available on **GURU**, under [`x11-misc/i3lock-color`](https://github.com/gentoo/guru/tree/master/x11-misc/i3lock-color).
123133
124134 ## FreeBSD port
125 [i3lock-color-port](https://github.com/rkashapov/i3lock-color-port/)
135 ~~[i3lock-color-port](https://github.com/rkashapov/i3lock-color-port/)~~ (severely out of date).
126136
127137 ## Running i3lock-color
128138 Simply invoke the 'i3lock' command. To get out of it, enter your password and press enter.
129139
130 A [sample script](lock.sh) is included in this repository. [See the script in action](https://streamable.com/fpl46)
140 A [sample script](examples/lock.sh) is included in this repository. [See the script in action](https://streamable.com/fpl46)
131141
132142 On OpenBSD the `i3lock` binary needs to be setgid `auth` to call the authentication helpers, e.g. `/usr/libexec/auth/login_passwd`.
133143
135145 This project was started by [eBrnd](https://github.com/eBrnd/i3lock-color), maintained for a few years by [PandorasFox](https://github.com/PandorasFox) and now maintained and being developed by [Raymo111](https://github.com/Raymo111). The full list of contributors can be found [here](https://github.com/Raymo111/i3lock-color/graphs/contributors).
136146
137147 ## Upstream
138 Please submit pull requests for i3lock things to https://github.com/i3/i3lock and pull requests for additional features on top of regular i3lock at https://github.com/Raymo111/i3lock-color.
148 Please submit pull requests for i3lock things to [https://github.com/i3/i3lock](https://github.com/i3/i3lock) and pull requests for additional features on top of regular i3lock at [https://github.com/Raymo111/i3lock-color](https://github.com/Raymo111/i3lock-color).
1313 #endif
1414 void blur_impl_horizontal_pass_generic(uint32_t *src, uint32_t *dst, int width, int height);
1515 #endif
16
17
0 #!/bin/bash
0 #!/bin/sh -x
1
2 configureOpts="--disable-sanitizers"
3
4 while getopts ":hd" opt; do
5 case ${opt} in
6 h ) echo "Use -d to turn on sanitizers (for debugging only)"
7 exit;;
8 d ) configureOpts=""
9 ;;
10 \? ) echo "Usage: $0 [-h] [-d]"
11 exit;;
12 esac
13 done
14
15 configureOpts="${configureOpts} --prefix=/usr --sysconfdir=/etc"
16
117 autoreconf -fiv
218
319 BUILD_DIR=build/
521 mkdir -vp $BUILD_DIR
622 cd $BUILD_DIR || { echo "cd $BUILD_DIR"; exit 127; }
723
8 ../configure --prefix=/usr --sysconfdir=/etc
24 ../configure ${configureOpts}
925
1026 make
11 # Run autoreconf -fi to generate a configure script from this file.
22
33 AC_PREREQ([2.69])
4 AC_INIT([i3lock-color], [m4_esyscmd_s([cat I3LOCK_VERSION])], [https://github.com/Raymo11/i3lock-color/issues])
4 AC_INIT([i3lock-color],[m4_esyscmd_s([cat I3LOCK_VERSION])],[https://github.com/Raymo11/i3lock-color/issues])
55 # For AX_EXTEND_SRCDIR
66 AX_ENABLE_BUILDDIR
77 AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2])
4949 dnl on its fourth argument.
5050 AX_CHECK_ENABLE_DEBUG([yes], , [UNUSED_NDEBUG], [$is_release])
5151
52 AC_PROG_CC_C99
52 AC_PROG_CC
5353
5454 # For strnlen() and vasprintf().
5555 AC_USE_SYSTEM_EXTENSIONS
6767 AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3lock requires])])
6868 AC_CHECK_FUNCS([explicit_bzero])
6969
70 # Checks for libraries.
71
70 # Check for libraries
7271 AC_SEARCH_LIBS([floor], [m], , [AC_MSG_FAILURE([cannot find the required floor() function despite trying to link with -lm])])
7372
7473 # libev does not ship with a pkg-config file :(.
7675
7776 AC_SEARCH_LIBS([shm_open], [rt])
7877
79 # Use system-auth instead of login on Arch (TODO: Implement Gentoo as well)
80 if [[ -f /etc/arch-release ]]; then
81 echo "Using PAM for Arch"
82 sed -i "s/^#auth include system-auth/auth include system-auth/g" ../pam/i3lock
78 # Use system-local-login instead of login on Arch and Gentoo
79 if [[ -f /etc/arch-release ]] || [[ -f /etc/gentoo-release ]]; then
80 echo "Using PAM for Arch/Gentoo"
81 sed -i "s/^#auth include system-local-login/auth include system-local-login/g" ../pam/i3lock
8382 sed -i "s/^auth include login/#auth include login/g" ../pam/i3lock
8483 fi
8584
159158
160159 AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}])
161160 AS_HELP_STRING([code coverage:], [${CODE_COVERAGE_ENABLED}])
162 AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}])
161 AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}])"
163162
164 To compile, run:
165
166 cd `pwd` && make
167 --------------------------------------------------------------------------------"
163 #To compile, run:
164 #
165 # cd `pwd` && make
166 echo \
167 "--------------------------------------------------------------------------------"
0 i3lock-color (2.13.c.3-0kali1) UNRELEASED; urgency=low
1
2 * New upstream release.
3
4 -- Kali Janitor <[email protected]> Tue, 01 Jun 2021 06:39:55 -0000
5
06 i3lock-color (2.13.c.1-0kali1) kali-dev; urgency=medium
17
28 [ Kali Janitor ]
0 #!/bin/sh
1
2 B='#00000000' # blank
3 C='#ffffff22' # clear ish
4 D='#ff00ffcc' # default
5 T='#ee00eeee' # text
6 W='#880000bb' # wrong
7 V='#bb00bbbb' # verifying
8
9 i3lock \
10 --insidevercolor=$C \
11 --ringvercolor=$V \
12 \
13 --insidewrongcolor=$C \
14 --ringwrongcolor=$W \
15 \
16 --insidecolor=$B \
17 --ringcolor=$D \
18 --linecolor=$B \
19 --separatorcolor=$D \
20 \
21 --verifcolor=$T \
22 --wrongcolor=$T \
23 --timecolor=$T \
24 --datecolor=$T \
25 --layoutcolor=$T \
26 --keyhlcolor=$W \
27 --bshlcolor=$W \
28 \
29 --screen 1 \
30 --blur 5 \
31 --clock \
32 --indicator \
33 --timestr="%H:%M:%S" \
34 --datestr="%A, %m %Y" \
35 --keylayout 1 \
0 #!/bin/sh
1
2 B='#00000000' # blank
3 C='#ffffff22' # clear ish
4 D='#ff00ffcc' # default
5 T='#ee00eeee' # text
6 W='#880000bb' # wrong
7 V='#bb00bbbb' # verifying
8
9 i3lock \
10 --blur 5 \
11 --bar-indicator \
12 --bar-position y+h \
13 --bar-direction 1 \
14 --bar-max-height 50 \
15 --bar-base-width 50 \
16 --bar-color 000000cc \
17 --keyhlcolor 880088cc \
18 --bar-periodic-step 50 \
19 --bar-step 50 \
20 --redraw-thread \
21 \
22 --clock \
23 --force-clock \
24 --timepos x+5:y+h-80 \
25 --timecolor 880088ff \
26 --datepos tx:ty+15 \
27 --datecolor 990099ff \
28 --date-align 1 \
29 --time-align 1 \
30 --ringvercolor 8800ff88 \
31 --ringwrongcolor ff008888 \
32 --statuspos x+5:y+h-16 \
33 --verif-align 1 \
34 --wrong-align 1 \
35 --verifcolor ffffffff \
36 --wrongcolor ffffffff \
37 --modifpos -50:-50
Binary diff not shown
1818
1919 char str[512];
2020 double size;
21 double outline_width;
2122
2223 cairo_font_face_t *font;
2324
2425 rgba_t color;
26 rgba_t outline_color;
2527 double x, y;
2628
2729 int align;
+230
-238
i3lock.1 less more
77 .fi
88 ..
99
10 .TH i3lock-color 1 "JULY 2020" Linux "User Manuals"
10 .TH i3lock-color 1 "MAY 2021" Linux "User Manuals"
1111
1212 .SH NAME
1313 i3lock-color \- improved screen locker
3030 .RB [\|\-m\|]
3131
3232 .SH DESCRIPTION
33 .B i3lock-color
33 .B i3lock\-color
3434 is a simple screen locker like slock. After starting it, you will see a white
3535 screen (you can configure the color/an image). You can return to your screen by
3636 entering your password.
3737
38 .SH IMPROVEMENTS
38 .SH FEATURES
3939 .IP \[bu] 2
4040 i3lock forks, so you can combine it with an alias to suspend to RAM
41 (run "i3lock && echo mem > /sys/power/state" to get a locked screen after waking up your computer from suspend to RAM)
41 (run "i3lock && echo mem > /sys/power/state" to get a locked screen after waking
42 up your computer from suspend to RAM)
4243 .IP \[bu]
43 You can specify either a background color or a PNG image which will be displayed while your screen is locked.
44 You can specify either a background color or a PNG image which will be displayed
45 while your screen is locked.
4446 .IP \[bu]
4547 You can specify whether i3lock should bell upon a wrong password.
4648 .IP \[bu]
7476
7577 .TP
7678 .BI \fB\-\-raw= format
77 Read the image given by \-\-image as a raw image instead of PNG. The argument is the image's format
78 as <width>x<height>:<pixfmt>. The supported pixel formats are:
79 Read the image given by \-\-image as a raw image instead of PNG. The argument is
80 the image's format as <width>x<height>:<pixfmt>.
81 The supported pixel formats are:
7982 \'native', 'rgb', 'xrgb', 'rgbx', 'bgr', 'xbgr', and 'bgrx'.
8083 The "native" pixel format expects a pixel as a 32-bit (4-byte) integer in
81 the machine's native endianness, with the upper 8 bits unused. Red, green and blue are stored in
82 the remaining bits, in that order.
84 the machine's native endianness, with the upper 8 bits unused.
85 Red, green and blue are stored in the remaining bits, in that order.
8386
8487 .BR Example:
8588 .Vb 6
104107
105108 .TP
106109 .BI \-c\ rrggbbaa \fR,\ \fB\-\-color= rrggbbaa
107 Turn the screen into the given color instead of white. Color must be given in 4-byte
108 format: rrggbbaa (i.e. ff0000ff is opaque red).
109 Use the last byte for alpha. Setting this below FF (i.e. ff000088) will allow your screen to be shown translucently if you use a compositor (e.g. compton, xcompmgr).
110 Turn the screen into the given color instead of white. Color must be given in
111 4-byte format: rrggbbaa (i.e. ff0000ff is opaque red).
112 Use the last byte for alpha. Setting this below FF (i.e. ff000088) will allow
113 your screen to be shown translucently if you use a compositor (e.g. compton,
114 xcompmgr).
110115
111116 .TP
112117 .B \-t, \-\-tiling
113 If an image is specified (via \-i) it will display the image tiled all over the screen
114 (with a multi-monitor setup, the image is visible on all screens).
118 If an image is specified (via \-i) it will display the image tiled all over the
119 screen (with a multi-monitor setup, the image is visible on all screens).
115120
116121 .TP
117122 .B \-C, \-\-centered
118 If an image is specified (via \-i) it will display the image centered on the screen
119 (with a multi-monitor setup, the image is visible on all screens).
123 If an image is specified (via \-i) it will display the image centered on the
124 screen (with a multi-monitor setup, the image is visible on all screens).
120125
121126 .TP
122127 .BI \-p\ win|default \fR,\ \fB\-\-pointer= win|default
129134
130135 .TP
131136 .B \-e, \-\-ignore\-empty\-password
132 When an empty password is provided by the user, do not validate
133 it. Without this option, the empty password will be provided to PAM
134 and, if invalid, the user will have to wait a few seconds before
135 another try. This can be useful if the XF86ScreenSaver key is used to
136 put a laptop to sleep and bounce on resume or if you happen to wake up
137 your computer with the enter key.
137 When an empty password is provided by the user, do not validate it. Without this
138 option, the empty password will be provided to PAM and, if invalid, the user
139 will have to wait a few seconds before another try. This can be useful if the
140 XF86ScreenSaver key is used to put a laptop to sleep and bounce on resume or if
141 you happen to wake up your computer with the enter key.
138142
139143 .TP
140144 .B \-f, \-\-show\-failed\-attempts
145149 Enables debug logging.
146150 Note, that this will log the password used for authentication to stdout.
147151
148 .SH i3lock-color options
152 .SH i3lock-color OPTIONS
149153 .TP
150154 .B \-S number, \-\-screen=number
151 Specifies which display to draw the unlock indicator and clock on. By default, they'll be placed on every screen.
155 Specifies which display to draw the unlock indicator and clock on. By default,
156 they'll be placed on every screen.
152157 Note that this number is zero indexed. The ordering is dependent on libxinerama.
153158
154159 .TP
155160 .B \-B sigma, \-\-blur=sigma
156161 Captures the screen and blurs it using the given sigma (radius).
157162 Images may still be overlaid over the blurred screenshot.
158 As an alternative to this option, you could specify a translucent background color
159 (-c option) with a fully transparent or translucent color, and use a compositor to perform blurring (e.g. compton, picom).
163 As an alternative to this option, you could specify a translucent background
164 color (-c option) with a fully transparent or translucent color, and use a
165 compositor to perform blurring (e.g. compton, picom).
166
167 .TP
168 .B \-k, \-\-clock, \-\-force\-clock
169 Displays the clock. \-\-force\-clock also displays the clock when there's
170 indicator text (useful for when the clock is not positioned with the indicator).
160171
161172 .TP
162173 .B \-\-indicator
163174 Forces the indicator to always be visible, instead of only showing on activity.
164175
165176 .TP
177 .B \-\-radius
178 The radius of the circle. Defaults to 90.
179
180 .TP
181 .B \-\-ring\-width
182 The width of the ring unlock indicator. Defaults to 7.0.
183
184 .TP
185 .B \-\-{inside, ring}\-color=rrggbbaa
186 Sets the idle color for the interior circle and ring.
187
188 .TP
189 .B \-\-{inside, ring}ver\-color=rrggbbaa
190 Sets the interior circle and ring color while the password is being verified.
191
192 .TP
193 .B \-\-{inside, ring}wrong\-color=rrggbbaa
194 Sets the interior circle and ring color for during incorrect password flashes.
195
196 .TP
197 .B \-\-line\-color=rrggbbaa
198 Sets the color for the line separating the inside circle and the outer ring.
199
200 .TP
201 .B \-\-line\-uses\-{inside, ring}
202 Overrides \-\-linecolor. The line will match the {inside, ring} color.
203 Note: these two options conflict with each other.
204
205 .TP
206 .B \-\-{key, bs}hl\-color=rrggbbaa
207 Sets the color of highlight arcs on the ring upon keypress and backspace.
208
209 .TP
210 .B \-\-separator\-color=rrggbbaa
211 Sets the color of the seperators at both ends of the highlight arcs on the ring.
212
213 .TP
214 .B \-\-{verif, wrong}\-color=rrggbbaa
215 Sets the color of the status text while verifying and when password is wrong.
216
217 .TP
218 .B \-\-{layout, time, date, greeter}\-color=rrggbbaa
219 Sets text colors.
220
221 .TP
222 .B \-\-time\-str="%H:%M:%S"
223 Sets the format used for generating the time string.
224 See strftime(3) for a full list of format specifiers.
225
226 .TP
227 .B \-\-date\-str="%A, %m %Y"
228 Sets the format used for generating the date string.
229
230 .TP
231 .B \-\-verif\-text="verifying…"
232 Sets the string to be shown while verifying the password/input/key/etc.
233
234 .TP
235 .B \-\-wrong\-text="wrong!"
236 Sets the string to be shown upon entering an incorrect password.
237
238 .TP
166239 .B \-\-keylayout mode
167 Displays the keylayout. Positionable similar to date, time, and indicator. Modes are as follows:
240 Displays the keylayout. Positionable similar to date, time, and indicator.
241 Modes are as follows:
168242 .RS
169243 .RS
170244 0 - Displays the full string returned by the query, i.e. "English (US)"
174248 .RE
175249
176250 .TP
177 .B \-k, \-\-clock, \-\-force\-clock
178 Displays the clock. \-\-force\-clock also displays the clock when there's indicator text
179 (useful for when the clock is not positioned with the indicator).
180
181 .TP
182 .B \-\-composite
183 Some compositors have problems with i3lock trying to render over them, so this argument is disabled by default.
184 However, some will work properly with it, so it's been left enabled.
185
186 .TP
187 .B \-\-pass\-media\-keys
188 Allow the following keys to be used while the screen is locked by passing them through:
189 XF86AudioPlay, XF86AudioPause, XF86AudioStop, XF86AudioPrev, XF86AudioNext, XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume.
190
191 .TP
192 .B \-\-pass\-screen\-keys
193 Allow the following keys to be used while the screen is locked by passing them through:
194 XF86MonBrightnessUp, XF86MonBrightnessDown.
195
196 .TP
197 .B \-\-pass\-power\-keys
198 Allow the following keys to be used while the screen is locked by passing them through:
199 XF86PowerDown, XF86PowerOff, XF86Sleep.
200
201 .TP
202 .B \-\-pass\-volume\-keys
203 Allow the following keys to be used while the screen is locked by passing them through:
204 XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume.
205
206 .TP
207 .B \-\-insidevercolor=rrggbbaa
208 Sets the interior circle color while the password is being verified.
209
210 .TP
211 .B \-\-insidewrongcolor=rrggbbaa
212 Sets the interior circle color for during flash for an incorrect password.
213
214 .TP
215 .B \-\-insidecolor=rrggbbaa
216 Sets the default "resting" color for the interior circle.
217
218 .TP
219 .B \-\-ringvercolor=rrggbbaa
220 Sets the ring color while the password is being verified.
221
222 .TP
223 .B \-\-ringwrongcolor=rrggbbaa
224 Sets the ring color during the flash for an incorrect password.
225
226 .TP
227 .B \-\-ringcolor=rrggbbaa
228 Sets the default ring color.
229
230 .TP
231 .B \-\-linecolor=rrggbbaa
232 Sets the color for the line separating the inside circle, and the outer ring.
233
234 .TP
235 .B \-\-line\-uses\-ring
236 Conflicts with \-\-line\-uses\-inside. Overrides \-\-linecolor. The line will match the ring color.
237
238 .TP
239 .B \-\-line\-uses\-inside
240 Conflicts with \-\-line\-uses\-ring. Overrides \-\-linecolor; the line will match the inside color.
241
242 .TP
243 .B \-\-keyhlcolor=rrggbbaa
244 Sets the color of the ring 'highlight' strokes that appear upon keypress.
245
246 .TP
247 .B \-\-bshlcolor=rrggbbaa
248 Sets the color of the ring 'highlight' strokes that appear upon backspace.
249
250 .TP
251 .B \-\-separatorcolor=rrggbbaa
252 Sets the color of the 'separtor', which is at both ends of the ring highlights.
253
254 .TP
255 .B \-\-verifcolor=rrggbbaa
256 Sets the color of the status text while verifying.
257
258 .TP
259 .B \-\-wrongcolor=rrggbbaa
260 Sets the color of the status text when "wrong".
261
262 .TP
263 .B \-\-layoutcolor=rrggbbaa
264 Sets the color of the keyboard layout text.
265
266 .TP
267 .B \-\-indpos="x position:y position"
251 .B \-\-noinput\-text="no input"
252 Sets the string to be shown upon pressing backspace without anything to delete.
253
254 .TP
255 .B \-\-lock\-text="locking…"
256 Sets the string to be shown while acquiring pointer and keyboard focus.
257
258 .TP
259 .B \-\-lockfailed\-text="lock failed!"
260 Sets the string to be shown after failing to acquire pointer and keyboard focus.
261
262 .TP
263 .B \-\-greeter\-text=""
264 Sets the greeter text.
265
266 .TP
267 .B \-\-no\-modkey\-text
268 Hides the modkey indicator (Num, Caps Lock ...)
269
270 .TP
271 .B \-\-{time, date, layout, verif, wrong, modif, greeter}\-align
272 Sets the text alignment of the time, date, keylayout, verification, wrong,
273 modifier and greeter texts.
274 .RS
275 .RS
276 0 - centered (default)
277 1 - left aligned
278 2 - right aligned
279 .RE
280 .RE
281
282 .TP
283 .B \-\-{time, date, layout, verif, wrong, greeter}outline\-color=rrggbbaa
284 Sets the color of the outlines.
285
286 .TP
287 .B \-\-{time, date, layout, verif, wrong, greeter}\-font=sans\-serif
288 Sets the font used to render various strings.
289
290 .TP
291 .B \-\-{time, date, layout, verif, wrong, greeter}\-size=number
292 Sets the font size used to render various strings.
293
294 .TP
295 .B \-\-{time, date, layout, verif, wrong, greeter, modifier}outline\-width=number
296 Sets the width of the outline.
297
298 .TP
299 .B \-\-ind\-pos="x\-position:y\-position"
268300 Sets the position for the unlock indicator. Valid variables include:
269301 .RS
270302 .RS
271 x - x position of the current display. Corresponds to the leftmost row of pixels on that display.
272 y - y position of the current display. Corresponds to the topmost row of pixels on that display.
303 x - x position of the current display.
304 Corresponds to the leftmost column of pixels on that display.
305 y - y position of the current display.
306 Corresponds to the topmost row of pixels on that display.
273307 w - width of the current display.
274308 h - height of the current display.
275309 r - the unlock indicator radius.
277311 .RE
278312
279313 .TP
280 .B \-\-timecolor=rrggbbaa
281 Sets the color of the time in the clock.
282
283 .TP
284 .B \-\-timestr="%H:%M:%S"
285 Sets the format used for generating the time string. See strftime(3) for a full list of format specifiers.
286
287 .TP
288 .B \-\-timepos="x position:y position"
289 Sets the position for the time string. All the variables from \-\-indpos may be used, in addition to:
314 .B \-\-time\-pos="x\-position:y\-position"
315 Sets the position for the time string. All the variables from \-\-indpos may be
316 used, in addition to:
290317 .RS
291318 .RS
292319 ix - the x value of the indicator on the current display.
295322 .RE
296323
297324 .TP
298 .B \-\-time\-align, \-\-date\-align, \-\-layout\-align, \-\-verif\-align, \-\-wrong\-align, \-\-modif\-align, \-\-greeter\-align
299 Sets the text alignment of the time, date, keylayout, verification text, wrong text, modifier text and greeter text.
300 .RS
301 .RS
302 0 - centered (default)
303 1 - left aligned
304 2 - right aligned
305 .RE
306 .RE
307
308 .TP
309 .B \-\-datecolor=rrggbbaa
310 Sets the color of the date in the clock.
311
312 .TP
313 .B \-\-datestr="%A, %m %Y"
314 Sets the format used for generating the date string. See strftime(3) for a full list of format specifiers.
315
316 .TP
317 .B \-\-{time, date, layout, verif, wrong, greeter}\-font=sans\-serif
318 Sets the font used to render various strings.
319
320 .TP
321 .B \-\-{time, date, layout, verif, wrong, greeter}size=number
322 Sets the font size used to render various strings.
323
324 .TP
325 .B \-\-datepos="x position:y position"
326 Sets the position for the date string. All the variables from \-\-indpos and \-\-timepos may be used, in addition to:
325 .B \-\-date\-pos="x\-position:y\-position"
326 Sets the position for the date string. All the variables from \-\-indpos and
327 \-\-timepos may be used, in addition to:
327328 .RS
328329 .RS
329330 tx - the computed x value of the timestring, for the current display.
332333 .RE
333334
334335 .TP
335 .B \-\-greetertext="text"
336 Sets the greeter text. Defaults to "".
337
338 .TP
339 .B \-\-greetercolor=rrggbbaa
340 Sets the color of the greeter text.
341
342 .TP
343 .B \-\-greeterpos="x position:y position"
344 Sets the position for the greeter string. All the variables from \-\-indpos and \-\-timepos may be used.
345
346 .TP
347 .B \-\-refresh\-rate=seconds\-as\-double
348 The refresh rate of the indicator, given in seconds. This should automatically align itself, but is somewhat buggy currently.
349 Values less than one will work, but may result in poor system performance.
350
351 .TP
352 .B \-\-veriftext="text"
353 Sets the string to be shown while verifying the password/input/key/etc. Defaults to "verifying…".
354
355 .TP
356 .B \-\-wrongtext="text"
357 Sets the string to be shown upon entering an incorrect password. Defaults to "wrong!".
358
359 .TP
360 .B \-\-noinputtext="text"
361 Sets the string to be shown upon pressing backspace without anything to delete. Defaults to "no input".
362
363 .TP
364 .B \-\-locktext="text"
365 Sets the string to be shown while acquiring pointer and keyboard focus. Defaults to "locking…".
366
367 .TP
368 .B \-\-lockfailedtext="text"
369 Sets the string to be shown after failing to acquire pointer and keyboard focus. Defaults to "lock failed!".
370
371 .TP
372 .B \-\-radius
373 The radius of the circle. Defaults to 90.
374
375 .TP
376 .B \-\-ring\-width
377 The width of the ring unlock indicator. Defaults to 7.0.
336 .B \-\-greeter\-pos="x\-position:y\-position"
337 Sets the position for the greeter string. All the variables from \-\-indpos and
338 \-\-timepos may be used.
339
340 .TP
341 .B \-\-pass\-{media, screen, power, volume}\-keys
342 Allow the following keys to be used normally while the screen is locked by
343 passing them through:
344 .RS
345 .RS
346 media - XF86AudioPlay, XF86AudioPause, XF86AudioStop, XF86AudioPrev,
347 XF86AudioNext, XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume
348 screen - XF86MonBrightnessUp, XF86MonBrightnessDown
349 power - XF86PowerDown, XF86PowerOff, XF86Sleep
350 volume - XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume
351 .RE
352 .RE
378353
379354 .TP
380355 .B \-\-bar\-indicator
381 Replaces the usual ring indicator with a bar indicator, with a variety of options.
382
383 .TP
384 .B \-\-redraw\-thread
385 Starts a separate thread for redrawing the screen. Potentially worse for security, but makes the bar indicator still do
386 its usual periodic redraws when PAM is authenticating.
356 Replaces the usual ring indicator with a bar indicator. Comes with perks.
387357
388358 .TP
389359 .B \-\-bar\-direction={0, 1, 2}
390 Sets the direction the bars grow in. 0 is the default (downwards, or rightwards, depending on the bar orientation). 1 is the reverse, and 2 is both.
360 Sets the direction the bars grow in. 0 is the default (downwards, or rightwards,
361 depending on the bar orientation). 1 is the reverse, and 2 is both.
391362
392363 .TP
393364 .B \-\-bar\-width=15
365 Deprecated, use \-\-bar\-count instead.
366
394367 Sets the width of the minibars in the bar.
395368
396369 .TP
397370 .B \-\-bar\-orientation={vertical,horizontal}
398 Sets whether the bar is vertically or horizontally oriented. Defaults to horizontal.
371 Sets whether the bar is vertically or horizontally oriented.
372 Defaults to horizontal.
399373
400374 .TP
401375 .B \-\-bar\-step
402 Sets the step that each bar decreases by when a key is pressed. A random bar is set to its max height,
403 and then each neighbor is set to (height - step*distance).
376 Sets the step that each bar decreases by when a key is pressed. A random bar is
377 set to its max height, then each neighbor is set to (height - step*distance).
404378
405379 .TP
406380 .B \-\-bar\-max\-height
407 The maximum height a bar can get to. When a key is pressed, a random bar is set to this value,
408 and then its neighbors are set to its height, minus the step value.
381 The maximum height a bar can get to. When a key is pressed, a random bar is set
382 to this value, then its neighbors are set to its height, minus the step value.
409383
410384 .TP
411385 .B \-\-bar\-base\-width
412386 The thickness of the "base" bar that all the bars originate from.
413 This bar also takes on the ring verif and wrong colors to give authentication feedback.
387 This bar also takes on the ring verification and wrong colors to give
388 authentication feedback.
414389
415390 .TP
416391 .B \-\-bar\-color
421396 The value by which the bars decrease each time the screen is redrawn.
422397
423398 .TP
424 .B \-\-bar\-position
425 Works similarly to the time/date/indicator expressions. If the bar is horizontal, this sets the vertical offset from the top edge.
426 If it's vertically oriented, this sets the horizontal offset from the left edge.
399 .B \-\-bar\-pos
400 Works similarly to the time/date/indicator expressions. If only one number is
401 provided, this sets the vertical offset from the top or left edge. If two
402 numbers are provided in the form of x:y, sets the starting position of the bar.
403
404 .TP
405 .B \-\-bar\-count
406 Sets the number of minibars to draw on each screen.
407
408 .TP
409 .B \-\-bar\-total\-width
410 The total width of the bar. Can be an expression.
411
412 .TP
413 .B \-\-redraw\-thread
414 Starts a separate thread for redrawing the screen. Potentially worse from a
415 security standpoint, but makes the bar indicator still do its usual periodic
416 redraws when PAM is authenticating.
417
418 .TP
419 .B \-\-refresh\-rate=seconds\-as\-double
420 The refresh rate of the indicator, given in seconds. This should automatically
421 align itself, but is somewhat buggy currently.
422 Values less than one will work, but may result in poor system performance.
423
424 .TP
425 .B \-\-composite
426 Some compositors have problems with i3lock trying to render over them, so this
427 argument is disabled by default. However, some will work properly with it, so
428 it's been left enabled.
427429
428430 .TP
429431 .B \-\-no\-verify
430432 Do not verify the password entered by the user and unlock immediately.
431 .B Use only for quickly testing new configurations and remember to remove to actually lock your screen!
432
433 .SH DPMS
434 The \-d (\-\-dpms) option was removed from i3lock in version 2.8. There were
435 plenty of use-cases that were not properly addressed, and plenty of bugs
436 surrounding that feature. While features are not normally removed from i3 and
437 its tools, we felt the need to make an exception in this case.
438 Users who wish to explicitly enable DPMS only when their screen is locked can
439 use a wrapper script around i3lock like the following:
440 .Vb 6
441 \& #!/bin/sh
442 \& revert() {
443 \& xset dpms 0 0 0
444 \& }
445 \& trap revert HUP INT TERM
446 \& xset +dpms dpms 5 5 5
447 \& i3lock -n
448 \& revert
449 .Ve
450 The \-I (\-\-inactivity\-timeout=seconds) was removed because it only makes sense with DPMS.
433 .B Use only for quickly testing new configurations and remember to remove to
434 .B actually lock your screen!
435
436 .TP
437 .B \-\-slideshow\-interval
438 The interval to wait until switching to the next image.
439
440 .TP
441 .B \-\-slideshow\-random\-selection
442 Randomize the order of the images.
451443
452444 .SH SEE ALSO
453445 .IR xautolock(1)
22 *
33 * © 2010 Michael Stapelberg
44 * © 2015 Cassandra Fox
5 * © 2020 Raymond Li
5 * © 2021 Raymond Li
66 *
77 * See LICENSE for licensing information
88 *
6969 typedef void (*ev_callback_t)(EV_P_ ev_timer *w, int revents);
7070 static void input_done(void);
7171
72 char color[9] = "ffffffff";
72 char color[9] = "a3a3a3ff";
7373
7474 /* options for unlock indicator colors */
7575 char insidevercolor[9] = "006effbf";
8989 char separatorcolor[9] = "000000ff";
9090 char greetercolor[9] = "000000ff";
9191
92 char verifoutlinecolor[9] = "00000000";
93 char wrongoutlinecolor[9] = "00000000";
94 char layoutoutlinecolor[9] = "00000000";
95 char timeoutlinecolor[9] = "00000000";
96 char dateoutlinecolor[9] = "00000000";
97 char greeteroutlinecolor[9] = "00000000";
98
9299 /* int defining which display the lock indicator should be shown on. If -1, then show on all displays.*/
93100 int screen_number = 0;
101
94102 /* default is to use the supplied line color, 1 will be ring color, 2 will be to use the inside color for ver/wrong/etc */
95103 int internal_line_source = 0;
96 /* bool for showing the clock; why am I commenting this? */
104
105 /* refresh rate in seconds, default to 1s */
106 float refresh_rate = 1.0;
107
97108 bool show_clock = false;
98109 bool slideshow_enabled = false;
99110 bool always_show_clock = false;
100111 bool show_indicator = false;
101 float refresh_rate = 1.0;
112 bool show_modkey_text = true;
102113
103114 /* there's some issues with compositing - upstream removed support for this, but we'll allow people to supply an arg to enable it */
104115 bool composite = false;
166177 double circle_radius = 90.0;
167178 double ring_width = 7.0;
168179 double greeter_size = 32.0;
180
181 double timeoutlinewidth = 0;
182 double dateoutlinewidth = 0;
183 double verifoutlinewidth = 0;
184 double wrongoutlinewidth = 0;
185 double modifieroutlinewidth = 0;
186 double layoutoutlinewidth = 0;
187 double greeteroutlinewidth = 0;
169188
170189 char* verif_text = "verifying…";
171190 char* wrong_text = "wrong!";
242261 // allow you to disable. handy if you use bar with lots of crap.
243262 bool redraw_thread = false;
244263
264 // experimental bar stuff
245265 #define BAR_VERT 0
246266 #define BAR_FLAT 1
247267 #define BAR_DEFAULT 0
248268 #define BAR_REVERSED 1
249269 #define BAR_BIDIRECTIONAL 2
250 // experimental bar stuff
270 #define MAX_BAR_COUNT 65535
271 #define MIN_BAR_COUNT 1
272
251273 bool bar_enabled = false;
252274 double *bar_heights = NULL;
253275 double bar_step = 15;
254276 double bar_base_height = 25;
255277 double bar_periodic_step = 15;
256278 double max_bar_height = 25;
257 int num_bars = 0;
258 int bar_width = 150;
279 int bar_count = 0;
280 int bar_width = 0;
259281 int bar_orientation = BAR_FLAT;
260282
261283 char bar_base_color[9] = "000000ff";
262 char bar_expr[32] = "0\0";
284 char bar_x_expr[32] = "0";
285 char bar_y_expr[32] = ""; // empty string on y means use x as offset based on orientation
286 char bar_width_expr[32] = ""; // empty string means full width based on bar orientation
263287 bool bar_bidirectional = false;
264288 bool bar_reversed = false;
265289
575599 else if (strcmp(mod_name, XKB_MOD_NAME_LOGO) == 0)
576600 mod_name = "Super";
577601
578 char *tmp;
579 if (modifier_string == NULL) {
580 if (asprintf(&tmp, "%s", mod_name) != -1)
602 if (show_modkey_text) {
603 char *tmp;
604 if (modifier_string == NULL) {
605 if (asprintf(&tmp, "%s", mod_name) != -1)
606 modifier_string = tmp;
607 } else if (asprintf(&tmp, "%s, %s", modifier_string, mod_name) != -1) {
608 free(modifier_string);
581609 modifier_string = tmp;
582 } else if (asprintf(&tmp, "%s, %s", modifier_string, mod_name) != -1) {
583 free(modifier_string);
584 modifier_string = tmp;
610 }
585611 }
586612 }
587613
14091435 {"ignore-empty-password", no_argument, NULL, 'e'},
14101436 {"inactivity-timeout", required_argument, NULL, 'I'},
14111437 {"show-failed-attempts", no_argument, NULL, 'f'},
1438 {"screen", required_argument, NULL, 'S'},
1439 {"blur", required_argument, NULL, 'B'},
14121440
14131441 // options for unlock indicator colors
1414 {"insidevercolor", required_argument, NULL, 300},
1415 {"insidewrongcolor", required_argument, NULL, 301},
1416 {"insidecolor", required_argument, NULL, 302},
1417 {"ringvercolor", required_argument, NULL, 303},
1418 {"ringwrongcolor", required_argument, NULL, 304},
1419 {"ringcolor", required_argument, NULL, 305},
1420 {"linecolor", required_argument, NULL, 306},
1421 {"verifcolor", required_argument, NULL, 307},
1422 {"wrongcolor", required_argument, NULL, 308},
1423 {"layoutcolor", required_argument, NULL, 309},
1424 {"timecolor", required_argument, NULL, 310},
1425 {"datecolor", required_argument, NULL, 311},
1426 {"keyhlcolor", required_argument, NULL, 312},
1427 {"bshlcolor", required_argument, NULL, 313},
1428 {"separatorcolor", required_argument, NULL, 314},
1429 {"greetercolor", required_argument, NULL, 315},
1442 {"insidever-color", required_argument, NULL, 300},
1443 {"insidewrong-color", required_argument, NULL, 301},
1444 {"inside-color", required_argument, NULL, 302},
1445 {"ringver-color", required_argument, NULL, 303},
1446 {"ringwrong-color", required_argument, NULL, 304},
1447 {"ring-color", required_argument, NULL, 305},
1448 {"line-color", required_argument, NULL, 306},
1449 {"verif-color", required_argument, NULL, 307},
1450 {"wrong-color", required_argument, NULL, 308},
1451 {"layout-color", required_argument, NULL, 309},
1452 {"time-color", required_argument, NULL, 310},
1453 {"date-color", required_argument, NULL, 311},
1454 {"keyhl-color", required_argument, NULL, 312},
1455 {"bshl-color", required_argument, NULL, 313},
1456 {"separator-color", required_argument, NULL, 314},
1457 {"greeter-color", required_argument, NULL, 315},
1458
1459 // text outline colors
1460 {"verifoutline-color", required_argument, NULL, 316},
1461 {"wrongoutline-color", required_argument, NULL, 317},
1462 {"layoutoutline-color", required_argument, NULL, 318},
1463 {"timeoutline-color", required_argument, NULL, 319},
1464 {"dateoutline-color", required_argument, NULL, 320},
1465 {"greeteroutline-color", required_argument, NULL, 321},
14301466
14311467 {"line-uses-ring", no_argument, NULL, 'r'},
14321468 {"line-uses-inside", no_argument, NULL, 's'},
14331469
1434 {"screen", required_argument, NULL, 'S'},
1435 {"blur", required_argument, NULL, 'B'},
14361470 {"clock", no_argument, NULL, 'k'},
14371471 {"force-clock", no_argument, NULL, 400},
14381472 {"indicator", no_argument, NULL, 401},
14491483 {"greeter-align", required_argument, NULL, 506},
14501484
14511485 // string stuff
1452 {"timestr", required_argument, NULL, 510},
1453 {"datestr", required_argument, NULL, 511},
1454 {"veriftext", required_argument, NULL, 512},
1455 {"wrongtext", required_argument, NULL, 513},
1486 {"time-str", required_argument, NULL, 510},
1487 {"date-str", required_argument, NULL, 511},
1488 {"verif-text", required_argument, NULL, 512},
1489 {"wrong-text", required_argument, NULL, 513},
14561490 {"keylayout", required_argument, NULL, 514},
1457 {"noinputtext", required_argument, NULL, 515},
1458 {"locktext", required_argument, NULL, 516},
1459 {"lockfailedtext", required_argument, NULL, 517},
1460 {"greetertext", required_argument, NULL, 518},
1491 {"noinput-text", required_argument, NULL, 515},
1492 {"lock-text", required_argument, NULL, 516},
1493 {"lockfailed-text", required_argument, NULL, 517},
1494 {"greeter-text", required_argument, NULL, 518},
1495 {"no-modkey-text", no_argument, NULL, 519},
14611496
14621497 // fonts
14631498 {"time-font", required_argument, NULL, 520},
14681503 {"greeter-font", required_argument, NULL, 525},
14691504
14701505 // text size
1471 {"timesize", required_argument, NULL, 530},
1472 {"datesize", required_argument, NULL, 531},
1473 {"verifsize", required_argument, NULL, 532},
1474 {"wrongsize", required_argument, NULL, 533},
1475 {"layoutsize", required_argument, NULL, 534},
1476 {"modsize", required_argument, NULL, 535},
1477 {"greetersize", required_argument, NULL, 536},
1506 {"time-size", required_argument, NULL, 530},
1507 {"date-size", required_argument, NULL, 531},
1508 {"verif-size", required_argument, NULL, 532},
1509 {"wrong-size", required_argument, NULL, 533},
1510 {"layout-size", required_argument, NULL, 534},
1511 {"modif-size", required_argument, NULL, 535},
1512 {"greeter-size", required_argument, NULL, 536},
14781513
14791514 // text/indicator positioning
1480 {"timepos", required_argument, NULL, 540},
1481 {"datepos", required_argument, NULL, 541},
1482 {"verifpos", required_argument, NULL, 542},
1483 {"wrongpos", required_argument, NULL, 543},
1484 {"layoutpos", required_argument, NULL, 544},
1485 {"statuspos", required_argument, NULL, 545},
1486 {"modifpos", required_argument, NULL, 546},
1487 {"indpos", required_argument, NULL, 547},
1488 {"greeterpos", required_argument, NULL, 548},
1515 {"time-pos", required_argument, NULL, 540},
1516 {"date-pos", required_argument, NULL, 541},
1517 {"verif-pos", required_argument, NULL, 542},
1518 {"wrong-pos", required_argument, NULL, 543},
1519 {"layout-pos", required_argument, NULL, 544},
1520 {"status-pos", required_argument, NULL, 545},
1521 {"modif-pos", required_argument, NULL, 546},
1522 {"ind-pos", required_argument, NULL, 547},
1523 {"greeter-pos", required_argument, NULL, 548},
1524
1525 // text outline width
1526 {"timeoutline-width", required_argument, NULL, 560},
1527 {"dateoutline-width", required_argument, NULL, 561},
1528 {"verifoutline-width", required_argument, NULL, 562},
1529 {"wrongoutline-width", required_argument, NULL, 563},
1530 {"modifieroutline-width", required_argument, NULL, 564},
1531 {"layoutoutline-width", required_argument, NULL, 565},
1532 {"greeteroutline-width", required_argument, NULL, 566},
14891533
14901534 // pass keys
14911535 {"pass-media-keys", no_argument, NULL, 601},
15031547 {"bar-base-width", required_argument, NULL, 706},
15041548 {"bar-color", required_argument, NULL, 707},
15051549 {"bar-periodic-step", required_argument, NULL, 708},
1506 {"bar-position", required_argument, NULL, 709},
1550 {"bar-pos", required_argument, NULL, 709},
1551 {"bar-count", required_argument, NULL, 710},
1552 {"bar-total-width", required_argument, NULL, 711},
15071553
15081554 // misc.
15091555 {"redraw-thread", no_argument, NULL, 900},
15401586 if (strlen(arg) != 8 || sscanf(arg, "%08[0-9a-fA-F]", acolor) != 1)\
15411587 errx(1, #acolor " is invalid, color must be given in 3 or 4-byte format: rrggbb[aa]\n");
15421588
1589 #define parse_outline_width(awidth)\
1590 arg = optarg;\
1591 if (sscanf(arg, "%lf", &awidth) != 1)\
1592 errx(1, #awidth " must be a number\n");\
1593 if (awidth < 0) {\
1594 fprintf(stderr, #awidth " must be a positive double; ignoring...\n");\
1595 awidth = 0;\
1596 }
1597
15431598 while ((o = getopt_long(argc, argv, optstring, longopts, &longoptind)) != -1) {
15441599 switch (o) {
15451600 case 'v':
1546 errx(EXIT_SUCCESS, "version " I3LOCK_VERSION " © 2010 Michael Stapelberg, © 2015 Cassandra Fox, © 2020 Raymond Li");
1601 errx(EXIT_SUCCESS, "version " I3LOCK_VERSION " © 2010 Michael Stapelberg, © 2015 Cassandra Fox, © 2021 Raymond Li");
15471602 case 'n':
15481603 dont_fork = true;
15491604 break;
16661721 case 315:
16671722 parse_color(greetercolor);
16681723 break;
1724 case 316:
1725 parse_color(verifoutlinecolor);
1726 break;
1727 case 317:
1728 parse_color(wrongoutlinecolor);
1729 break;
1730 case 318:
1731 parse_color(layoutoutlinecolor);
1732 break;
1733 case 319:
1734 parse_color(timeoutlinecolor);
1735 break;
1736 case 320:
1737 parse_color(dateoutlinecolor);
1738 break;
1739 case 321:
1740 parse_color(greeteroutlinecolor);
1741 break;
1742
16691743
16701744 // General indicator opts
16711745 case 400:
17681842 case 518:
17691843 greeter_text = optarg;
17701844 break;
1845 case 519:
1846 show_modkey_text = false;
1847 break;
17711848
17721849 // Font stuff
17731850 case 520:
19592036 errx(1, "indpos must be of the form x:y\n");
19602037 }
19612038 break;
2039
2040 // text outline width
2041 case 560:
2042 parse_outline_width(timeoutlinewidth);
2043 break;
2044 case 561:
2045 parse_outline_width(dateoutlinewidth);
2046 break;
2047 case 562:
2048 parse_outline_width(verifoutlinewidth);
2049 break;
2050 case 563:
2051 parse_outline_width(wrongoutlinewidth);
2052 break;
2053 case 564:
2054 parse_outline_width(modifieroutlinewidth);
2055 break;
2056 case 565:
2057 parse_outline_width(layoutoutlinewidth);
2058 break;
2059 case 566:
2060 parse_outline_width(greeteroutlinewidth);
2061 break;
2062
19622063
19632064 // Pass keys
19642065 case 601:
19952096 case 702:
19962097 bar_width = atoi(optarg);
19972098 if (bar_width < 1) bar_width = 150;
1998 // num_bars and bar_heights* initialized later when we grab display info
19992099 break;
20002100 case 703:
20012101 arg = optarg;
20272127 bar_periodic_step = opt;
20282128 break;
20292129 case 709:
2030 //read in to ind_x_expr and ind_y_expr
2031 if (strlen(optarg) > 31) {
2032 // this is overly restrictive since both the x and y string buffers have size 32, but it's easier to check.
2033 errx(1, "indicator position string can be at most 31 characters\n");
2034 }
20352130 arg = optarg;
2036 if (sscanf(arg, "%31s", bar_expr) != 1) {
2037 errx(1, "bar-position must be of the form [pos] with a max length of 31\n");
2131 if (sscanf(arg, "%31[^:]:%31[^:]", bar_x_expr, bar_y_expr) < 1) {
2132 errx(1, "bar-position must be a single number or of the form x:y with a max length of 31\n");
2133 }
2134 break;
2135 case 710:
2136 bar_count = atoi(optarg);
2137 if (bar_count > MAX_BAR_COUNT || bar_count < MIN_BAR_COUNT) {
2138 errx(1, "bar-count must be between %d and %d\n", MIN_BAR_COUNT, MAX_BAR_COUNT);
2139 }
2140 break;
2141 case 711:
2142 arg = optarg;
2143 if (sscanf(arg, "%31s", bar_width_expr) != 1) {
2144 errx(1, "missing argument for bar-total-width\n");
20382145 }
20392146 break;
20402147
21832290 last_resolution[0] = screen->width_in_pixels;
21842291 last_resolution[1] = screen->height_in_pixels;
21852292
2186 if (bar_enabled && bar_width > 0) {
2187 int tmp = screen->width_in_pixels;
2188 if (bar_orientation == BAR_VERT) tmp = screen->height_in_pixels;
2189 num_bars = tmp / bar_width;
2190 if (tmp % bar_width != 0) ++num_bars;
2191
2192 bar_heights = (double*) calloc(num_bars, sizeof(double));
2293 if (bar_enabled) {
2294 if (bar_count == 0) {
2295 if (bar_width != 0) {
2296 fprintf(stderr, "Warning: bar-width is deprecated, use bar-count instead\n");
2297 int tmp = screen->width_in_pixels;
2298 if (bar_orientation == BAR_VERT) tmp = screen->height_in_pixels;
2299 bar_count = tmp / bar_width;
2300 if (tmp % bar_width != 0) {
2301 ++bar_count;
2302 }
2303 } else {
2304 bar_count = 10;
2305 }
2306 } else if (bar_width != 0) {
2307 errx(EXIT_FAILURE, "bar-width and bar-count cannot be used at the same time");
2308 }
2309
2310 if (bar_count >= MIN_BAR_COUNT && bar_count <= MAX_BAR_COUNT) {
2311 bar_heights = (double*) calloc(bar_count, sizeof(double));
2312 } else {
2313 bar_enabled = false;
2314 }
21932315 }
21942316
21952317 xcb_change_window_attributes(conn, screen->root, XCB_CW_EVENT_MASK,
+0
-44
lock.sh less more
0 #!/bin/sh
1
2 B='#00000000' # blank
3 C='#ffffff22' # clear ish
4 D='#ff00ffcc' # default
5 T='#ee00eeee' # text
6 W='#880000bb' # wrong
7 V='#bb00bbbb' # verifying
8
9 ./x86_64-pc-linux-gnu/i3lock \
10 --insidevercolor=$C \
11 --ringvercolor=$V \
12 \
13 --insidewrongcolor=$C \
14 --ringwrongcolor=$W \
15 \
16 --insidecolor=$B \
17 --ringcolor=$D \
18 --linecolor=$B \
19 --separatorcolor=$D \
20 \
21 --verifcolor=$T \
22 --wrongcolor=$T \
23 --timecolor=$T \
24 --datecolor=$T \
25 --layoutcolor=$T \
26 --keyhlcolor=$W \
27 --bshlcolor=$W \
28 \
29 --screen 1 \
30 --blur 5 \
31 --clock \
32 --indicator \
33 --timestr="%H:%M:%S" \
34 --datestr="%A, %m %Y" \
35 --keylayout 1 \
36
37 # --veriftext="Drinking verification can..."
38 # --wrongtext="Nope!"
39 # --textsize=20
40 # --modsize=10
41 # --timefont=comic-sans
42 # --datefont=monofur
43 # etc
+0
-41
lock_bar.sh less more
0 #!/bin/sh
1
2 B='#00000000' # blank
3 C='#ffffff22' # clear ish
4 D='#ff00ffcc' # default
5 T='#ee00eeee' # text
6 W='#880000bb' # wrong
7 V='#bb00bbbb' # verifying
8
9 ./x86_64-pc-linux-gnu/i3lock \
10 --blur 5 \
11 --bar-indicator \
12 --bar-position h \
13 --bar-direction 1 \
14 --bar-max-height 50 \
15 --bar-base-width 50 \
16 --bar-color 000000cc \
17 --keyhlcolor 880088cc \
18 --bar-periodic-step 50 \
19 --bar-step 50 \
20 --bar-width 250 \
21 --redraw-thread \
22 \
23 --clock \
24 --force-clock \
25 --timepos 5:h-80 \
26 --timecolor 880088ff \
27 --datepos tx:ty+15 \
28 --datecolor 990099ff \
29 --date-align 1 \
30 --time-align 1 \
31 --ringvercolor 8800ff88 \
32 --ringwrongcolor ff008888 \
33 --statuspos 5:h-16 \
34 --verif-align 1 \
35 --wrong-align 1 \
36 --verifcolor ffffffff \
37 --wrongcolor ffffffff \
38 --modifpos -50:-50 \
39 \
40 --screen 1
6262 # LICENSE
6363 #
6464 # Copyright (c) 2016 Michael Stapelberg <[email protected]>
65 # Copyright (c) 2020 Raymond Li <[email protected]>
65 # Copyright (c) 2021 Raymond Li <[email protected]>
6666 #
6767 # Copying and distribution of this file, with or without modification, are
6868 # permitted in any medium without royalty provided the copyright notice
6868 # LICENSE
6969 #
7070 # Copyright (c) 2016 Michael Stapelberg <[email protected]>
71 # Copyright (c) 2020 Raymond Li <[email protected]>
71 # Copyright (c) 2021 Raymond Li <[email protected]>
7272 #
7373 # Copying and distribution of this file, with or without modification,
7474 # are permitted in any medium without royalty provided the copyright
00 #
11 # PAM configuration file for the i3lock-color screen locker. By default, it includes
2 # the 'system-auth' configuration file (see /etc/pam.d/system-auth) for Arch and Gentoo
3 # and 'login' for Debian. Note that vanilla i3lock upstream uses 'login' instead.
2 # the 'system-local-login' configuration file (see /etc/pam.d/system-local-login)
3 # for Arch and Gentoo and 'login' for Debian. Note that upstream uses only 'login',
4 # which doesn't work on Arch and Gentoo.
45 #
56
6 #auth include system-auth # For Arch/Gentoo
7 #auth include system-local-login # For Arch/Gentoo
78 auth include login # For Debian
11 * vim:ts=4:sw=4:expandtab
22 *
33 * © 2010 Michael Stapelberg
4 * © 2020 Raymond Li
4 * © 2021 Raymond Li
55 *
66 * See LICENSE for licensing information
77 *
screenshot.png less more
Binary diff not shown
(No changes)
22 *
33 * © 2010 Michael Stapelberg
44 * © 2015 Cassandra Fox
5 * © 2020 Raymond Li
5 * © 2021 Raymond Li
66 *
77 * See LICENSE for licensing information
88 *
9292 extern char separatorcolor[9];
9393 extern char greetercolor[9];
9494 extern int internal_line_source;
95
96 extern char verifoutlinecolor[9];
97 extern char wrongoutlinecolor[9];
98 extern char layoutoutlinecolor[9];
99 extern char timeoutlinecolor[9];
100 extern char dateoutlinecolor[9];
101 extern char greeteroutlinecolor[9];
95102
96103 extern int screen_number;
97104 extern float refresh_rate;
136143 extern double layout_size;
137144 extern double greeter_size;
138145
146 extern double timeoutlinewidth;
147 extern double dateoutlinewidth;
148 extern double verifoutlinewidth;
149 extern double wrongoutlinewidth;
150 extern double modifieroutlinewidth;
151 extern double layoutoutlinewidth;
152 extern double greeteroutlinewidth;
153
139154 extern char *verif_text;
140155 extern char *wrong_text;
141156 extern char *noinput_text;
193208 rgba_t greeter16;
194209 rgba_t background;
195210
211 rgba_t verifoutline16;
212 rgba_t wrongoutline16;
213 rgba_t layoutoutline16;
214 rgba_t timeoutline16;
215 rgba_t dateoutline16;
216 rgba_t greeteroutline16;
217
196218 // experimental bar stuff
197219
198220 #define BAR_VERT 0
205227 extern double bar_periodic_step;
206228 extern double max_bar_height;
207229 extern double bar_position;
208 extern int num_bars;
209 extern int bar_width;
230 extern int bar_count;
210231 extern int bar_orientation;
211232
212233 extern char bar_base_color[9];
213 extern char bar_expr[32];
234 extern char bar_x_expr[32];
235 extern char bar_y_expr[32];
236 extern char bar_width_expr[32];
214237 extern bool bar_bidirectional;
215238 extern bool bar_reversed;
216239
310333
311334 cairo_set_source_rgba(ctx, text.color.red, text.color.green, text.color.blue, text.color.alpha);
312335 cairo_move_to(ctx, x, text.y);
313 cairo_show_text(ctx, text.str);
314
336
337 cairo_text_path(ctx, text.str);
338 cairo_fill_preserve(ctx);
339
340 cairo_set_source_rgba(ctx, text.outline_color.red, text.outline_color.green, text.outline_color.blue, text.outline_color.alpha);
341 cairo_set_line_width(ctx, text.outline_width);
315342 cairo_stroke(ctx);
316343 }
317344
318 static void draw_bar(cairo_t *ctx, double x, double y, double bar_offset) {
319 // oh boy, here we go!
320 // TODO: get this to play nicely with multiple monitors
321 // ideally it'd intelligently span both monitors
322 double width, height;
323 double back_x = 0, back_y = 0, back_x2 = 0, back_y2 = 0, back_width = 0, back_height = 0;
324 for (int i = 0; i < num_bars; ++i) {
325 double cur_bar_height = bar_heights[i];
326
327 if (cur_bar_height > 0) {
328 if (unlock_state == STATE_BACKSPACE_ACTIVE) {
329 cairo_set_source_rgba(ctx, bshl16.red, bshl16.green, bshl16.blue, bshl16.alpha);
330 } else {
331 cairo_set_source_rgba(ctx, keyhl16.red, keyhl16.green, keyhl16.blue, keyhl16.alpha);
332 }
333 } else {
334 switch (auth_state) {
335 case STATE_AUTH_VERIFY:
336 case STATE_AUTH_LOCK:
337 cairo_set_source_rgba(ctx, ringver16.red, ringver16.green, ringver16.blue, ringver16.alpha);
338 break;
339 case STATE_AUTH_WRONG:
340 case STATE_I3LOCK_LOCK_FAILED:
341 cairo_set_source_rgba(ctx, ringwrong16.red, ringwrong16.green, ringwrong16.blue, ringwrong16.alpha);
342 break;
343 default:
344 cairo_set_source_rgba(ctx, bar16.red, bar16.green, bar16.blue, bar16.alpha);
345 break;
346 }
347 }
348
349 if (bar_orientation == BAR_VERT) {
350 width = (cur_bar_height <= 0 ? bar_base_height : cur_bar_height);
351 height = bar_width;
352 x = bar_offset;
353 y = i * bar_width;
354 if (bar_reversed) {
355 x -= width;
356 } else if (bar_bidirectional) {
357 width = (cur_bar_height <= 0 ? bar_base_height : cur_bar_height * 2);
358 x = bar_offset - (width / 2) + (bar_base_height / 2);
359 }
360 } else {
361 width = bar_width;
362 height = (cur_bar_height <= 0 ? bar_base_height : cur_bar_height);
363 x = i * bar_width;
364 y = bar_offset;
365 if (bar_reversed) {
366 y -= height;
367 } else if (bar_bidirectional) {
368 height = (cur_bar_height <= 0 ? bar_base_height : cur_bar_height * 2);
369 y = bar_offset - (height / 2) + (bar_base_height / 2);
370 }
371 }
372
373 if (cur_bar_height < bar_base_height && cur_bar_height > 0) {
374 if (bar_orientation == BAR_VERT) {
375 back_x = bar_offset + cur_bar_height;
376 back_y = y;
377 back_width = bar_base_height - cur_bar_height;
378 back_height = height;
379 if (bar_reversed) {
380 back_x = bar_offset - bar_base_height;
381 } else if (bar_bidirectional) {
382 back_x = bar_offset;
383 back_y2 = y;
384 back_width = (bar_base_height - (cur_bar_height * 2)) / 2;
385 back_x2 = bar_offset + (cur_bar_height * 2) + back_width;
386 }
387 } else {
388 back_x = x;
389 back_y = bar_offset + cur_bar_height;
390 back_width = width;
391 back_height = bar_base_height - cur_bar_height;
392 if (bar_reversed) {
393 back_y = bar_offset - bar_base_height;
394 } else if (bar_bidirectional) {
395 back_x2 = x;
396 back_y = bar_offset;
397 back_height = (bar_base_height - (cur_bar_height * 2)) / 2;
398 back_y2 = bar_offset + (cur_bar_height * 2) + back_height;
399 }
400 }
401 }
402 cairo_rectangle(ctx, x, y, width, height);
403 cairo_fill(ctx);
404 switch (auth_state) {
405 case STATE_AUTH_VERIFY:
406 case STATE_AUTH_LOCK:
407 cairo_set_source_rgba(ctx, ringver16.red, ringver16.green, ringver16.blue, ringver16.alpha);
408 break;
409 case STATE_AUTH_WRONG:
410 case STATE_I3LOCK_LOCK_FAILED:
411 cairo_set_source_rgba(ctx, ringwrong16.red, ringwrong16.green, ringwrong16.blue, ringwrong16.alpha);
412 break;
413 default:
414 cairo_set_source_rgba(ctx, bar16.red, bar16.green, bar16.blue, bar16.alpha);
415 break;
416 }
417
418 if (cur_bar_height > 0 && cur_bar_height < bar_base_height && ((bar_bidirectional && ((cur_bar_height * 2) < bar_base_height)) || (!bar_bidirectional && (cur_bar_height < bar_base_height)))) {
419 cairo_rectangle(ctx, back_x, back_y, back_width, back_height);
420 cairo_fill(ctx);
421 if (bar_bidirectional) {
422 cairo_rectangle(ctx, back_x2, back_y2, back_width, back_height);
423 cairo_fill(ctx);
424 }
425 }
426 }
427 for (int i = 0; i < num_bars; ++i) {
428 if (bar_heights[i] > 0)
345 static void draw_single_bar(cairo_t *ctx, double pos, double offset, double width, double height) {
346 if (bar_reversed) {
347 offset -= height;
348 } else if (bar_bidirectional) {
349 offset -= height / 2;
350 }
351
352 if (bar_orientation == BAR_VERT)
353 cairo_rectangle(ctx, offset, pos, height, width);
354 else
355 cairo_rectangle(ctx, pos, offset, width, height);
356 cairo_fill(ctx);
357 }
358
359 static void draw_bar(cairo_t *ctx, double bar_x, double bar_y, double bar_width, double screen_x, double screen_y) {
360
361 cairo_save(ctx);
362
363 switch (auth_state) {
364 case STATE_AUTH_VERIFY:
365 case STATE_AUTH_LOCK:
366 cairo_set_source_rgba(ctx, ringver16.red, ringver16.green, ringver16.blue, ringver16.alpha);
367 break;
368 case STATE_AUTH_WRONG:
369 case STATE_I3LOCK_LOCK_FAILED:
370 cairo_set_source_rgba(ctx, ringwrong16.red, ringwrong16.green, ringwrong16.blue, ringwrong16.alpha);
371 break;
372 default:
373 cairo_set_source_rgba(ctx, bar16.red, bar16.green, bar16.blue, bar16.alpha);
374 break;
375 }
376
377 if (bar_orientation == BAR_VERT)
378 draw_single_bar(ctx, bar_y, bar_x, bar_width, bar_base_height);
379 else
380 draw_single_bar(ctx, bar_x, bar_y, bar_width, bar_base_height);
381
382 if (unlock_state == STATE_BACKSPACE_ACTIVE)
383 cairo_set_source_rgba(ctx, bshl16.red, bshl16.green, bshl16.blue, bshl16.alpha);
384 else
385 cairo_set_source_rgba(ctx, keyhl16.red, keyhl16.green, keyhl16.blue, keyhl16.alpha);
386
387 cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
388
389 double base_width = bar_width / bar_count;
390 double bar_pos, bar_offset;
391 if (bar_orientation == BAR_VERT) {
392 bar_pos = bar_y;
393 bar_offset = bar_x;
394 } else {
395 bar_pos = bar_x;
396 bar_offset = bar_y;
397 }
398
399 for (int i = 0; i < bar_count; ++i) {
400 double bar_height = bar_heights[i];
401 if (bar_bidirectional) bar_height *= 2;
402 if (bar_height > 0) {
403 draw_single_bar(ctx, bar_pos + i * base_width, bar_offset, base_width, bar_height);
404 }
405 }
406
407 for (int i = 0; i < bar_count; ++i) {
408 if (bar_heights[i] > 0) {
429409 bar_heights[i] -= bar_periodic_step;
430 }
410 }
411 }
412
413 cairo_restore(ctx);
431414 }
432415
433416 static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) {
602585 colorgen(&tmp, bar_base_color, &bar16);
603586 colorgen(&tmp, greetercolor, &greeter16);
604587 colorgen(&tmp, color, &background);
588
589 colorgen(&tmp, verifoutlinecolor, &verifoutline16);
590 colorgen(&tmp, wrongoutlinecolor, &wrongoutline16);
591 colorgen(&tmp, layoutoutlinecolor, &layoutoutline16);
592 colorgen(&tmp, timeoutlinecolor, &timeoutline16);
593 colorgen(&tmp, dateoutlinecolor, &dateoutline16);
594 colorgen(&tmp, greeteroutlinecolor, &greeteroutline16);
605595 }
606596
607597 static te_expr *compile_expression(const char *const from, const char *expression, const te_variable *variables, int var_count) {
629619 if (unlock_state == STATE_KEY_ACTIVE ||
630620 unlock_state == STATE_BACKSPACE_ACTIVE) {
631621 // note: might be biased to cause more hits on lower indices
632 // maybe see about doing ((double) rand() / RAND_MAX) * num_bars
633 int index = rand() % num_bars;
622 // maybe see about doing ((double) rand() / RAND_MAX) * bar_count
623 int index = rand() % bar_count;
634624 bar_heights[index] = max_bar_height;
635625 for (int i = 0; i < ((max_bar_height / bar_step) + 1); ++i) {
636626 int low_ind = index - i;
637627 while (low_ind < 0) {
638 low_ind += num_bars;
628 low_ind += bar_count;
639629 }
640 int high_ind = (index + i) % num_bars;
630 int high_ind = (index + i) % bar_count;
641631 int tmp_height = max_bar_height - (bar_step * i);
642632 if (tmp_height < 0)
643633 tmp_height = 0;
649639 break;
650640 }
651641 }
652 draw_bar(ctx, draw_data->bar_x, draw_data->bar_y, draw_data->bar_offset);
642 draw_bar(ctx, draw_data->bar_x, draw_data->bar_y, draw_data->bar_width, draw_data->screen_x, draw_data->screen_y);
653643 }
654644
655645 draw_text(ctx, draw_data->status_text);
732722 strncpy(draw_data.status_text.str, verif_text, sizeof(draw_data.status_text.str) - 1);
733723 draw_data.status_text.font = get_font_face(VERIF_FONT);
734724 draw_data.status_text.color = verif16;
725 draw_data.status_text.outline_color = verifoutline16;
735726 draw_data.status_text.size = verif_size;
727 draw_data.status_text.outline_width = verifoutlinewidth;
736728 draw_data.status_text.align = verif_align;
737729 break;
738730 case STATE_AUTH_LOCK:
740732 strncpy(draw_data.status_text.str, lock_text, sizeof(draw_data.status_text.str) - 1);
741733 draw_data.status_text.font = get_font_face(VERIF_FONT);
742734 draw_data.status_text.color = verif16;
735 draw_data.status_text.outline_color = verifoutline16;
743736 draw_data.status_text.size = verif_size;
737 draw_data.status_text.outline_width = verifoutlinewidth;
744738 draw_data.status_text.align = verif_align;
745739 break;
746740 case STATE_AUTH_WRONG:
748742 strncpy(draw_data.status_text.str, wrong_text, sizeof(draw_data.status_text.str) - 1);
749743 draw_data.status_text.font = get_font_face(WRONG_FONT);
750744 draw_data.status_text.color = wrong16;
745 draw_data.status_text.outline_color = wrongoutline16;
751746 draw_data.status_text.size = wrong_size;
747 draw_data.status_text.outline_width = wrongoutlinewidth;
752748 draw_data.status_text.align = wrong_align;
753749 break;
754750 case STATE_I3LOCK_LOCK_FAILED:
756752 strncpy(draw_data.status_text.str, lock_failed_text, sizeof(draw_data.status_text.str) - 1);
757753 draw_data.status_text.font = get_font_face(WRONG_FONT);
758754 draw_data.status_text.color = wrong16;
755 draw_data.status_text.outline_color = wrongoutline16;
759756 draw_data.status_text.size = wrong_size;
757 draw_data.status_text.outline_width = wrongoutlinewidth;
760758 draw_data.status_text.align = wrong_align;
761759 break;
762760 default:
765763 strncpy(draw_data.status_text.str, noinput_text, sizeof(draw_data.status_text.str) - 1);
766764 draw_data.status_text.font = get_font_face(WRONG_FONT);
767765 draw_data.status_text.color = wrong16;
766 draw_data.status_text.outline_color = wrongoutline16;
768767 draw_data.status_text.size = wrong_size;
768 draw_data.status_text.outline_width = wrongoutlinewidth;
769769 draw_data.status_text.align = wrong_align;
770770 break;
771771 }
773773 draw_data.status_text.show = true;
774774 draw_data.status_text.font = get_font_face(WRONG_FONT);
775775 draw_data.status_text.color = wrong16;
776 draw_data.status_text.outline_color = wrongoutline16;
776777 draw_data.status_text.size = wrong_size;
778 draw_data.status_text.outline_width = wrongoutlinewidth;
777779 draw_data.status_text.align = wrong_align;
778780 // TODO: variable for this
779781 draw_data.status_text.size = 32.0;
791793 draw_data.mod_text.show = true;
792794 strncpy(draw_data.mod_text.str, modifier_string, sizeof(draw_data.mod_text.str) - 1);
793795 draw_data.mod_text.size = modifier_size;
796 draw_data.mod_text.outline_width = modifieroutlinewidth;
794797 draw_data.mod_text.font = get_font_face(WRONG_FONT);
795798 draw_data.mod_text.align = modif_align;
796799 draw_data.mod_text.color = wrong16;
800 draw_data.mod_text.outline_color = wrongoutline16;
797801 }
798802
799803 if (layout_text) {
800804 draw_data.keylayout_text.show = true;
801805 strncpy(draw_data.keylayout_text.str, layout_text, sizeof(draw_data.keylayout_text.str) - 1);
802806 draw_data.keylayout_text.size = layout_size;
807 draw_data.keylayout_text.outline_width = layoutoutlinewidth;
803808 draw_data.keylayout_text.font = get_font_face(LAYOUT_FONT);
804809 draw_data.keylayout_text.color = layout16;
810 draw_data.keylayout_text.outline_color = layoutoutline16;
805811 draw_data.keylayout_text.align = layout_align;
806812 }
807813
809815 draw_data.greeter_text.show = true;
810816 strncpy(draw_data.greeter_text.str, greeter_text, sizeof(draw_data.greeter_text.str) - 1);
811817 draw_data.greeter_text.size = greeter_size;
818 draw_data.greeter_text.outline_width = greeteroutlinewidth;
812819 draw_data.greeter_text.font = get_font_face(GREETER_FONT);
813820 draw_data.greeter_text.color = greeter16;
821 draw_data.greeter_text.outline_color = greeteroutline16;
814822 draw_data.greeter_text.align = greeter_align;
815823 }
816824
824832 if (*draw_data.time_text.str) {
825833 draw_data.time_text.show = true;
826834 draw_data.time_text.size = time_size;
835 draw_data.time_text.outline_width = timeoutlinewidth;
827836 draw_data.time_text.color = time16;
837 draw_data.time_text.outline_color = timeoutline16;
828838 draw_data.time_text.font = get_font_face(TIME_FONT);
829839 draw_data.time_text.align = time_align;
830840 }
832842 if (*draw_data.date_text.str) {
833843 draw_data.date_text.show = true;
834844 draw_data.date_text.size = date_size;
845 draw_data.date_text.outline_width = dateoutlinewidth;
835846 draw_data.date_text.color = date16;
847 draw_data.date_text.outline_color = dateoutline16;
836848 draw_data.date_text.font = get_font_face(DATE_FONT);
837849 draw_data.date_text.align = date_align;
838850 }
840852 if (*draw_data.greeter_text.str) {
841853 draw_data.greeter_text.show = true;
842854 draw_data.greeter_text.size = greeter_size;
855 draw_data.greeter_text.outline_width = greeteroutlinewidth;
843856 draw_data.greeter_text.color = greeter16;
857 draw_data.greeter_text.outline_color = greeteroutline16;
844858 draw_data.greeter_text.font = get_font_face(GREETER_FONT);
845859 draw_data.greeter_text.align = greeter_align;
846860 }
867881 {"ty", &draw_data.time_text.y},
868882 {"dx", &draw_data.date_text.x},
869883 {"dy", &draw_data.date_text.y},
884 {"bw", &draw_data.bar_width},
885 {"bx", &draw_data.bar_x},
886 {"by", &draw_data.bar_y},
870887 {"r", &radius}};
871888
872889 te_expr *te_ind_x_expr = compile_expression("--indpos", ind_x_expr, vars, vars_size);
885902 te_expr *te_wrong_y_expr = compile_expression("--wrongpos", wrong_y_expr, vars, vars_size);
886903 te_expr *te_modif_x_expr = compile_expression("--modifpos", modif_x_expr, vars, vars_size);
887904 te_expr *te_modif_y_expr = compile_expression("--modifpos", modif_y_expr, vars, vars_size);
888 te_expr *te_bar_expr = compile_expression("--bar-position", bar_expr, vars, vars_size);
905 te_expr *te_bar_x_expr = compile_expression("--bar-position", bar_x_expr, vars, vars_size);
906 te_expr *te_bar_y_expr = strlen(bar_y_expr) ? compile_expression("--bar-position", bar_y_expr, vars, vars_size) : NULL;
907 te_expr *te_bar_width_expr = strlen(bar_width_expr) ? compile_expression("--bar-width", bar_width_expr, vars, vars_size) : NULL;
889908
890909 te_expr *te_greeter_x_expr = compile_expression("--greeterpos", greeter_x_expr, vars, vars_size);
891910 te_expr *te_greeter_y_expr = compile_expression("--greeterpos", greeter_y_expr, vars, vars_size);
913932 height = xr_resolutions[current_screen].height / scaling_factor;
914933 screen_x = xr_resolutions[current_screen].x / scaling_factor;
915934 screen_y = xr_resolutions[current_screen].y / scaling_factor;
916 if (te_ind_x_expr && te_ind_y_expr) {
917 draw_data.indicator_x = te_eval(te_ind_x_expr);
918 draw_data.indicator_y = te_eval(te_ind_y_expr);
919 } else {
920 draw_data.indicator_x = screen_x + width / 2;
921 draw_data.indicator_y = screen_y + height / 2;
922 }
923 draw_data.bar_x = draw_data.indicator_x - (button_diameter_physical / 2);
924 draw_data.bar_y = draw_data.indicator_y - (button_diameter_physical / 2);
925 draw_data.bar_offset = te_eval(te_bar_expr);
935 draw_data.screen_x = screen_x;
936 draw_data.screen_y = screen_y;
937 draw_data.indicator_x = te_eval(te_ind_x_expr);
938 draw_data.indicator_y = te_eval(te_ind_y_expr);
926939 draw_data.time_text.x = te_eval(te_time_x_expr);
927940 draw_data.time_text.y = te_eval(te_time_y_expr);
928941 draw_data.date_text.x = te_eval(te_date_x_expr);
952965 draw_data.mod_text.x = te_eval(te_modif_x_expr);
953966 draw_data.mod_text.y = te_eval(te_modif_y_expr);
954967
968 if (te_bar_y_expr) {
969 draw_data.bar_x = te_eval(te_bar_x_expr);
970 draw_data.bar_y = te_eval(te_bar_y_expr);
971 } else {
972 double bar_offset = te_eval(te_bar_x_expr);
973 if (bar_orientation == BAR_VERT) {
974 draw_data.bar_x = bar_offset;
975 draw_data.bar_y = screen_y;
976 } else {
977 draw_data.bar_x = screen_x;
978 draw_data.bar_y = bar_offset;
979 }
980 }
981 if (te_bar_width_expr)
982 draw_data.bar_width = te_eval(te_bar_width_expr);
983 else if (bar_orientation == BAR_VERT)
984 draw_data.bar_width = height;
985 else
986 draw_data.bar_width = width;
987
988
955989 DEBUG("Indicator at %fx%f on screen %d\n", draw_data.indicator_x, draw_data.indicator_y, current_screen + 1);
956 DEBUG("Bar at %fx%f on screen %d\n", draw_data.bar_x, draw_data.bar_y, current_screen + 1);
990 DEBUG("Bar at %fx%f with width %f on screen %d\n", draw_data.bar_x, draw_data.bar_y, draw_data.bar_width, current_screen + 1);
957991 DEBUG("Time at %fx%f on screen %d\n", draw_data.time_text.x, draw_data.time_text.y, current_screen + 1);
958992 DEBUG("Date at %fx%f on screen %d\n", draw_data.date_text.x, draw_data.date_text.y, current_screen + 1);
959993 DEBUG("Layout at %fx%f on screen %d\n", draw_data.keylayout_text.x, draw_data.keylayout_text.y, current_screen + 1);
9681002 * hope for the best. */
9691003 width = last_resolution[0] / scaling_factor;
9701004 height = last_resolution[1] / scaling_factor;
1005 draw_data.screen_x = 0;
1006 draw_data.screen_y = 0;
9711007 draw_data.indicator_x = width / 2;
9721008 draw_data.indicator_y = height / 2;
973 draw_data.bar_x = draw_data.indicator_x - (button_diameter_physical / 2);
974 draw_data.bar_y = draw_data.indicator_y - (button_diameter_physical / 2);
9751009
9761010 draw_data.time_text.x = te_eval(te_time_x_expr);
9771011 draw_data.time_text.y = te_eval(te_time_y_expr);
10001034 draw_data.mod_text.x = te_eval(te_modif_x_expr);
10011035 draw_data.mod_text.y = te_eval(te_modif_y_expr);
10021036
1037 if (te_bar_y_expr) {
1038 draw_data.bar_x = te_eval(te_bar_x_expr);
1039 draw_data.bar_y = te_eval(te_bar_y_expr);
1040 } else {
1041 double bar_offset = te_eval(te_bar_x_expr);
1042 if (bar_orientation == BAR_VERT) {
1043 draw_data.bar_x = bar_offset;
1044 draw_data.bar_y = screen_y;
1045 } else {
1046 draw_data.bar_x = screen_x;
1047 draw_data.bar_y = bar_offset;
1048 }
1049 }
1050 if (te_bar_width_expr)
1051 draw_data.bar_width = te_eval(te_bar_width_expr);
1052 else if (bar_orientation == BAR_VERT)
1053 draw_data.bar_width = height;
1054 else
1055 draw_data.bar_width = width;
1056
10031057 DEBUG("Indicator at %fx%f\n", draw_data.indicator_x, draw_data.indicator_y);
1004 DEBUG("Bar at %fx%f\n", draw_data.bar_x, draw_data.bar_y);
1058 DEBUG("Bar at %fx%f with width %f\n", draw_data.bar_x, draw_data.bar_y, draw_data.bar_width);
10051059 DEBUG("Time at %fx%f\n", draw_data.time_text.x, draw_data.time_text.y);
10061060 DEBUG("Date at %fx%f\n", draw_data.date_text.x, draw_data.date_text.y);
10071061 DEBUG("Layout at %fx%f\n", draw_data.keylayout_text.x, draw_data.keylayout_text.y);
10271081 te_free(te_wrong_y_expr);
10281082 te_free(te_modif_x_expr);
10291083 te_free(te_modif_y_expr);
1030 te_free(te_bar_expr);
1084 te_free(te_bar_x_expr);
1085 te_free(te_bar_y_expr);
1086 te_free(te_bar_width_expr);
10311087 te_free(te_greeter_x_expr);
10321088 te_free(te_greeter_y_expr);
10331089
3333
3434 double indicator_x, indicator_y;
3535
36 double bar_x, bar_y;
37 double bar_offset;
36 double screen_x, screen_y;
37 double bar_x, bar_y, bar_width;
3838 } DrawData;
3939
4040 void render_lock(uint32_t* resolution, xcb_drawable_t drawable);
00 /*
11 * vim:ts=4:sw=4:expandtab
22 *
3 * © 2010 Michael
4 * @ © 2020 Raymond Li
3 * © 2010 Michael Stapelberg
4 * © 2021 Raymond Li
55 *
66 * xcb.c: contains all functions which use XCB to talk to X11. Mostly wrappers
77 * around the rather complicated/ugly parts of the XCB API.