Add 'Sleep', 'Restart', and 'Shutdown' menu items to the Special menu
morgant opened this issue · comments
Currently, the Special > Restart menu item just calls the built-in Restart
function as Restart mlvwm
, which will cause mlvwm
to reload its configuration, not actually restart the computer. In my local environment (OpenBSD amd64/7.3-stable), I have moved the Action Restart mlvwm
to Special > Start sub-menu as "Restart mlvwm" (current mlvwmrc
doesn't have an 'mlvwm' option under Special > Start):
Menu restart-sub
"Start fvwm" Action Restart fvwm
"Restart mlvwm" Action Restart mlvwm
END
Additionally, I have implemented Special > Restart and Special > Shutdown by adding my user to the operator
group (though with -current and 7.4, one now needs to be in the _shutdown
group and executing shutdown -r now
and shutdown -p now
, respectively:
"Restart" Action Exec "reboot" exec shutdown -r now
"Shut Down" Action Exec "shutdown" exec shutdown -p now
Naturally, platforms differ as to which options are required for shutdown
to perform the appropriate action, so I suggest moving this to new bin/mlvwm-powerdown
script which takes accepts the following options:
-s
for suspend/sleep-r
for reboot-p
for power off
That script can then be a wrapper providing OS-appropriate implementation.
Note: I don't currently have a Special > Sleep implementation, but on OpenBSD apm -z
or zzz
can be used to initiate deep sleep (as opposed to hibernation, apm -Z
or ZZZ
, which writes memory contents to disk and powers down), if apmd
is running. One could presumably either use rcctl
(preferred) or pgrep
to determine if apmd
is running.
See also: Issue #9 regarding adding a Special > Log Out menu item.
I have implemented, but not yet committed the updated Special > Sleep|Restart|Shutdown menu items with a new bin/mlvwm-powerdown
script. I've implemented -s
/-r
/-p
for OpenBSD, plus -r
/-p
for FreeBSD & Linux. I have to do some testing, then I'll commit and we can add support for further OSes in the future.
I've now tested & committed the new mlvwm-powerdown
script, plus added a make install-bin
target (included in make install
, of course) which will install the various mlvwm-*
scripts into ~/bin/
.