Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 29, 2024
2 parents 551969d + 6602be6 commit 8ec98cb
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 26 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
cmake_minimum_required (VERSION 3.9)

project (Lagrange
VERSION 1.18.0
VERSION 1.18.1
DESCRIPTION "A Beautiful Gemini Client"
LANGUAGES C
)
Expand Down Expand Up @@ -74,10 +74,10 @@ option (ENABLE_FRIBIDI_BUILD "Build the GNU FriBidi library (if OFF, try pkg-
option (ENABLE_HARFBUZZ "Use the HarfBuzz library to shape text" ON)
option (ENABLE_HARFBUZZ_MINIMAL "Build the HarfBuzz library with minimal dependencies (if OFF, try pkg-config)" OFF)
option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON)
option (ENABLE_OPUS "Use llibopusfile for decoding Opus audio (via pkg-config)" ON)
option (ENABLE_SPARKLE "Use Sparkle for automatic updates (macOS)" OFF)
option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON)
option (ENABLE_WINSPARKLE "Use WinSparkle for automatic updates (Windows)" OFF)
option (ENABLE_OPUS "Use llibopusfile for decoding Opus audio (via pkg-config)" ON)

include (BuildType)
include (Resources)
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Like Gemini, Lagrange has been designed with minimalism in mind. It depends on a
* Multiple tabs
* Identity management — create and use TLS client certificates
* Audio playback: MP3, Ogg Vorbis, WAV
* Curses-based TUI as an alternative to the graphical interface
* And much more! Open `about:help` in the app, or see [help.gmi](https://git.skyjake.fi/gemini/lagrange/raw/branch/release/res/about/help.gmi)

## Downloads
Expand Down Expand Up @@ -46,7 +47,7 @@ You need a POSIX-compatible environment to compile Lagrange.
The required tools are a C11 compiler (e.g., Clang or GCC), CMake, `pkg-config`, and `zip`. Additional tools are required if HarfBuzz and GNU FriBidi are also compiled as part of the build (see next section for details).

1. Download and extract a source tarball from [Releases][rel]. Please note that the GitHub/Gitea-generated tarballs do not contain HarfBuzz, GNU FriBidi, or [the_Foundation](https://git.skyjake.fi/skyjake/the_Foundation) submodules; check which tarball you are downloading. 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: SDL 2, OpenSSL 1.1.1, libpcre, libunistring, GNU FriBidi, and zlib. For example,
2. Check that you have the recommended build tools and dependencies installed: SDL 2, OpenSSL, libpcre, libunistring, GNU FriBidi, and zlib. For example,
* on macOS using Homebrew: `brew install cmake automake sdl2 [email protected] pcre libunistring fribidi`
* on Ubuntu: `sudo apt install cmake zip libsdl2-dev libssl-dev libpcre3-dev zlib1g-dev libunistring-dev libfribidi-dev`
* on Fedora: `sudo dnf install cmake zip SDL2-devel openssl-devel pcre-devel zlib-devel libunistring-devel fribidi-devel`
Expand Down Expand Up @@ -86,31 +87,35 @@ Note that the `install` target also deploys an XDG .desktop file for launching t
| ------------ | ----------- |
| `ENABLE_CUSTOM_FRAME` | Draw a custom window frame. (Only on Microsoft Windows.) The custom frame is more 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). |
| `ENABLE_DOWNLOAD_EDIT` | Allow changing the Downloads directory via the Preferences dialog. This should be set to **OFF** in sandboxed environments where downloaded files must be saved into a specific place. |
| `ENABLE_GUI` | Build the GUI application (the default). |
| `ENABLE_IDLE_SLEEP` | Sleep in the main thread instead of waiting for events. On some platforms, when using SDL 2.0.16 or earlier, `SDL_WaitEvent()` may have a relatively high CPU usage. Setting this to **ON** polls for events 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. |
| `ENABLE_FRIBIDI` | Use the GNU FriBidi library for processing bidirectional text. FriBidi implements the Unicode Bidirectional Algorithm to determine text directions. |
| `ENABLE_FRIBIDI_BUILD` | Compile the GNU FriBidi library as part of the build. If set to **OFF**, `pkg-config` is used instead to locate the library. |
| `ENABLE_HARFBUZZ` | Use the HarfBuzz library for shaping Unicode text. This is required for correctly rendering complex scripts and combining glyphs. If disabled, a simplified text shaping algorithm is used that only works for non-complex languages like English. |
| `ENABLE_HARFBUZZ_MINIMAL` | Build the HarfBuzz library with all dependencies disabled. Useful when building the app for distribution so that the number 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. |
| `ENABLE_IPC` | Instances of the Lagrange executable communicate via signals or (on Windows) a system-provided IPC mechanism. This is used 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. |
| `ENABLE_KERNING` | Use kerning information in the fonts to adjust glyph placement. Setting this **ON** improves text appearance in subtle ways but 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_MOBILE_PHONE` | Use the mobile phone UI variant. This replaces the sidebars with a sliding sheet and has other touch-friendly features. Settings and dialogs are presented as form-based sheets. |
| `ENABLE_MOBILE_TABLET` | Use the tablet UI variant. Sidebars are available as on the desktop, but Settings and dialogs are presented as form-based sheets. |
| `ENABLE_MPG123` | Use the mpg123 library for decoding MPEG audio files. |
| `ENABLE_OPUS` | Use the opusfile library for decoding Opus audio files. |
| `ENABLE_RELATIVE_EMBED` | Locate resources only in relation to the executable. Useful when any system/predefined directories are not supposed to be accessed, e.g., in the Windows portable build. |
| `ENABLE_TUI` | Build the TUI version (`clagrange`). The SEALCurses library is required: it is used instead of SDL. |
| `ENABLE_STATIC` | Link dependencies statically. |
| `ENABLE_TUI` | Build the TUI application (`clagrange`). The SEALCurses library is required (it replaces SDL); check that the `lib/sealcurses` submodule is checked out. |
| `ENABLE_WEBP` | Use libwebp to decode .webp images, if `pkg-config` can find the library. |
| `ENABLE_WINDOWPOS_FIX` | Set correct window position after the window has already been shown. This may be necessary on some platforms to prevent the window from being restored to the wrong position. |
| `ENABLE_X11_SWRENDER` | Default to software rendering when running under X11. By default Lagrange attempts to use the GPU for rendering the user interface. You can also use the `--sw` option at launch to force software rendering. |
| `ENABLE_X11_XLIB` | Use the Xlib API directly under X11. This is used for window decoration color theming, for example. |

### Compiling the TUI version

Lagrange has an optional text-mode interface that enables running the app in the terminal. This is disabled by the default build settings. Setting the `ENABLE_TUI` option to `YES` will replace the SDL dependency with a library called [SEALCurses](https://git.skyjake.fi/skyjake/sealcurses.git) that implements the required parts of the SDL API on top of Curses. The resulting executable is called `clagrange`.
Lagrange has a text-mode interface that enables running the app in a terminal. However, it is mutually exclusive with the graphical interface, which means that the GUI and TUI are built as separate executables. By default, the TUI is disabled in the build settings. Set the `ENABLE_TUI` option to `YES` to build the TUI executable. If the GUI is not needed, you can also set `ENABLE_GUI` to `NO`. The TUI executable is called `clagrange`.

The requirements for building the TUI version are the same as with the GUI, except [ncurses](https://invisible-island.net/ncurses/) is required instead of SDL. HarfBuzz and all the image and audio dependencies are excluded from the TUI build.

The `build-tui.sh` helper script is provided for building the TUI version. All command line arguments given to the script are passed to CMake for further configuring the build. Note that the CMake install prefix variable (`CMAKE_INSTALL_PREFIX`) should not be set via an argument. Instead, the script will prompt for the install directory when run.
In the TUI build, SDL is replaced with a library called [SEALCurses](https://git.skyjake.fi/skyjake/sealcurses.git) that implements a subset of the SDL API on top of [Curses](https://invisible-island.net/ncurses/). The requirements for building the TUI are otherwise the same as with the GUI, except HarfBuzz, FriBidi, and all the image and audio dependencies will not be used.

### 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:
When using OpenSSL from Homebrew, you must add its pkgconfig path to your `PKG_CONFIG_PATH` environment variable, for example:

export PKG_CONFIG_PATH=/opt/homebrew/Cellar/[email protected]/1.1.1i/lib/pkgconfig

Expand Down
17 changes: 9 additions & 8 deletions cmake/Depends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ else ()
endif ()
endif ()
set (INSTALL_THE_FOUNDATION OFF)
set (TFDN_STATIC_LIBRARY ON CACHE BOOL "")
set (TFDN_ENABLE_INSTALL OFF CACHE BOOL "")
set (TFDN_ENABLE_TESTS OFF CACHE BOOL "")
set (TFDN_ENABLE_WEBREQUEST OFF CACHE BOOL "")
set (TFDN_STATIC_LIBRARY ON CACHE BOOL "" FORCE)
set (TFDN_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set (TFDN_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
set (TFDN_ENABLE_WEBREQUEST OFF CACHE BOOL "" FORCE)
set (TFDN_ENABLE_STATIC_LINK ${ENABLE_STATIC} CACHE BOOL "" FORCE)
add_subdirectory (lib/the_Foundation)
add_library (the_Foundation::the_Foundation ALIAS the_Foundation)
Expand Down Expand Up @@ -207,10 +207,11 @@ endif ()
if (ENABLE_TUI)
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/sealcurses/CMakeLists.txt)
# Build a static version of SEALCurses.
set (SEALCURSES_SUBDIR YES CACHE BOOL "")
set (SEALCURSES_ENABLE_STATIC YES CACHE BOOL "")
set (SEALCURSES_ENABLE_SHARED NO CACHE BOOL "")
set (SEALCURSES_ENABLE_INSTALL NO CACHE BOOL "")
set (SEALCURSES_SUBDIR YES CACHE BOOL "" FORCE)
set (SEALCURSES_STATIC_NCURSES ${ENABLE_STATIC} CACHE BOOL "" FORCE)
set (SEALCURSES_ENABLE_STATIC YES CACHE BOOL "" FORCE)
set (SEALCURSES_ENABLE_SHARED NO CACHE BOOL "" FORCE)
set (SEALCURSES_ENABLE_INSTALL NO CACHE BOOL "" FORCE)
add_subdirectory (${CMAKE_SOURCE_DIR}/lib/sealcurses)
else ()
pkg_check_modules (SEALCURSES REQUIRED sealcurses)
Expand Down
2 changes: 1 addition & 1 deletion lib/sealcurses
Submodule sealcurses updated from 7751a9 to fa5411
75 changes: 72 additions & 3 deletions po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2023-01-29 07:54+0000\n"
"PO-Revision-Date: 2023-11-13 20:14+0000\n"
"PO-Revision-Date: 2024-09-21 22:35+0000\n"
"Last-Translator: Omar Polo <[email protected]>\n"
"Language-Team: Italian <http://weblate.skyjake.fi/projects/lagrange/ui/it/>\n"
"Language: it\n"
Expand Down Expand Up @@ -370,7 +370,7 @@ msgid "dlg.cert.trust"
msgstr "Fidati"

msgid "dlg.cert.fingerprint"
msgstr "Copia Fingerprint"
msgstr "Fingerprint"

#, c-format
msgid "dlg.input.prompt"
Expand Down Expand Up @@ -1096,7 +1096,7 @@ msgid "menu.edit.notes"
msgstr "Modifica Note…"

msgid "ident.fingerprint"
msgstr "Copia Firma"
msgstr "Copia Fingerprint SHA-256"

msgid "ident.delete"
msgstr "Elimina Identità…"
Expand Down Expand Up @@ -2749,3 +2749,72 @@ msgid "error.showutf8.msg"
msgstr ""
"Il formato della pagina non è stato riconosciuto ma è testo correttamente "
"codificato in UTF-8."

msgid "heading.upload.edit"
msgstr "Modifica con Titan"

msgid "dlg.upload.edit.incompatible"
msgstr "Questo tipo di risorsa non può essere modificata nell'applicazione."

msgid "heading.upload.edit.error"
msgstr "Modifica Fallita"

msgid "dlg.upload.edit.error"
msgstr "Fallito lo scaricamento del contenuto della risorsa editabile."

msgid "ident.sendmsg"
msgstr "Manda messaggio come…"

msgid "heading.upload.misfin"
msgstr "Invia Messaggio Misfin"

msgid "heading.upload.error.file"
msgstr "File non valido"

msgid "heading.upload.misfin.noident"
msgstr "Nessuna Identità Misfin"

msgid "dlg.upload.misfin.noident"
msgstr ""
"È necessario importare un certificato Misfin per poter inviare messaggi."

msgid "heading.misfin.ok"
msgstr "Messaggio Inviato"

msgid "misfin.success"
msgstr "Il tuo messaggio è stato inviato con successo."

msgid "misfin.unauth"
msgstr "Non sei autorizzato per inviare messaggi a questo destinatario."

msgid "hint.upload.misfin"
msgstr "scrivi un messaggio"

# Only shown in a message box when CCing self fails.
msgid "misfin.cc"
msgstr "Mandando una Copia a Me Stesso"

# Only shown in a message box when verifying the recipient fails.
msgid "misfin.verify"
msgstr "Verificando il Destinatario"

msgid "misfin.unknown"
msgstr "Fallita la comunicazione con il server."

msgid "upload.from"
msgstr "Da:"

msgid "upload.to"
msgstr "A:"

msgid "misfin.self.copy"
msgstr "Mandami una copia"

msgid "upload.file.path"
msgstr "Percorso al file:"

msgid "dlg.cert.fingerprint.pubkey"
msgstr "Copia Chiave Pubblica SHA-256"

msgid "dlg.cert.fingerprint.full"
msgstr "Copia lo SHA-256 del Certificato"
7 changes: 7 additions & 0 deletions res/about/version.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
```
# Release notes

## 1.18.1
* macOS: Fixed opening Misfin URIs externally via system handlers.
* Windows: Register Lagrange as a "misfin://" URL handler.
* TUI: Fixed potentially garbled output.
* TUI: Only link Curses statically when using CMake option `ENABLE_STATIC`.
* Updated UI translations.

## 1.18

New features:
Expand Down
Binary file modified res/lang/it.bin
Binary file not shown.
9 changes: 6 additions & 3 deletions src/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
#if defined (iPlatformMsys)
# include "win32.h"
#endif
#if defined (iPlatformTerminal)
# undef LAGRANGE_ENABLE_IDLE_SLEEP
#endif
#if defined (LAGRANGE_ENABLE_X11_XLIB)
# include "x11.h"
#endif
Expand Down Expand Up @@ -1100,9 +1103,8 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,
#endif /* defined (LAGRANGE_ENABLE_IPC) */

static iBool hasCommandLineOpenableScheme_(const iRangecc uri) {
static const char *schemes[] = {
"gemini:", "gopher:", "finger:", "spartan:", "nex:", "guppy:", "file:", "data:", "about:"
};
static const char *schemes[] = { "gemini:", "gopher:", "finger:", "spartan:", "nex:",
"misfin:", "guppy:", "file:", "data:", "about:" };
iForIndices(i, schemes) {
if (startsWithCase_Rangecc(uri, schemes[i])) {
return iTrue;
Expand Down Expand Up @@ -2017,6 +2019,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
startsWithCase_CStr(ev.drop.file, "gopher:") ||
startsWithCase_CStr(ev.drop.file, "spartan:") ||
startsWithCase_CStr(ev.drop.file, "nex:") ||
startsWithCase_CStr(ev.drop.file, "misfin:") ||
startsWithCase_CStr(ev.drop.file, "file:")) {
postCommandf_Root(NULL, "~open newtab:1 url:%s", ev.drop.file);
}
Expand Down
8 changes: 6 additions & 2 deletions src/x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ iBool isXSession_X11(void) {
if (driver && !iCmpStr(driver, "wayland")) {
return iFalse;
}
const char *dpy = getenv("DISPLAY");
if (!dpy || strlen(dpy) == 0) {
return iFalse;
}
return iTrue; /* assume yes if this source file is being used */
}

Expand All @@ -51,15 +55,15 @@ void setDarkWindowTheme_SDLWindow(SDL_Window *d, iBool setDark) {
Atom u8 = XInternAtom(dpy, "UTF8_STRING", False);
const char *value = setDark ? "dark" : "light";
XChangeProperty(dpy, wnd, prop, u8, 8, PropModeReplace,
(unsigned char *) value, strlen(value));
(unsigned char *) value, strlen(value));
}
}

void handleCommand_X11(const char *cmd) {
if (!isXSession_X11()) {
return;
}
if (equal_Command(cmd, "theme.changed")) {
if (equal_Command(cmd, "theme.changed")) {
iConstForEach(PtrArray, iter, mainWindows_App()) {
iMainWindow *mw = iter.ptr;
setDarkWindowTheme_SDLWindow(
Expand Down

0 comments on commit 8ec98cb

Please sign in to comment.