How to insert custom widget in custom sidebar in theme activation?

but we have to change some little things if we want this when theme is activated.Changs maded done inside function awesome_register_sidebars.Add below code inside in your theme functions.php file:

function awesome_register_sidebars() {
      $sidebars = array ( 'a' => 'sidebar-footer-1', 'b' => 'sidebar- footer-2','c'=>'sidebar-footer-3' );
foreach ($sidebars as $sidebar) {
    register_sidebar(
        array (
            'name'          => $sidebar,
            'id'            => $sidebar,
            'before_widget' => '',
            'after_widget'  => ''
        )
    );
}
$active_widgets = get_option('sidebars_widgets');

if (! empty($active_widgets[ $sidebars['a'] ])
    or ! empty($active_widgets[ $sidebars['b'] ])
) {
    return;
}

$counter = 1;
$active_widgets[ $sidebars['a'] ][0] = 'footerlinks_widget-' . $counter;
$demo_widget_content[ $counter ] = array ( 'text' => "This works!\n\nAmazing!" );

$counter++;


$active_widgets[ $sidebars['a'] ][] = 'footerlinks_widget-' . $counter;

$footerlinks_widget_content[ $counter ] = array ();
update_option('widget_footerlinks_widget', $footerlinks_widget_content);

 $counter++;


   update_option('sidebars_widgets', $active_widgets);
 }
add_action( 'widgets_init', 'awesome_register_sidebars' );

tech