“A long time, for sure,” he said, when asked how long his surgery could prolong his life. “Some folks live for a decade or more. A.L.S. is a death sentence, but no one gives you an expiration date. Which is scary.”

It was in a villa in Italy, where he and Ms. King were on vacation in late 2017 and when he could still walk and type, where Mr. Barkan started writing his book. He typed the first two chapters himself, dictated the rest and worked on edits with the same technology he now uses to communicate — by using his eyes to hover over letters and words like a cursor on a Microsoft tablet. (To interview Mr. Barkan requires submitting questions in advance so he can consider his responses and upload the answers, which are read by a computerized voice.)

The book, as much as anything, he said, is an inheritance for his son, Carl, and his daughter who is due in November.

“I hope someday Carl and his sister read it and feel proud of me,” he said. “In large part, I wrote it for them to remember me by.”

Sign up for On Politics to get the latest election and politics news and insights. Sign up for our politics newsletter

Before getting sick, Mr. Barkan was skilled in the art of garnering publicity for an issue. He came to national attention in 2014 by bringing a group of activists to Jackson Hole, Wyo., where Federal Reserve governors were holding their annual gathering. Since then, he has very deliberately decided to use his disease to attract attention to his progressive causes. He has turned to civil disobedience, and was arrested several times at protests in Washington the last few years.

One early confrontation was with Mr. Flake, in December 2017, over the Republican tax bill, which Mr. Barkan was speaking out against because he believed it could lead to steep cuts in social services like health care. “You can save my life,” Mr. Barkan told Mr. Flake, who was then an Arizona senator. “Remember this conversation.” (Mr. Flake voted for the bill, but the episode, on video, became a sensation.)