There is a bug in KDE Activities where windows do not get focused and this requires to press Alt+Tab to switch to the last active window.
I want to count the number of the windows to press only when there is some, I tried
xdotool search --onlyvisible --desktop 2 --name ''
but it gets all the desktops in all the activities, I want to get the desktops in the current activity only
The current desktop number can be found using
You can mix this with your command to find the windows in the current active desktop
Then to get the count by piping the result into
wctool as lines