# toggleShowDesktop for Labwc

**URL:** https://forum.maboxlinux.org/t/toggleshowdesktop-for-labwc/2143
**Category:** labwc-contrib
**Created:** [January 6, 2025, 1:59pm UTC](https://forum.maboxlinux.org/t/toggleshowdesktop-for-labwc/2143 "2025-01-06T13:59:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![napcok](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/napcok/32/410_2.png) [@napcok](https://forum.maboxlinux.org/u/napcok)
#### Post date: [January 6, 2025, 1:59pm UTC](https://forum.maboxlinux.org/t/toggleshowdesktop-for-labwc/2143/1 "2025-01-06T13:59:33Z")

</div>

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](https://git.sr.ht/~brocellous/wlrctl) utility.  
`toggleShowDesktop`:

```auto
#!/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:

```auto
<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:

```auto
<mousebind button="Left" action="Press">
      <action name="Execute" command="toggleShowDesktop"/>
</mousebind>

```

---

<div class="post-metadata">

### Author: ![muzqs](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/muzqs/32/3702_2.png) [@muzqs](https://forum.maboxlinux.org/u/muzqs)
#### Post date: [January 10, 2025, 1:27pm UTC](https://forum.maboxlinux.org/t/toggleshowdesktop-for-labwc/2143/2 "2025-01-10T13:27:39Z")

</div>

#### The toggle desktop and runraise (hide) scripts are really nice. 🙂

Note.  
_Still have to fill in full path to ~/bin._  
_Thats fine, now knowing._

Copied the dot files to my laptop and it runs nice.  
Fast response. Even with gif anim as background.

🐦

---

<div class="post-metadata">

### Author: ![napcok](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/napcok/32/410_2.png) [@napcok](https://forum.maboxlinux.org/u/napcok)
#### Post date: [January 10, 2025, 1:37pm UTC](https://forum.maboxlinux.org/t/toggleshowdesktop-for-labwc/2143/3 "2025-01-10T13:37:10Z")

</div>

Only small drawback… sometimes it changes windows stacking order. No big deal.  
Anyway, it’s good to have it until it’s implemented natively in Labwc.  
Here is open [issue](https://github.com/labwc/labwc/issues/2293#issuecomment-2572971261) for it on Labwc github.
