No description
Find a file
Johannes Marbach 00b5d83599 Avoid TTY cursor blinking
Fixes: #26
2022-01-27 20:03:10 +01:00
lv_drivers@97e500b200 Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
lvgl@bd19083aed Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
screenshots Generate screenshots for all themes 2022-01-24 20:45:40 +01:00
squeek2lvgl@db4222c091 Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
.gitignore Generate screenshots for all themes 2022-01-24 20:45:40 +01:00
.gitmodules Replace unsqu33kr with squeek2lvgl 2021-09-19 13:35:53 +02:00
command_line.c Handle CRYPTTAB_TRIED and CRYPTTAB_SOURCE 2021-10-08 21:24:24 +02:00
command_line.h Load configurable settings from configuration file 2021-09-25 21:02:00 +02:00
config.c Allow user theme selection via config file 2021-11-14 13:30:23 +01:00
config.h Allow user theme selection via config file 2021-11-14 13:30:23 +01:00
COPYING Initial import 2021-09-02 20:08:45 +02:00
cursor.c Move cursor image to its own file 2021-09-18 20:47:41 +02:00
cursor.h Move cursor image to its own file 2021-09-18 20:47:41 +02:00
find-lvgl-sources.sh Make script run in (a)sh 2021-11-15 21:03:28 +01:00
font_32.c Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
FontAwesome5-Solid+Brands+Regular.woff Add fonts and command for converting them 2021-09-08 12:22:10 +02:00
indev.c Use correct array element type in memset 2021-11-20 21:25:55 +01:00
indev.h Eliminate libinput_multi* 2021-09-24 09:07:37 +02:00
log.c Create theming infrastructure and set up default light and dark theme 2021-10-05 20:53:37 +02:00
log.h themes: add pmOS themes 2022-01-10 08:02:28 +01:00
lv_conf.h Create theming infrastructure and set up default light and dark theme 2021-10-05 20:53:37 +02:00
lv_drv_conf.h Add copyright headers 2021-09-21 14:01:53 +02:00
main.c Avoid TTY cursor blinking 2022-01-27 20:03:10 +01:00
meson.build Avoid TTY cursor blinking 2022-01-27 20:03:10 +01:00
OpenSans-Regular.ttf Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
README.md Reference screenshots 2022-01-24 20:48:49 +01:00
regenerate-layouts.sh Customise Shift key 2021-09-20 13:05:12 +02:00
regenerate-screenshots.sh Generate screenshots for all themes 2022-01-24 20:45:40 +01:00
sq2lv_layouts.c Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00
sq2lv_layouts.h Update squeek2lvgl 2021-09-25 12:56:03 +02:00
terminal.c Avoid TTY cursor blinking 2022-01-27 20:03:10 +01:00
terminal.h Avoid TTY cursor blinking 2022-01-27 20:03:10 +01:00
theme.c Allow user theme selection via config file 2021-11-14 13:30:23 +01:00
theme.h Allow user theme selection via config file 2021-11-14 13:30:23 +01:00
themes.c themes: add pmOS themes 2022-01-10 08:02:28 +01:00
themes.h themes: add pmOS themes 2022-01-10 08:02:28 +01:00
unl0kr.conf Change default layout to en-US 2021-11-16 19:26:48 +01:00
unl0kr.h Update submodules, regenerate layouts, switch to OpenSans 2021-10-18 20:18:39 +02:00

Unl0kr

Framebuffer-based disk unlocker for the initramfs based on LVGL.

[[TOC]]

About

Unl0kr is an osk-sdl clone written in LVGL and rendering directly to the Linux framebuffer. As a result, it doesn't depend on GPU hardware acceleration.

For some background on how unl0kr came to be, see postmarketOS/osk-sdl#121.

Status

We are en route to v1 which aims at providing a useable, visually pleasant application including osk-sdl's most essential features. For details about the current status, see the v1 milestone. You may also browse the full list of open issues to get an idea of what's planned beyond v1.

Here are a few highlights of what already works:

  • Password-entry UI including on-screen keyboard on the framebuffer
  • Input device discovery for keyboards, mice, trackpads and touch screens
  • On-screen keyboard control via:
    • One or more mice / trackpads (including cursor)
    • One or more hardware keyboards (including support for different layouts using XKB)
    • Touchscreen (tested on PinePhone)
  • Switching on-screen keyboard layout at runtime (currently supported layouts: de, es, fr, us)
  • Toggling on-screen keyboard with slide in/out animation
  • Switching between light and dark theme at runtime
  • Disclosing and hiding entered password at runtime
  • Shutting down the device via a soft button

For a growing collection of demo videos, see the wiki. Screenshots of the currently available themes may be found in the screenshots folder.

Upstreaming

Over the course of implementing unl0kr, suitable fixes and features have been upstreamed to the lvgl and lv_drivers repositories. The benefit of this goes both ways. Downstream we can rely on the features being maintained in the future and upstream they can make the features available to the larger audience of LVGL users.

Below is a summary of contributions upstreamed thus far.

lvgl

lv_drivers

Usage

A man page is planned to be added with #6. For the time being, you can get an overview of available command line options by running unl0kr with the -h or --help argument.

$ unl0kr --help
Usage: unl0kr [OPTION]

Mandatory arguments to long options are mandatory for short options too.
  -c, --config=PATH      Locaton of the main config file. Defaults to
                         /etc/unl0kr.conf.
  -C, --config-override  Location of the config override file. Values in
                         this file override values for the same keys in the
                         main config file. If specified multiple times, the
                         values from consecutive files will be merged in
                         order.
  -g, --geometry=NxM     Force a display size of N horizontal times M
                         vertical pixels
  -h, --help             Print this message and exit
  -v, --verbose          Enable more detailed logging output on STDERR
  -V, --version          Print the unl0kr version and exit

For an example configuration file, see unl0kr.conf.

Development

Dependencies

Building & running

For development and testing you can run the app in a VT. Unless your user account has special privileges, sudo will be needed to access input device files.

$ meson _build
$ meson compile -C _build
$ sudo chvt 2
$ sudo ./_build/unl0kr

With meson <0.55 use ninja instead of meson compile.

Fonts

In order to work with LVGL, fonts need to be converted to bitmaps, stored as C arrays. Unl0kr currently uses a combination of the OpenSans font for text and the FontAwesome font for pictograms. For both fonts only limited character ranges are included to reduce the binary size. To (re)generate the C file containing the combined font, run the following command

$ npx lv_font_conv --bpp 4 --size 32 --no-compress -o font_32.c --format lvgl \
    --font OpenSans-Regular.ttf \
      --range '0x0020-0x007F' \
      --range '0x00A0-0x00FF' \
      --range '0x0100-0x017F' \
      --range '0x0370-0x03FF' \
      --range '0x2000-0x206F' \
      --range '0x20A0-0x20CF' \
      --range '0x2200-0x22FF' \
    --font FontAwesome5-Solid+Brands+Regular.woff \
      --range '0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2' \
      --range '0xF042' \
      --range '0xF35B'

Below is a short explanation of the different unicode ranges used above.

  • OpenSans
    • Basic Latin (0x0020-0x007F)
    • Latin-1 supplement (0x00A0-0x00FF)
    • Latin extended A (0x0100-0x017F)
    • Greek and Coptic (0x0370-0x03FF)
    • General punctuation (0x2000-0x206F)
    • Currency symbols (0x20A0-0x20CF)
    • Mathematical operators (0x2200-0x22FF)
  • FontAwesome
    • Standard LV_SYMBOL_* glyphs (0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2)
    • adjust (0xF042)
    • arrow-alt-circle-up (0xF35B)

Keyboard layouts

Unl0kr uses squeekboard layouts converted to C via squeek2lvgl. To regenerate the layouts, run

$ ./regenerate-layouts.sh

from the root of the repository.

Generating screenshots

To generate screenshots in a variety of common sizes, build unl0kr and then run

$ sudo ./regenerate-screenshots _build/unl0kr

where _build/unl0kr is the location of the unl0kr binary. Note that you may have to adapt some of the settings inside the script depending on the device you're using to generate the screenshots.

Screen recording

For demonstration purposes you can record the framebuffer device, e.g. with ffmpeg:

$ sudo ffmpeg -f fbdev -i /dev/fb0 -r 24 -c:v libx264 -b:v 500k demo.avi

Acknowledgements

The lv_port_linux_frame_buffer project served as a starting point for the codebase.

The mouse cursor image was taken from lv_sim_emscripten.

License

Unl0kr is licensed under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The OpenSans font is licensed under the Apache License 2.0.

The FontAwesome font is licensed under the Open Font License version 1.1.