Commit Graph
41 Commits
Author SHA1 Message Date
Guido Günther cdf5fb2b2d feedback-manager: Split out feedback level calculation
This allows to use it from other places too and while at that
documents it.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-12-15 18:34:35 +01:00
Guido Günther 929d41b7db feedback-manager: End too noisy feedbacks on profile level change
When the profile gets lowered from e.g. quiet to silent we want to end
all ongoing feedbacks that belong to the quiet level.

This allows to e.g. silence an incoming phone call by switching the
feedback level via phosh's quick setting.

Closes: https://source.puri.sm/Librem5/feedbackd/-/issues/13
Closes: https://source.puri.sm/Librem5/feedbackd/-/issues/55
2024-06-21 19:57:29 +00:00
Guido Günther a71fd7d470 manager: Move schema name to header
This makes it available to other compilation units
2024-06-15 11:14:40 +02:00
Guido Günther 4afc8398e2 feedbackd: Pass GMOBILE_USE_UNSTABLE_API to all files
No need to ack that individually
2024-06-13 15:17:52 +02:00
Guido Günther 2d1d72c746 feedback-manager: Handle important hint
This allows blessed apps to override the per-app as well as the global
feedback level. This can e.g. be useful for alarm clocks.
2024-04-20 13:21:56 +00:00
Guido Günther 716f296ab8 feedback-manager: Parse important hint 2024-04-20 13:21:56 +00:00
Guido Günther e6845a52d3 feedback-manager: Use MIN()
A bit easier to read
2024-04-20 13:21:56 +00:00
Guido Günther 4822be0f7c Update to gmobile 0.0.1
Adjust to the one API change. We do it all in one commit to keep
bisectability. We use a slightly newer commit than 0.0.1 to include
build fixes for older glib (as required on PureOS Byzantium).
2023-02-02 13:04:48 +01:00
Guido Günther 83091be25d feedback-manager: Handle theme gsetting
Update the theme when the gsetting changes
2022-12-11 17:34:38 +01:00
Guido Günther f5757045aa manager: Don't load theme in constructor
Loading the theme can trigger calls to
fbd_feedback_manager_get_default() which then results in an endless look
as the object isn't fully initialized in constructed. Instead do
the setup in main() which has the advantage that the manager's life
cycle becomes more obvious too.
2022-12-11 17:34:38 +01:00
Guido Günther a75cdbbc59 theme-expander: Allow to set the theme to expand 2022-12-11 17:34:38 +01:00
Guido Günther 242519498a Recursively load themes
Themes (other than the default theme) can specify a `parent-name` in the
json file. This theme will be used as a base for the theme. Events and
profiles of the children override those in the parents.

For this we move the lookup code into it's separate class and also add
tests.

Closes: #38
2022-12-11 17:34:38 +01:00
Guido Günther db13fc031d manager: Use FEEDBACKD_UDEV_ATTR
It was introduced in

a5b4f99 ("feedbackd: Support visual feedback via LEDs")
2022-11-11 09:50:19 +00:00
Evangelos Ribeiro Tzaras d739a33a5f feedback-manager: Complete DBus call before emitting "feedback-ended"
See previous commit adding the test (that now passes) for the reasoning.

Fixes: #62
2022-11-09 11:54:46 +01:00
Evangelos Ribeiro Tzaras 94001bba78 feedback-manager: Use guint for event id
The ID is inserted into a hashtable below with GUINT_TO_POINTER
and is set using self->next_id++ with next_id also being a guint,
so change the type accordingly.
2022-11-03 19:31:57 +01:00
Guido Günther 16bf78b5a4 manager: Don't sync DBus profile property
This will happen in on_feedbackd_setting_changed() once the
profile was adjusted.
2022-02-04 19:03:00 +01:00
Guido Günther 5c8cbfca39 manager: Sync profile with setting on startup
On startup the GSetting is the relevant input for selecting the profle.

Closes: #52
2022-02-04 19:03:00 +01:00
Guido Günther 2be41ec0ef manager: Set initial profile to unknown
This makes sure we sync the profile with the DBus property after
fetching it from GSettings.
2022-02-04 19:03:00 +01:00
Pablo Correa Gómez 8e9bbd9d4c Reload theme on SIGHUP signal
Fixes #28

Allows for users/applications to request a theme reload
by sending SIGHUP signal to the daemon.
2021-10-19 14:24:04 +00:00
Pablo Correa Gómez 3802c89e67 feedback-manager: Search for default theme under XDG_CONFIG_HOME first
This would allow users to create their own feedback profiles
without editing system files or using root privileges

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-06-08 16:17:41 +02:00
Andreas Hartmann 1c53464090 fbd-feedback-manager: Make sure theme path components are '/' separated
Previously, assembly of the theme paths for custom paths (based on
`XDG_DATA_DIRS`) was performed using `g_strconcat`, which produced erroneous
file paths with missing path separators due to a typo in the code.

Instead, make use of `g_build_filename` to assemble the theme paths from
`XDG_DATA_DIRS` to look for custom themes, which automatically introduces
host-specific path separators between individual path components. This
introduces another temporary variable to ensure that the filename (which is
itself assembled from a name and the file ending) isn't mangled by introduction
of a path separator between these two "parts".
2021-05-31 11:31:30 +02:00
Guido Günther 678ae7a22d fbd-feedback-manager: Don't leak device list 2021-04-26 09:34:23 +00:00
Guido Günther 9c9f767986 fbd-feedback-manager: Don't leak config_path
It's assigned multiple times.
2021-04-26 09:34:23 +00:00
Guido Günther 437b19edd4 fbd-feedback-manager: Make sure to dispose sound device as well
Fixes another leak.
2021-04-26 09:34:23 +00:00
Guido Günther 04648dcf27 feedback-manager: Track DBus clients and end feedbacks if they go away
When the client goes away we build up a list of events to end feedback
for to make sure the hash table isn't modified in place. tThe alternative
approach would be to disconnect the on_event_feedbacks_ended handler,
duplicate the DBus signal emission and use g_hash_table_foreach_remove
but that looks less robust than using the same code path.

Closes: #25
2021-04-22 14:44:30 +02:00
Guido Günther dc8c8c9594 fbd-manager: Keep DBus sender around 2021-04-22 14:43:30 +02:00
Guido Günther 40d318c9aa feedback-manager: Fix formatting
It was off in several places. Now that there's no outstanding
MRs clean it up via

   uncrustify --replace -c phosh.cfg src/fbd-feedback-manager.c
2021-01-11 10:35:03 +01:00
Dylan Van Assche 3ac9494821 fbd-feedback-manager: Allow device-specific feedbackd themes
Reads the compatible list of the device and tries to find a device-specific theme file in all  directories. If no configuration is found, we fall back to a default theme file. The device-specific theme file can always be overriden by specifying the FEEDBACK_THEME environment variable
2021-01-01 18:49:38 +01:00
Guido Günther 8a631cae3e feedback-manager: Dispose leds too 2020-07-24 12:53:13 +02:00
Guido Günther e7f527bf62 feedback-manager: Don't forget to remove not found events from the hash table
This plugs a leak.
2020-07-24 12:53:13 +02:00
Guido Günther cf56999bf7 feedback-manager: Deeply free the feedback list
Instead of freeing each elemnt after each iteration and then the list
itself at the very end just fully free the list. g_autoslist does
not work well on oder glib so do that manually.

This is just cosmetics.
2020-07-24 12:53:13 +02:00
Guido Günther e8dfe6974a fbd-feedback-manager: Check if feedback is usable
If we don't find any usable feedbacks for an event return
FBD_EVENT_END_REASON_NOT_FOUND.
2020-07-22 10:28:42 +00:00
Guido Günther 542fe52cc2 feedback-manager: Fix indentation 2020-07-22 10:28:42 +00:00
Guido Günther 6692d8922b feedback-manager: Add hint to select feedback profile per event
This e.g. allows events that are meant for haptic only to avoid
emitting a sound by omitting the 'full' level and using "quiet"
instead.

Closes: #7
2020-07-10 09:20:04 +00:00
Guido Günther 421c163bdd feedback-manager: Prepare for per event hints
Move feedback profile level into a separate function for that.
2020-07-10 09:20:04 +00:00
Guido Günther a5b4f99412 feedbackd: Support visual feedback via LEDs
Currently all LED feedbacks are infinite we can improve that
later on by using the 'repeat' attribute of the LED pattern
trigger.
2020-07-05 19:25:44 +00:00
Guido Günther bdf251e565 feedback-manager: Only act on add
We would otherwise ignore the action when no vibra device was yet found.
Make sure we release the old device when updating.
2020-06-02 16:36:24 +00:00
Guido Günther 5d947f51b1 feedback-manager: Fix indentation and typo 2020-06-02 16:36:24 +00:00
Guido Günther 784152ba67 feedback-manager: Drop superfluous g_clear_error
The error is a g_autoptr
2020-06-02 16:36:24 +00:00
Guido Günther 9cb62dee1d Allow to lower the feedback level per application
We munge the application id the same way as it's done
for notifications so these can eventually move into
the same schema.
2020-04-20 07:23:44 +00:00
Guido Günther 3663b7d149 Initial commit
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2020-02-14 17:40:34 +01:00