~mil/mepo

0.5 1 year, 10 months ago

This release was focused on polishing UI feature completeness including:
(1) a rework of the preference system and the introduction of save/restore
state, (2) interactive debugging via STDIN, (3) the introduction of an
async shellpipe variant (along with bookmarking and user positioning
shell scripts), and (4) several smaller miscellaneous features.

1. Preference system overhaul & introduction of save/restore state
The preference system has been reworked in order to support save/restore
state and internal state within the application now has a degree of
consistency not present in prior versions. 0.4 and prior versions of
mepo featured several separate commands for setting pingroup properties,
zoom-level, latitude/longitude and other preferences. As of this release,
all preferences can now be set with two commands: `prefset_n` and
`prefset_t`.

This consistency has paved the way for a new `filedump` command which
allows the user to save the current state of the application (zoom level,
latitude/longitude, pins, etc.) to an arbitrary file. In the new default
config, via a new `bind_quit` hook, the application's state is saved
on quitting and restored on boot. The net effect end-users will notice
is that closing the application and opening it back up will restore the
application positioning, pins, etc.

While save/restore state via `bind_quit` is the new default, this
functionality may be overridden by setting `bind_quit` to an empty
expression to nop.

2. Interactive debugging via STDIN
The main application loop has been reworked to handle reading mepolang
from STDIN continually rather then as a one-shot operation on boot as
was previously the case with prior versions. This serves two purposes:
1) to allow interactive debugging by end-users and 2) this allows for
scripting mepo non-interactively / without user interaction.

Mepolang expressions are parsed on newlines characters and commands can
be batched in this way. To test this functionality simply start mepo
using the `-i` commandline flag (e.g. `mepo -i`) and type any mepolang
expression into the console. For example: `prefset_n crosshair_size 40;`.
The `-i` STDIN debugging functionality can also be used by piping STDIN
into mepo on boot as well such as via: `echo "prefset_n crosshair_size
40" | mepo -i`.

3. Async shellpipe, user location script, and pin editing script
The command previously known as `shellpipe` has been renamed to
`shellpipe_sync`, and a new command, `shellpipe_async` has been added
to allow for running asynchronous shell commands. The `shellpipe_async`
command functions identically to shellpipe, in receiving particular ENV
vars to expose, and running any resulting STDOUT as mepolang.

The asynchronous version of shellpipe, `shellpipe_async`, was primarily
built out to support two new scripts included in the default config which
utilize this functionality, which are described below, these scripts are:
1) a user pin location updating script and 2) a pin editing script.

Firstly, the newly added user pin location updating script,
`mepo_ui_menu_user_pin_updater.sh`, drops a pin on the map based on
the user's location. The user's location is obtained either by GPSd,
Geoclue2, or Mozilla Location Services (in that order, moving from one
method to the next if the prior is unavailable). Note, if desired GPSd
and Geoclue2 are now optional dependencies for this script; meanwhile the
fallback to MLS works based on curl/jq so no additional dependencies are
necessary for this fallback method. Ideally on the Pinephone and other
mobile devices, if setup, you will get the best results with GPSd. In my
testing on the Pinephone on postmarketOS, GPSd may need to be manually
enabled via `sudo /etc/gpsd/device-hook "" ACTIVATE`. Note: while in the
background the user's location pin will automatically update via a new
`bind_timer` command in the default config; you may also press `x` or
click on the new UI button labeled `Center` to run this same script in
a synchronous fashion and also reposition the map on the user's location.

Secondly, the newly added pin editing script, `mepo_ui_menu_pin_editor.sh`
script allows for adding, removing, and editing pins location and
metadata by the user. This script can be used both for filtering and
editing existing searches (from Nominatim, Overpass, etc.) and also for
saving/restoring bookmark pins. This functionality uses the save/restore
state of the preference system mentioned above in (1).

4. Misc features: Visual tile progress indicators, -ndc & -h CLI flags,
   clipcopy/clippaste, and High-DPI cursor positioning bugfix

There are several miscellaneous but important features which have been
added in this release cycle which I'd like to mention in this section,
namely: visual tile progress indicators, two new CLI flags, the addition
of the `clipcopy`/`clippaste` mepolang commands, and the fix of a bug
related to high-DPI cursor positioning.

Firstly, tiles while loading now visually represent how much data has
been downloaded rather then just being a solid green color while loading
as with previous versions. With this change, the percentage and data in
kilobytes downloaded for each tile is shown and the background color
represents loading status where black is 0% loaded and white is 100%
and a gradient (of grays) indicates progress loading status.

Secondly, two new CLI flags have been added to the application. The
new `-ndc` flag allows you to run mepo without the 'default'
baked in mepolang configuration which automatically adds things such
keybindings/buttons/hooks for the bundled scripts and similar.  And the
new `-h` flag is a simple commandline help flag which shows the program
usage for all of the existing commandline flags.

Thirdly, two new commands have been added for environment-independent
clipboard access. The `clipcopy` command copies the current map's
coordinates to the clipboard; meanwhile, the `clippaste` command relocates
the map given coordinates in the clipboard, or alternatively if what's
in the clipboard is not coordinates.. will run the clipboard contents
as mepolang. This is a nice way to debug one-off mepolang expressions.
The `clipcopy` command is bound in the default config to the hotkey `y`
and the `clippaste` command is bound in the default config to the hotkey
`Shift-y`.

Finally, as of the 2.0.22 release of SDL it seems there was a regression
with High-DPI environments such as Phosh (which scales 1.5x by default)
where cursor positioning functionality would sometimes break. The root
cause of this issue is that it seems unscaled cursor positioning was
being reported in mouse motion events; this caused clicking on pins
and UI buttons in high-DPI environments to not function properly. As
of this release, this bug has been resolved via using properly scaled
coordinates based on the application's scaled resolution proportion.