5

I want dwm to close all windows gracefully when I press quit hotkey. I like Unity behaviour: it displays list of windows denying logout (for example, editors with unsaved changes) and do not logout before all issues are resolved and applications are closed. By default, dwm just end X session and all running applications are killed.

I was thinking about writing a script that will retrieve list of all windows, gracefully close them and wait for their processes to finish. But I even don't know how to close windows. The only way I know is using wmctrl, and this utility doesn't work with dwm.

1 Answers1

0

You may need to start dwm from within a X11 session manager


Here is one way to do it with Gnome Display Manager (GDM)

Add the following to /usr/share/xsessions/dwm.desktop

 [Desktop Entry]
 Encoding=UTF-8
 Name=dwm
 Comment=This session starts dwm
 Exec=/usr/local/bin/dwm-start
 Type=Application

Create a new file at /usr/local/bin/dwm-start with 755 permissions.

 #!/bin/sh
 # You can add other programs to set the background, add autoloading
 # and add autoload for USB and such here 
 # Make sure you start dwm last as it never returns control to this script
 exec /usr/local/bin/dwm > /dev/null

If GDM is properly configured on your computer, you should see a new dwm entry in the session menu on the log-in screen.

More dwm tweaks, including setup for hibernate/shutdown are here.

Jeremy W
  • 3,659