https://github.com/skyjake/lagrange Skip to content Sign up * Why GitHub? + Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories - * Team * Enterprise * Explore + Explore GitHub - + Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - + Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing + Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} skyjake / lagrange Public * * Notifications * Star 519 * Fork 30 * A Beautiful Gemini Client gmi.skyjake.fi/lagrange/ View license 519 stars 30 forks Star Notifications * Code * Issues 83 * Pull requests 0 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights dev Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show Loading {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default Loading View all tags 8 branches 60 tags Code Loading Latest commit @skyjake skyjake Cleanup ... 42fb4f7 Nov 19, 2021 Cleanup 42fb4f7 Git stats * 3,003 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github CI: Install zip in Debian environment Oct 31, 2021 debian rework debian/rules to provide correct build options for arm/x86 plat... Dec 9, 2020 ios Updated README: Notes about iOS Oct 18, 2021 lib Updated the_Foundation: v1.0.1 Nov 13, 2021 po Translated using Weblate (German) Nov 15, 2021 res Fixed clicking on tabs when banner is underneath Nov 19, 2021 src Cleanup Nov 19, 2021 .clang-format DocumentWidget: Fetching URL contents Jul 21, 2020 .gitignore Ignore Xcode assets Feb 19, 2021 .gitmodules Added new dependencies: fribidi and harfbuzz Jun 9, 2021 AUTHORS.md Updated AUTHORS Nov 14, 2021 BuildType.cmake Default build type selection Sep 8, 2020 CMakeLists.txt Localized language names in Preferences Nov 14, 2021 Depends-iOS.cmake iOS: Use precompiled FriBidi, HarfBuzz Aug 2, 2021 Depends.cmake Depends: Require the_Foundation v1.0.1 Nov 6, 2021 LICENSE.md Updated license text Jan 5, 2021 README.md Updated README: Notes about iOS Oct 18, 2021 lagrange_about.png Updated the hero image using v1.2 Feb 28, 2021 sdl2-macos-ios.diff macOS: Context menu consumes modifier key releases Sep 26, 2021 View code [ ] Lagrange Features Downloads How to compile Unicode text rendering Installing to a custom directory Build options Compiling on macOS Compiling on Windows Compiling on Raspberry Pi Compiling on iOS User files README.md Lagrange Lagrange is a desktop GUI client for browsing Geminispace. It offers modern conveniences familiar from web browsers, such as smooth scrolling, inline image viewing, multiple tabs, visual themes, Unicode fonts, bookmarks, history, and page outlines. Like Gemini, Lagrange has been designed with minimalism in mind. It depends on a small number of essential libraries. It is written in C and uses SDL for hardware-accelerated graphics. OpenSSL is used for secure communications. Lagrange window open on URL "about:lagrange" Features * Beautiful typography with full Unicode support * Autogenerated page style and symbol for each Gemini domain * Smart suggestions when typing the URL -- search bookmarks, history, identities * Sidebar for page outline, managing bookmarks and identities, and viewing history * Multiple tabs * Identity management -- create and use TLS client certificates * Audio playback: MP3, Ogg Vorbis, WAV * And much more! Open about:help in the app, or see help.gmi Downloads Prebuilt binaries for Windows, macOS and Linux can be found in Releases. You can also find Lagrange on Flathub for Linux. On macOS you can install and upgrade via Homebrew: brew install --cask lagrange On openSUSE Tumbleweed: sudo zypper install lagrange How to compile You need a POSIX-compatible environment to compile Lagrange. The required tools are a C11 compiler (e.g., Clang or GCC), CMake and pkg-config. Additional tools are required for the optional compilation of HarfBuzz and GNU FriBidi (see next section for details). 1. Download and extract a source tarball from Releases. Please note that the GitHub/Gitea-generated tarballs do not contain HarfBuzz, GNU FriBidi, or the_Foundation submodules; check which tarball you are getting. Alternatively, you may also clone the repository and its submodules: git clone --recursive --branch release https: //git.skyjake.fi/gemini/lagrange 2. Check that you have the recommended build tools and dependencies installed: CMake, SDL 2, OpenSSL 1.1.1, libpcre, libunistring, GNU FriBidi, and zlib. For example, on macOS this would do the trick (using Homebrew): brew install cmake sdl2 openssl@1.1 pcre libunistring fribidi Or on Ubuntu: sudo apt install cmake libsdl2-dev libssl-dev libpcre3-dev zlib1g-dev libunistring-dev libfribidi-dev 3. Optionally, install the mpg123 decoder library for MPEG audio support. For example, the macOS Homebrew package is mpg123 and on Ubuntu it is libmpg123-dev. 4. Create a build directory. 5. In your empty build directory, run CMake: cmake {path_of_lagrange_sources} -DCMAKE_BUILD_TYPE=Release 6. Build it: cmake --build . 7. Now you can run lagrange, lagrange.exe, or Lagrange.app. Unicode text rendering Lagrange relies on the HarfBuzz and GNU FriBidi libraries for handling complex scripts and bidirectional text. This repository includes these two libraries as submodules. By default, if HarfBuzz and GNU FriBidi are not available on the system, they will be compiled as part of the app without any additional dependencies. Note that compiling these libraries has the following requirements: * HarfBuzz requires a C++ compiler. * GNU FriBidi cannot be compiled with CMake; you need to have Meson and Ninja. If these requirements cannot be met, or you would prefer the use the system-provided HarfBuzz and GNU FriBidi, please refer to the list of build options below: ENABLE_HARFBUZZ_MINIMAL and ENABLE_FRIBIDI_BUILD should both be set to NO. Note that a system-provided HarfBuzz likely has dependencies to other libraries, such as FreeType and GLib. You also may disable HarfBuzz and/or GNU FriBidi entirely. The old text renderer that only supports non-complex left-to-right scripts is then used. Installing to a custom directory By default, the compiled app will be installed to a system-wide location determined by CMake. Set CMAKE_INSTALL_PREFIX to install to a directory of your choosing: 1. cmake {path_of_lagrange_sources} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/dest/path 2. cmake --build . --target install Note that the install target also deploys an XDG .desktop file for launching the app. Build options CMake Option Description Merge resource files (fonts, etc.) together using a Bash shell script. By default this is OFF, so res/bincat.c is compiled as a native executable for this purpose. However, when ENABLE_BINCAT_SH cross-compiling, native binaries built during the CMake run may be targeted for the wrong architecture. Set this to ON if you are having problems with bincat while running CMake. Draw a custom window frame. (Only on Microsoft Windows.) The custom frame is more ENABLE_CUSTOM_FRAME in line with the visual style of the rest of the UI, but does not implement all of the native window behaviors (e.g., snapping, system menu). Allow changing the Downloads directory via the Preferences dialog. This should be set to ENABLE_DOWNLOAD_EDIT OFF in sandboxed environments where downloaded files must be saved into a specific place. Sleep in the main thread instead of waiting for events. On some platforms, SDL_WaitEvent () may have a relatively high CPU usage. Setting this to ON polls for events ENABLE_IDLE_SLEEP periodically but otherwise keeps the main thread sleeping, reducing CPU usage. The drawback is that there is a slightly increased latency reacting to new events after idle mode ends. Use the GNU FriBidi library for processing ENABLE_FRIBIDI bidirectional text. FriBidi implements the Unicode Bidirectional Algorithm to determine text directions. Compile the GNU FriBidi library as part of ENABLE_FRIBIDI_BUILD the build. If set to OFF, pkg-config is used instead to locate the library. Use the HarfBuzz library for shaping Unicode text. This is required for correctly ENABLE_HARFBUZZ rendering complex scripts and combining glyphs. If disabled, a simplified text shaping algorithm is used that only works for non-complex languages like English. Build the HarfBuzz library with all dependencies disabled. Useful when building the app for distribution so that the number ENABLE_HARFBUZZ_MINIMAL of deployed dependencies will be minimized. A system-provided version of HarfBuzz is likely built with dependencies on FreeType and ICU at least. If set to OFF, pkg-config will be used to find HarfBuzz. Instances of the Lagrange executable communicate via signals or (on Windows) a system-provided IPC mechanism. This is used ENABLE_IPC for controlling an existing Lagrange window via the CLI. If set to OFF, each instance of the app runs without knowledge of other instances. This may cause them to overwrite each other's runtime files. Use kerning information in the fonts to adjust glyph placement. Setting this ON improves text appearance in subtle ways but ENABLE_KERNING slows down text rendering. It may be a good idea to set this to OFF when running on a slow CPU. This option only affects the simple built-in text renderer, and has no effect on HarfBuzz. ENABLE_MPG123 Use the mpg123 library for decoding MPEG audio files. Locate resources only in relation to the ENABLE_RELATIVE_EMBED executable. Useful when any system/predefined directories are not supposed to be accessed, e.g., in the Windows portable build. Embed all resource files into the Lagrange executable instead of keeping them in a ENABLE_RESOURCE_EMBED separate file that gets loaded at launch. Setting this ON makes it much slower to run CMake and to compile Lagrange. ENABLE_WEBP Use libwebp to decode .webp images, if pkg-config can find the library. Set correct window position after the window ENABLE_WINDOWPOS_FIX has already been shown. This may be necessary on some platforms to prevent the window from being restored to the wrong position. Default to software rendering when running under X11. By default Lagrange attempts to ENABLE_X11_SWRENDER use the GPU for rendering the user interface. You can also use the --sw option at launch to force software rendering. Compiling on macOS When using OpenSSL 1.1.1 from Homebrew, you must add its pkgconfig path to your PKG_CONFIG_PATH environment variable, for example: export PKG_CONFIG_PATH=/opt/homebrew/Cellar/openssl@1.1/1.1.1i/lib/pkgconfig Also, SDL's trackpad scrolling behavior on macOS is not optimal for regular GUI apps because it emulates a physical mouse wheel. This may change in a future release of SDL, but at least in 2.0.14 (and earlier) a small patch is required to allow momentum scrolling to come through as single-pixel mouse wheel events. Note that SDL comes with an Xcode project; use the "Shared Library" target and check that you are doing a Release build. Compiling on Windows Windows builds require MSYS2. In theory, Clang or GCC (on MinGW) could be set up natively on Windows for compiling everything, but the_Foundation still lacks Win32 implementations for the Socket and Process classes and these are required by Lagrange. Cygwin is a possible alternative to MSYS2, although Cygwin builds have not been tested. You should use a version of the SDL 2 library that is compiled for native Windows (i.e., the MSVC variant) instead of the version from MSYS2 or MinGW. You can download a copy of the SDL binaries from libsdl.org. To make configuration easier in your MSYS2 environment, consider writing a custom sdl2.pc file so pkg-config can automatically find the correct version of SDL. Below is an example of what your sdl2.pc might look like: prefix=/c/SDK/SDL2-2.0.12/ arch=x64 libdir=${prefix}/lib/${arch}/ incdir=${prefix}/include/ Name: sdl2 Description: Simple DirectMedia Layer Version: 2.0.12-msvc Libs: ${libdir}/SDL2.dll -mwindows Cflags: -I${incdir} The -mwindows option is particularly important as that specifies the target is a GUI application. Also note that you are linking directly against the Windows DLL -- do not use any prebuilt .lib files if available, as those as specific to MSVC. pkg-config will find your .pc file if it is on PKG_CONFIG_PATH or you place it in a system-wide pkgconfig directory. Once you have compiled a working binary under MSYS2, there is still an additional step required to allow running it directly from the Windows shell: the shared libraries from MSYS2 must be found either via PATH or by copying them to the same directory where lagrange.exe is located. Compiling on Raspberry Pi On Raspberry Pi 4/400, you can compile and run Lagrange just like on a regular desktop PC. Accelerated OpenGL graphics should work fine under X11. On Raspberry Pi 3 or earlier, you should use a version of SDL that is compiled to take advantage of the Broadcom VideoCore OpenGL ES hardware. This provides the best performance when running Lagrange in a console. OpenGL under X11 on Raspberry Pi 2/3 is quite slow/ experimental. When running under X11, software rendering is the best choice and the SDL from Raspbian etc. is sufficient. The following build options are recommended on Raspberry Pi 2/3: * ENABLE_KERNING=NO: faster text rendering without noticeable loss of quality * ENABLE_WINDOWPOS_FIX=YES: workaround for window position restore issues (SDL bug) * ENABLE_X11_SWRENDER=YES: use software rendering under X11 Compiling on iOS Compiling Lagrange on iOS is moderately difficult. As a prerequisite, you will need to have an iOS toolchain configuration for CMake. CMake is required for Lagrange itself and for the_Foundation. You will also need Autotools helpers for iOS because HarfBuzz, libiconv, libunistring, and libpcre use Automake. Meson and Ninja are used for GNU FriBidi. The iconfigure script in the Autotools helpers needs to be patched. After these utilities are available, the scripts in ios/ can be used as a basis for the build. Unfortunately there is no ready-made high-level script for performing all these steps, so you'll need to adapt them individually to your needs. 1. Meson cross-compilation is controlled with ios/ cross-mac-arm64-ios-arm64.ini. Modify it to be compatible with your build system and target device. 2. ios/deps.sh compiles most of the dependencies using Meson, Ninja, and iconfigure. Note that the simulator build has not been set up in these scripts, only the os build. 3. Clone OpenSSL for iPhone and build it with iOS 9.0 as the minimum version. Deploy the static libraries in $HOME/SDK/ios/$arch/, or wherever you've set IOS_DIR to be. 4. Create an empty build directory for the_Foundation and run ios/ cmake-ios-tf.sh from there. You may need to adjust the source directory path in the script depending on where you place your build directory. 5. Now you can make install to build and deploy the_Foundation to IOS_DIR. 6. Finally, you can run CMake like in ios/cmake-ios-lagrange.sh to generate an Xcode project that builds the app. If FriBidi and HarfBuzz are not used (disabling RTL and complex text rendering), the first step can be skipped and the corresponding build steps in ios/deps.sh can be removed. In this case, Meson and Ninja are not needed at all. User files On Windows, user files are stored in %HOMEPATH%/AppData/Roaming/ fi.skyjake.Lagrange/, unless one is using the portable distribution and there is a userdata/ subdirectory present in the executable directory. On macOS, user files are stored in ~/Library/Application Support/ fi.skyjake.Lagrange/. On Linux/*BSD/other operating systems, user files stored in ~/.config /lagrange/ unless you have customized the XDG directories, in which case the XDG_CONFIG_HOME environment variable is used to determine where user files saved. The usage and contents of the user files are described in the Help document. You can delete one or more of the files while Lagrange is not running to reset the corresponding data to the default/empty state. One instance of Lagrange can be running at a time per user directory. About A Beautiful Gemini Client gmi.skyjake.fi/lagrange/ Topics windows macos linux client gui openssl network sdl raspberrypi desktop gemini c11 Resources Readme License View license Releases 52 v1.8.2 Latest Nov 13, 2021 + 51 releases Sponsor this project * https://paypal.me/skyjake Contributors 28 * @skyjake * @Carmina16 * @sikmir * @CyberTailor * @laosb * @Strahinja * @MCMic * @f0086 * @Waterrail * @balazsbotond + 17 contributors Languages * C 97.0% * Objective-C 1.7% * CMake 1.1% * Other 0.2% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.