These items don't have anything to do with the desktop itself, so that's not really the right place for them, making it unlikely that anyone would expect to find them in the desktop context menu.
Instead, these items are probably there as a sort of emergency escape valve so that people can still lock the screen and log out under the following set of circumstances:
- They've accidentally removed their launcher menu or primary panel, or it has gotten lost due to multi-screen arrangement bugs
- ...And they don't know how to perform these actions from KRunner
- ...And they don't know the keyboard shortcuts for these actions
This seems very unlikely, given how we have made it much harder to accidentally remove your panel and its applets over time, how much robustness work we've put into multimonitor workflows, and how we now even have a UI to restore panels that have gotten lost anyway. So having these actions in the context menu specifically to protect against such an unlikely happenstance is therefore not worth it, and we can safely remove them by default (note that users can add them back) to unclutter the context menu and make it more relevant to the desktop itself.
There is no need to handle the now-orphaned menu separator as QMenu takes care of automaticlaly suppressing separators when they are the last item in the menu.
Desktop Context menu now: