When using task switching in the default graphical mode of Ubuntu 12.04, if they are multiple windows of the same kind, eg. multiple Terminal windows, you can see them all together and select which one you want.

enter image description here

My problem is that the order of these windows is constantly changed. It follows the "last used" order. I want them in a fix order always; how can I do it?

  • 3
    Very annoying feature. I asked the same question here askubuntu.com/questions/271506/… but unfortunately still no answer.
    – humkins
    Jul 9 '14 at 14:54
  • 5
    This "issue" exists in 14.04 as well! These windows should really be ordered based on their relative positions on the screen, and desktops, when windows from more than one desktop are previewed. Only when one widow is placed closely on top of another (measured within a certain range of pixels) should the positioning of the preview depend on the "last used" rule. I would even make one more "tweak" to this rule: apply the regional language preferences, of "left-to-right" or "right-to-left" text, to decide which side of the screen is considered "first" -- the left, or the right.
    – PJ Singh
    Nov 4 '14 at 19:43
  • 1
    A possible solution would be to keep the windows in the order they were created, but at least keep them fixed in order. I would prefer a random but stable order over this mess, I feel like I'm constantly juggling screens around.
    – Minos
    Jan 14 '15 at 14:35
  • 1
    I believe this would require changing the unity code. You might start here: unity3d.com/learn/documentation
    – Elder Geek
    Feb 27 '15 at 16:23
  • I'm still having this issue in 2018, version 18.04. Super annoying.
    – Jesbus
    Jun 11 '18 at 14:04

Rather than changing the unity codebase, you might consider using desktops to arrive at your desired result.

Example using Compiz Desktop Cube in CompizConfigSettingsManager

Open CompizConfigSettingsManager (ccsm) and change settings to match the following:



Open terminal 1

Use the keyboard shortcut CTRL-ALT--> (right arrow) to go to the next desktop to the right.

Open terminal 2

Use the keyboard shortcut CTRL-ALT--> (right arrow) to go to the next desktop to the right again.

Open terminal 3

Use the keyboard shortcut CTRL-ALT-<- (left arrow) to go to the previous desktop containing terminal 2 (or twice to get back to terminal 1)

Another Option

Use the Viewport manager in CompizConfig SettingManager and assign a key combination to go directly to the desktop of your choices

Note: Thus far I've only been able to get 10 to work although 12 should be possible with this method. ccsm-3

Update: based on concerns expressed in comments:

Simply Right Click on gedit title bar and choose always on visible workspace...

Another Option:

Rather than opening seperate terminals (or workspaces) for your numerous activities you can also use tabs in gnome terminal. Shortcut keys for tab switching are available from terminal preferences. See below:


  • If I understand correctly this would left me with a need to use a different shortcut or clicky-way to task-switch. Can be done I guess. However how would I clone all the non-terminal windows I need which only normally have 1 instance to all the desktops, when I need or wish that interaction quick and possible between the terminal(s) and the other window(s)?
    – n611x007
    Mar 3 '15 at 19:32
  • How many instances do you need? Using the Viewport manager would give you up to 12. Keyboard activated. Is that "clicky"?
    – Elder Geek
    Mar 3 '15 at 21:09
  • See also askubuntu.com/questions/34572/…
    – Elder Geek
    Mar 3 '15 at 22:11
  • I think I was misunderstandable... Workspaces are enough. Let me try to put it like this. Hypothetical example. Before: 3 terminals, 't1', 't2', 't3', + 1 gedit window. I copy-paste to-and-forth between gedit and both 't1' and 't2'. Task switch order is bad. Aftter (applying your workaround): I have the 3 terminals on 3 workspaces 'w1', 'w2', 'w3' respectively, a gedit window on 'w1'. I need to copy-paste between gedit and both 't1' and 't2'. How do I copy-paste between 't2' and gedit on 'w2' the most comfortable way?
    – n611x007
    Mar 4 '15 at 15:47
  • I've had no issues copying and pasting between workspaces, so I'm not sure exactly what you are asking. Since "the most comfortable way" is a matter of opinion rather than a measurable fact, you have my apologies but I don't think I can respond logically to that.
    – Elder Geek
    Mar 4 '15 at 16:19

Another option, if your desktop is large enough, is to set some windows to "always on top" and arrange them around so that you can switch using the mouse. It's a kludge... but I sometimes find it useful when working with multiple windows of the same type.

Yet another is to define several terminal profiles with different color schemes and use a different one for each terminal... it would make them easy to identify.enter image description here Yeah, this one is a workaround too.


I think that you can achieve this by modifying the source code of Unity 7. Just follow the steps described on the developer site but before starting the building process open: ./trunk/plugins/unityshell/src/unityshell.cpp and take a look at SetUpAndShowSwitcher function:

void UnityScreen::SetUpAndShowSwitcher(switcher::ShowMode show_mode)

  if (!optionGetAltTabBiasViewport())
    if (show_mode == switcher::ShowMode::CURRENT_VIEWPORT)
      show_mode = switcher::ShowMode::ALL;
      show_mode = switcher::ShowMode::CURRENT_VIEWPORT;

  auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT,

  if (switcher_controller_->CanShowSwitcher(results))
    switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, results);

Here you can clearly see that this is exactly the function what we were looking for. The upper part is responsible for the switching of the viewport modes:

Show modes

This toggling appears each time we move into a group of Apps or if we move out of the group. optionGetAltTabBiasViewport indicates when this happens. Then GetAltTabIcons is involved in order to get the right icons. And finally the Show function with the SortMode::FOCUS_ORDER is called to display our sorted icons. SortMode is an enum:

enum class SortMode

and changing FOCUS_ORDER to LAUNCHER_ORDER should solve your problem. You could insert an additional if statement before calling Show to prevent launcher order sorting in ShowMode::ALL case.

Please note that the source code of Unity 8 looks completely different. So this solution may work for Unity 7 only. After half an hour fixing missing dependencies and after another hour fighting with cmake I decided not to ruin my system and try it out in VM tomorrow ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.