- Copy this script line, and add it to a bookmark as the URL paramenter:
javascript:(async function(){try{messageId=document.querySelector('div[data-legacy-message-id]').getAttribute('data-legacy-message-id');user=document.querySelector("[aria-label*='Google Account: ']").attributes["aria-label"].value.match(/[^\(]+@[^\)]+/)[0];await navigator.clipboard.writeText('https://mail.google.com/mail/u/'+user+'/#all/'+messageId)}catch(e){console.error(e)}})()
- Open any email, click the bookmark, and the direct link is copied to your clipboard.
The answer at https://webapps.stackexchange.com/a/97952/147505 suggests that the following may work better if the user is not logged in to Google, or is logged into a different Google account. I haven't tested this. The resulting URL seems less future-proof to me, and therefore seems like less of a permalink. I haven't tested either version in various login situations.
javascript:(async function(){try{messageId=document.querySelector('div[data-legacy-message-id]').getAttribute('data-legacy-message-id');user=document.querySelector("[aria-label*='Google Account: ']").attributes["aria-label"].value.match(/[^\(]+@[^\)]+/)[0];await navigator.clipboard.writeText('https://accounts.google.com/ServiceLogin?service=mail&passive=true&Email='+user+'&continue=https://mail.google.com/mail/u/'+user+'/%23all/'+messageId)}catch(e){console.error(e)}})()