How do I change the site name in the .theme file? I'm looking for a solution to change the site name in a .theme file in Drupal 8. I'm using the Group module and want to display a different site name when the current user navigate inside each group. How can I achieve this ?
In a *.theme file this would be difficult to find all places where the site name may end up. This is much easier to do it in settings.php right at the start:

settings.php:

if ($_SERVER['REQUEST_URI'] == '/abc/def') {
  $config['system.site']['name'] = 'abc-def';
}