Keyboard shortcut to minimize all windows but the active (focused) one (so called "shake it" action)

Thanks!
Based on your code I came up with this:

#!/bin/bash
# Minimize all but focused window (so called "shake it" action)
active_window_id=$(kdotool getactivewindow)
for window_id in $(kdotool search ".*")
do
    if [ $window_id != $active_window_id ]; then
        kdotool windowminimize $window_id
    fi
done

I also suggested adding a feature to add/remove window to/from windows stack at Multiple commands / stack manipulation · Issue #19 · jinliu/kdotool · GitHub and asked How to assign a keyboard shortcut to kdotool script in a file? · Issue #22 · jinliu/kdotool · GitHub