From 41304c36fdfff45e8ea46578e067441dda1e58ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Mon, 6 Jul 2020 13:06:22 +0200 Subject: [PATCH] cli: Allow to set profile per event We allowed set the global profile via `-P` use it as per event profile when used with `-E`. Ironically the manpage always said it'd be that way. --- cli/fbcli.c | 6 ++++-- doc/fbcli.xml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/fbcli.c b/cli/fbcli.c index eac7ca8..ee26bfd 100644 --- a/cli/fbcli.c +++ b/cli/fbcli.c @@ -71,6 +71,8 @@ trigger_event (const char *name, const gchar *profile, gint timeout) g_print ("Triggering feedback for event '%s'\n", name); event = lfb_event_new (name); lfb_event_set_timeout (event, timeout); + if (profile) + lfb_event_set_feedback_profile (event, profile); g_signal_connect (event, "feedback-ended", (GCallback)on_feedback_ended, &success); if (!lfb_event_trigger_feedback (event, &err)) { @@ -162,10 +164,10 @@ main (int argc, char *argv[0]) name = g_strdup (DEFAULT_EVENT); g_timeout_add_seconds (watch, (GSourceFunc)on_watch_expired, NULL); - if (profile) + if (profile && !name) success = set_profile (profile); else - success = trigger_event (name, timeout); + success = trigger_event (name, profile, timeout); lfb_uninit (); return !success; diff --git a/doc/fbcli.xml b/doc/fbcli.xml index 4bd1b7b..bdacf87 100644 --- a/doc/fbcli.xml +++ b/doc/fbcli.xml @@ -70,7 +70,8 @@ print help and exit The feedback profile (full, quiet, silent) - to use for the given event. + to use for the given event. If no event is specified then the global + feedback profile is changed.