My comments apply to my setup which is the Bullseye Raspberry OS as downloaded from the Libre repository maybe a couple of weeks ago (2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img.xz — with output from
uname -a as “6.0.12-00858-gb98721ea4575 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 19:08:19 UTC 2022 aarch64 GNU/Linux”) and with the default desktop environment (Pixel, I believe) and window manager (Openbox, I believe) for that install.
What I am also seeing is that, as observed by the OP, if I use the Shutdown option from the GUI I get a reboot.
It looks like this button in the GUI invokes a program called lxde-pi-shutdown-helper to get that menu. As far as I could tell, short of getting dirty and recompiling things, there may be no way to change some configuration item somewhere to have it execute shutdown -H instead of whatever lxde-pi-shutdown-helper is executing? Or maybe I am just missing something very obvious?
So we could provide a different quit session command and edit the entry appropriately at ~/.config/lxpanel/LXDE-pi/config to reflect this?
The tkinter library is supposed to be pretty easy to use but I just “figured it out” by copying (and slightly modifying) the code from Lubuntu 17.10 - Removing suspend, switch user, lock screen options from "Shutdown" Launcher - Ask Ubuntu .
So here are my directions.
First, to create a backup, run:
cp ~/.config/lxpanel/LXDE-pi/config ~/.config/lxpanel/LXDE-pi/config.bak
Then, create a file and call it session-logout-hack.py (use nano, mousepad, or whatever pleases you) and make the contents look as follows:
from tkinter import *
window = Tk()
B1 = Button(window, text = "Shutdown", command = lambda: os.system('shutdown -H now'))
B2 = Button(window, text = "Reboot", command = lambda: os.system('reboot'))
B3 = Button(window, text = "Logout", command = lambda: os.system('pkill -SIGTERM -f lxsession'))
B4 = Button(window, text = "LXDE shutdown menu", command = lambda: os.system('lxde-logout'))
B5 = Button(window, text = "Quit", command = lambda: quit())
Then save it and move it to somewhere in the path like:
sudo mv session-logout-hack.pi /usr/bin/
Then copy the permissions of lxde-pi-shutdown-helper with
sudo chmod --reference=/usr/bin/lxde-pi-shutdown-helper /usr/bin/session-logout-hack.py
Then edit ~/.config/lxpanel/LXDE-pi/config to read as follows:
Now log out of the session or reboot & it should be presenting you with a menu that will have a shutdown option that actually halts the Le Potato.
Note that the logout option will logout all active lxde sessions which is probably undesirable. Because of this, I added an option that invokes a the LXDL logout/shutdown menu. It has the same problem with halt but at least it can log out only your active session.
Logging out only your active session is probably very easy (I just haven’t found the answer); but it could also be the sort of thing that requires getting a session ID and using it in some way to log out of that session only. In either case, once you figure out that part, the Python code additions should be trivial.
If you can figure out how to logout only the current session, please reply to my comment and add to my answer (or you if find that everything I did was a waste of effort because there are much, much simpler ways of achieving what we want, that would be even better).