The somewhat narrower Manchin-Toomey bill would extend background checks to all commercial sales, including those at gun shows and over the internet. But that bill has fallen twice to a Senate filibuster, once in 2013 and once in 2015. Only two Republicans who have previously voted in favor of it — Mr. Toomey and Senator Susan Collins of Maine — remain in the Senate today.

Despite those obstacles, the political landscape around gun safety does appear to be changing. The N.R.A. is in a weakened state, mired in internal conflict and facing investigations into possible abuse of its tax-exempt status. The gun safety movement is ascendant, fueled by student activism in the wake of last year’s mass shooting at Marjory Stoneman Douglas High School in Parkland, Fla.

And several newly elected Republicans, including Senators Mitt Romney of Utah and Mike Braun of Indiana, have called for expanded background checks in the wake of the summer shootings. Senator Lindsey Graham, Republican of South Carolina and a close ally of the president, is supporting a different type of gun safety legislation known as a “red flag” bill, and has warned Mr. Trump it was untenable to tell the public there was nothing he could do, “because the shootings are going to keep coming.”

Ms. Collins, who said she has been in frequent contact with the president’s advisers though not Mr. Trump himself, said he is convinced that “there are a lot of responsible, common sense gun safety provisions that could be bundled together that we could pass.”

But both Republicans and Democrats agree that nothing will pass without Mr. Trump’s support. The president is said to be reviewing a package of ideas presented to him by White House advisers. But he is keeping his views to himself, and his earlier public statements have been all over the map, in keeping with his history of flip-flops on the gun issue.

At first, after back-to-back massacres in El Paso and Dayton in early August, Mr. Trump said there was “tremendous” support for “really common-sense sensible, important background checks” and bragged that he could overcome the longstanding Washington gridlock on the issue.

“There’s never been a president like President Trump,” he said then.

“At that point, he was positively over the moon about background checks,” said Mr. Murphy, who sponsors the Senate version of the House background checks bill.