23

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?

n611x007
  • 555
  • 3
    Very annoying feature. I asked the same question here http://askubuntu.com/questions/271506/how-to-disable-application-window-previews-rotation-in-unity-3d but unfortunately still no answer. – humkins Jul 09 '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. – Enterprise Nov 04 '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: http://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
  • same issue in 18.10, I HATE IT, worst feature ever – Hyperplane Jan 09 '19 at 15:18

3 Answers3

2

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:

ccsm-1

ccsm-2

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:

terminal-prefs

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • 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 03 '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 03 '15 at 21:09
  • See also http://askubuntu.com/questions/34572/how-can-i-reduce-or-increase-the-number-of-workspaces-in-unity – Elder Geek Mar 03 '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 04 '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 04 '15 at 16:19
  • I see, please s/copy-paste/task-switch/g. I'm trying to ask that if gedit is on 'w1' and 'w1' only it is then missing from 'w2' thus going from 't2' that is on 'w2' to 'w1' just to task-switch to gedit isn't that uncomfortable in terms of more than a single key-combination? – n611x007 Mar 04 '15 at 16:50
  • @n611x007 Perhaps the "Another Option" I added to my answer will suit your workflow better. – Elder Geek Dec 15 '15 at 19:51
  • well the question uses terminals as an example. if it has tabs it's great however if a program doesn't have tabs, then only the original workaround can be used. thanks for the option though. – n611x007 Dec 17 '15 at 17:45
  • Tabs are a good solution in my opinion, it should have been the default. For other apps, too bad. The way Unity handles multiple windows of the same type is a pain in the neck. Even MS does it better. – laugh salutes Monica C Dec 20 '15 at 20:32
  • @laugh Most of my commonly used apps have tabs anyway. My wife still uses MS and I think that's the bigger pain. To each their own. – Elder Geek Dec 21 '15 at 22:45
1

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.

1

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)
{
  RaiseInputWindows();

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

  auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT,
                                                      switcher_controller_->show_desktop_disabled());

  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
{
  LAUNCHER_ORDER,
  FOCUS_ORDER,
};

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 ;)