[openbox] exit script

Michael Siegel msi at malbolge.net
Thu May 19 15:30:19 EDT 2022


Am Wed, 18 May 2022 13:03:30 -0600
schrieb Dave Serls <dave at dashs.denver.co.us>:

> I'm wondering if there is any approved method of executing a command
> or script when "exit" is the selected action from the main menu.
> I'd like to scan (xlsclients -a) for running tasks and either cleanup
> or abort the "exit".

I use a Bash script that runs `wmctrl` to check for remaining open
windows. If any windows are found, I'll be presented with an xmessage
dialog asking me whether I'd like to quit Openbox anyway (No or Yes).

Choosing "Yes" will simply run `openbox --exit`. The same command will
be run when no open windows were found.

The script is integrated into my Openbox menu as follows:

  <item label="Exit" icon="/path/to/icon.png">
    <action name="Execute">
      <command>/path/to/script</command>
    </action>
  </item>

There's no other way to exit Openbox from my menu.

I would also share the script itself. But, unfortunately, the code is
horrid. Also, simply using `xlsclients` instead of `wmctrl` is probably
the better approach.


msi


More information about the openbox mailing list