toggleShowDesktop is a handy Openbox action which currently is not implemented in Labwc yet.
Usually bound to W-d
or/and optionally to mouse left-click on desktop.
Replacement script for Labwc using wlrctl utility.
toggleShowDesktop
:
#!/bin/bash
# toggleShowDesktop - Openbox's missing action for Labwc
CACHE_FILE="$HOME/.cache/.tsd"
# If any window is unminimized
if wlrctl window find state:unminimized; then
# fill CACHE_FILE with unminimized windows list
wlrctl window list state:unminimized > $CACHE_FILE
# minimize all unminimized
wlrctl window minimize state:unminimized
else # no unminimized windows: read list and unminimize (focus) all
while IFS=':' read -r app_id title; do
wlrctl window focus app_id:$app_id state:minimized
done < "$CACHE_FILE"
> "$CACHE_FILE"
fi
rc.xml
Keybind:
<keybind key="W-d">
<action name="Execute" command="toggleShowDesktop"/>
</keybind>
Optional mouse bind for left click on Desktop action.
Put it into <context name="Root">
section:
<mousebind button="Left" action="Press">
<action name="Execute" command="toggleShowDesktop"/>
</mousebind>