Ultimate get current page’s slug function

There’s no such thing as a single permalink document name. It varies depending on what is being queried. Taxonomy terms use the slug of the term, pages and posts uses the slug of the posts. Post type archives sometimes use the post type name, but they might use something else entirely depending on how it’s registered. Not to mention that date archives and search results don’t have a definitive slug, and the blog may use the slug of another page, or it may be the homepage.

The problem is the premise of your question is incorrect. You mentioned that you have something that “only fire on a specific page, which is the posts listing (archive) page”. But if you want to know if you’re on that page, checking if the slug is ‘news’ is not the correct way to do this, since you’d be hardcoding a value that could change, and if your “ultimate” function existed how would you tell the difference between a blog page named “news” and a category named “news”? The proper approach for this sort of thing is to use the appropriate documented conditional tag. In your case that’s is_home().