I will describe a workaround that works for me on my playground Manjaro machine with GNOME3/Wayland. Keep in mind that the process may slightly differ on other distributions.
It is not as perfect as I imagined, but it works.
In this method, I will use ydotool. From README.md:
ydotool works differently from xdotool. xdotool sends X events
directly to X server, while ydotool uses the uinput framework of Linux
kernel to emulate an input device.
- Install it accordingly to your distribution - AUR, Ubuntu, Debian, etc...
- You may need to properly set access rights for
/dev/uinput and allow the user to access this device. In this case, add a user to the
users group and create udev rules file:
Add yourself to users group:
usermod -a -G users $USER
/etc/udev/rules.d/80-uinput.rules file with following content:
KERNEL=="uinput", GROUP="users", MODE="0660", OPTIONS+="static_node=uinput"
You need to start
/usr/bin/ydotoold socket listener. For testing purposes start in manually, but you probably want to autostart this on login.
GNOME 3 allows you to set a keyboard shortcut to "Hide all normal windows". Go to the
gnome-control-center, Keyboard Shortcuts, Navigation, Hide all normal windows. Set this shortcut, for example, to Super + D.
Now, if everything works as expected, you should be able to minimise all GNOME/Wayland windows with the following command:
ydotool key Super+D
Another method could be to use wtype. It seems to use a different approach and provides keyboard events directly to the compositor. The problem is I was not able to make this work with GNOME's default compositor mutter. It may be related to the limitations of XWayland but I'm not sure about this. All I get is the error:
Compositor does not support the virtual keyboard protocol