Files
raucao a8dd45b890 Keep the nostrconnect:// handler on the stable build
With both builds installed, both desktop files claimed
`x-scheme-handler/nostrconnect`, and the nightly deploy left the default
unset — so which app opened a link was decided by GIO's handler order, and
the nightly (whose vault has its own, often empty, identity) could end up
receiving links it could not pair.

The nightly desktop file no longer declares the scheme: system
integrations belong to the installed release. The nightly still accepts a
`nostrconnect://` argument (`HANDLES_OPEN`) and pairs through "Connect an
app…", it is just never the default handler.

GIO keeps honouring a `mimeapps.list` default even after the desktop file
stops claiming the scheme (verified), so `regent-deploy` also hands a stale
nightly association back by dropping the entry, leaving the stable build as
the only remaining handler.

Fix the second half too: a link-opened pairing presents no "Connect an app"
dialog, so `ConnectDialog::report_error` was parenting its alert to that
never-presented dialog (`self.window()` is `None`), and any failure — a bad
URI, or a build with no identity key — was silent. It now falls back to
`Windows::visible_parent()`, like every other pointer route.
2026-11-28 14:24:34 +04:00

79 lines
2.7 KiB
Meson

subdir('resources')
subdir('icons')
# Every metadata file carries the app id, so a development build gets its own
# copy of each under the `.Devel` id (see the profile handling in the root
# meson.build). The templates are named for the stable id; the generated file is
# named for the selected one, which is what the shell, AppStream and GSettings
# look up.
app_conf = configuration_data()
app_conf.set('appid', app_id)
# The GSettings path is the app id with dots replaced by slashes, with a trailing
# slash. It must match what src/main.rs uses for `gio::Settings::new(APP_ID)`.
app_conf.set('apppath', app_path + '/')
app_conf.set('binary', binary_name)
app_name = 'Regent'
if devel
app_name = 'Regent (Nightly)'
endif
app_conf.set('name', app_name)
# Only the stable build registers the `nostrconnect://` scheme handler: system
# integrations belong to the installed release, and two desktop files claiming
# the same scheme makes which one opens a link nondeterministic. The nightly
# still accepts a `nostrconnect://` argument (it is built with `HANDLES_OPEN`);
# it is just never the default handler. The dev deploy hands a stale nightly
# association back to the stable build (see `build-aux/regent-deploy.sh`).
mime = 'MimeType=x-scheme-handler/nostrconnect;'
if devel
mime = ''
endif
app_conf.set('mime', mime)
desktop_file = configure_file(
input: 'org.kosmos.raucao.Regent.desktop.in',
output: app_id + '.desktop',
configuration: app_conf,
install: true,
install_dir: get_option('datadir') / 'applications',
)
metainfo_file = configure_file(
input: 'org.kosmos.raucao.Regent.metainfo.xml.in',
output: app_id + '.metainfo.xml',
configuration: app_conf,
install: true,
install_dir: get_option('datadir') / 'metainfo',
)
gschema_file = configure_file(
input: 'org.kosmos.raucao.Regent.gschema.xml.in',
output: app_id + '.gschema.xml',
configuration: app_conf,
install: true,
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
)
# `gnome.compile_schemas()` scans the *source* directory, so it would miss the
# generated schema (the source is now a `.in` template). Compile from the build
# directory instead, where `configure_file` wrote the schema under the selected
# app id. This is what makes `GSETTINGS_SCHEMA_DIR=_build/data` work for a dev
# run; the installed schema is compiled by `gnome.post_install` below.
glib_compile_schemas = find_program('glib-compile-schemas')
custom_target(
'gsettings-compile-' + app_id,
output: 'gschemas.compiled',
input: gschema_file,
command: [
glib_compile_schemas,
'--targetdir', meson.current_build_dir(),
meson.current_build_dir(),
],
build_by_default: true,
)
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)