Inspired by Pineau's answer, I found a dirty trick to get it done: keep Alt+` for switching between application windows in one viewport, and (for example) Alt+1 to switch between application windows on all viewports.
Minor cosmetic downside is that the responsiveness is a little less accurate, since the settings need a fraction of a second to change. In Practice however, you will hardly notice.
install xdotool
:
sudo apt-get install xdotool
Copy the following scipt into an empty file and save it as switch.sh
#!/bin/bash
dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-bias-viewport false
sleep 0.2
xdotool keydown alt key 0x60
dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-bias-viewport true
sleep 1
set a key combination to run the script: System Preferences > Keyboard > Shortcuts > Custom Shortcuts
. I choose Alt+1, since it is close to the other one.
Now you can use either Alt+1 to switch between all windows of (for example) gedit:

or Alt+` to switch between gedit windows of only the currect workspace:

note:
In the script, the key above the Tab is set to key 0x60
. This might be different on other lauyouts. In case it won't work, run in a terminal xev
, then press Return, then the key above tab. In the output, look for a string like (keysym 0x60, grave)
. The keysym value is the value you need in the (script-) line:
xdotool keydown alt key 0x60
The values of sleep 0.2
and sleep 1
make the script work fine on my system, but they might be subject to optimization for faster systems (reduce).
More options
Similarly, you can set a key combination to switch between all application windows on all viewports the script would then be:
#!/bin/bash
dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-bias-viewport false
sleep 0.2
xdotool keydown alt key 0xff09
dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-bias-viewport true
sleep 1
If you set for example Alt+Q for this, you have nice set of all options:
Alt+` Switch between current application's windows on current viewport
Alt+1 Switch between current application's windows on all viewports
Alt+Tab Switch between all application windows on current viewport
Alt+Q Switch between all application windows on all viewports

Alt+Tab : Switch between all application windows on current viewport

Alt+Q: Switch between all application windows on all viewports