feedbackd: Allow replacement and an option for it

This brings us in line with e.g. the portals

Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2026-01-16 16:38:29 +01:00
parent 94b35f356a
commit 722a8f1c90
2 changed files with 8 additions and 3 deletions
+3
View File
@@ -41,6 +41,9 @@ Options
``-v``, ``--verbose`` ``-v``, ``--verbose``
print verbose information print verbose information
``-r``, ``--replace``
replace a running instance
Configuration Configuration
============= =============
+5 -3
View File
@@ -116,13 +116,14 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
g_autoptr (GError) err = NULL; g_autoptr (GError) err = NULL;
gboolean opt_verbose = FALSE; gboolean opt_verbose = FALSE, opt_replace = FALSE;
g_autoptr (GOptionContext) opt_context = NULL; g_autoptr (GOptionContext) opt_context = NULL;
g_autoptr (FbdFeedbackManager) manager = NULL; g_autoptr (FbdFeedbackManager) manager = NULL;
const char *debugenv; const char *debugenv;
GOptionEntry options[] = { GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose,
"Print debug information during command processing", NULL }, "Print debug information during command processing", NULL },
{ "replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace a running instance", NULL },
{ NULL } { NULL }
}; };
@@ -153,7 +154,8 @@ main (int argc, char *argv[])
g_bus_own_name (FB_DBUS_TYPE, g_bus_own_name (FB_DBUS_TYPE,
FB_DBUS_NAME, FB_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE, G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
(opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
bus_acquired_cb, bus_acquired_cb,
name_acquired_cb, name_acquired_cb,
name_lost_cb, name_lost_cb,