What does a window manager do? If I have two overlapping windows and I click on the window behind, the window behind will appear on the front. What is the window manager doing in this scenario?

36 views
0

As a Microsoft Windows user who has no idea about Linux at all, what is a window manager? If I have two overlapping windows and I click on the window behind, the window behind will appear on the front. What is the window manager doing in this scenario?

In: 2

The X window system used in Linux doesn’t really do much by itself–you can define a rectangular area of the screen to use for your application but that’s about it. The job of the window manager is to add the “decorations” onto the window to actually make it usable, so the title bar, buttons, resize widget, all that stuff. This is why different Linux distros will often have different appearances for window title bars and the like.

Window managers under X11 define all the mechanics regarding windows. Eg, what decorations are painted, whether you have and where the “close window” and similar buttons are placed, how windows are laid out, how they’re sized and moved, etc. So for instance a window manager is what decides whether windows snap to each other or not, and whether you have a button for “keep this window on top”

There are [tiling window managers](https://www.tecmint.com/wp-content/uploads/2019/04/herbstluftwm-manual-tiling-window-manager-for-linux.png) that divide the desktop into a grid and enforce no overlap, and window managers that look like a normal Windows-style desktop.

It depends on the implementation actually.

Stacking window managers are Windows-like managers. They allow overlapping. I don’t much about stacking window managers if you want to know about this.

There are also tiling window managers. Windows do not overlap each other. Screen is organized like tiles. You can expand/shrink the size of a tile (*window*). A tile can occupy all the screen also. (For instance I have only Firefox in my screen now.) Tiling window managers generally make use of workspaces. For instance i3wm use Super Key + 1,2,3,4,5,6… keybinding by default to access workspaces. You can use a single workspace to do all things, windows in the workspace will be either tabbed or tiled. But also, you can use workspaces for different purposes. 1 is web browser, 2 is music/video (Spotify, Vlc etc.), 3 is development environment and other tools, 4 is office programs… Workspaces can also have user defined names instead of numbers.

I added two images that shows tabbed and tiled views of two windows in a workspace.

* Tabbed: [https://i.imgur.com/q4Zy8pO.pn](https://i.imgur.com/q4Zy8pO.png)
* Tiled: [https://i.imgur.com/KvJJT7N.png](https://i.imgur.com/KvJJT7N.png)

PS: i3wm have also stacked mode which you can make windows floating. In that mode clicking the behind does not change positions. Again, it depends on the implementation. There are many window managers and this behavior may differ.

Window manager is a program, that controls windows on screen. In your example, the window manager noticed that you’ve clicked on background window and decided to move it to front. Every time you minimize, maximize, resize windows, you are interacting with a window manager. When you press Alt+Tab, it is the window manager who switches the windows.

You may say: “but isn’t that just Windows doing?” Yes, in Windows, window manager is an integral part of an operating system, so you can have only one window manager – the one Microsoft have decided upon. So you don’t usually need to worry about it – until Microsoft suddenly decides that you like Metro, or something similar.

But in Linux this is not so. Window manager is just another program, that you can install and delete. So if you don’t like it, you can scrap it and install another. There are different WMs available: some are classic Windows-like, some are better designed for touchscreen, some can work without mouse, etc.