How to apply a patch file in composer to a submodule of a module? I've added the patch to composer.json like this:

  "drupal/admin_toolbar_tools": {
    "Bring back media to dropdown menu": "https://www.drupal.org/files/issues/2019-01-16/admin_toolbar-media_link-3026216-3-option2-D8.patch"
  }


However, admin_toolbar_tools is a sub-module of admin_toolbar (admin_toolbar/admin_toolbar_tools).

I ran composer install, but it doesn't trigger the patch apply process.

The patch I am trying to apply is the following one (https://www.drupal.org/files/issues/2019-01-26/admin_toolbar-media-link-3026216-8-option3.patch).

diff --git a/admin_toolbar_tools/admin_toolbar_tools.module b/admin_toolbar_tools/admin_toolbar_tools.module
index 9ac389c..1f8a36b 100644
--- a/admin_toolbar_tools/admin_toolbar_tools.module
+++ b/admin_toolbar_tools/admin_toolbar_tools.module
@@ -621,20 +621,23 @@ function admin_toolbar_tools_menu_links_discovered_alter(&amp;$links) {

   // If module Media enabled.
   if ($moduleHandler-&gt;moduleExists('media')) {
-    $links['admin_toolbar_tools.add_media'] = [
-      'title' =&gt; t('Add media'),
-      'provider' =&gt; 'admin_toolbar_tools',
-      'route_name' =&gt; 'entity.media.add_page',
-      'menu_name' =&gt; 'admin',
-      'parent' =&gt; 'system.admin_content',
-    ];
+    // Displays media link in toolbar.
+    if (in_array('entity.media.collection', $routes)) {
+      $links['admin_toolbar_tools.media_add_page'] = [
+        'title' =&gt; t('Add media'),
+        'provider' =&gt; 'admin_toolbar_tools',
+        'route_name' =&gt; 'entity.media.add_page',
+        'menu_name' =&gt; 'admin',
+        'parent' =&gt; 'system.admin_content',
+      ];
+    }
     // Add node links for each media type.
     foreach ($entityTypeManager-&gt;getStorage('media_type')-&gt;loadMultiple() as $type) {
       $links['media.add.' . $type-&gt;id()] = [
         'title' =&gt; t($type-&gt;label()),
         'provider' =&gt; 'admin_toolbar_tools',
         'route_name' =&gt; 'entity.media.add_form',
-        'parent' =&gt; 'admin_toolbar_tools.add_media',
+        'parent' =&gt; 'admin_toolbar_tools.media_add_page',
         'route_parameters' =&gt; ['media_type' =&gt; $type-&gt;id()],
       ];
     }
Use admin_toolbar.

"drupal/admin_toolbar": {
  "Bring back media to dropdown menu": "https://www.drupal.org/files/issues/2019-01-16/admin_toolbar-media_link-3026216-3-option2-D8.patch"
}


Then run composer update or composer update --lock if you want to apply your new patch and do not want to update any packages.