Would you like certain types of windows, such as menus and console windows, to be translucent? Do you want your system monitoring program or IM contact list to be visible on all desktops by default? Does it bother you when a new browser window opens that is too tiny or too large?
You can set rules that tell windows to be translucent, sticky, stay on top, a certain size, and so on whenever they open. This guide provides information that will hopefully help you get started on writing rules to make your windows look and behave the way you want.
The information in this guide assumes that you have the Regex Matching plugin enabled. If you don't, please enable it before reading further.
Contents
Identifying a Window
Before anything about opacity or window rules can be set, you need to know how to tell Compiz which windows to apply the rules to.
There are 8 different ways to make Compiz recognise a window. Each of these ways is listed below, along with commands that can be entered into a console to help you find the information you need to use them.
type: What kind of window is it? A menu, a dialog, a tooltip, or something else?
Command: xprop _NET_WM_WINDOW_TYPE | cut -d_ -f10
- Or choose one: unknown, combo, desktop, dialog, dnd, dock, dropdownmenu, fullscreen, modaldialog, menu, normal, notification, popupmenu, splash, toolbar, tooltip, utility
role: What is the window's role? (Only useful for some programs. Usually blank.)
Command: xprop WM_WINDOW_ROLE | cut -d\" -f2
name: What is the window's class name?
Command: xprop WM_CLASS | cut -d\" -f2
class: What is the window's class?
Command: xprop WM_CLASS | cut -d\" -f4
title: What is written in the window's title bar?
Command: xprop WM_NAME | cut -d\" -f2
xid: What is the window's XID? (Only useful for identifying a window that's already open.)
Command: xwininfo | grep "Window id:" | cut -d ' ' -f4
state: Is the window maximised, staying on top, sticky, or something else?
- Choose one: modal, sticky, maxvert, maxhorz, shaded, skiptaskbar, skippager, hidden, fullscreen, above, below, or demandsattention
override_redirect - This attribute is used differently by different programs. Please refer to Identifying a Window: Special Cases, below.
A window can be identified by a string of the form:
criterion=value
For example, this will match pop-up menus:
type=popupmenu
There is no space before or after the = sign!
More than one criterion can be specified by using a | symbol, which means "or", and a & symbol, which means "and". So this example will match either drop-down menus or pop-up menus:
type=dropdownmenu | type=popupmenu
You can also prefix a criterion with a ! symbol to make it a "not" condition. For example, this will match any window that is not a dialog:
!type=dialog
You can combine different kinds of criteria, too. For example, this will match a window whose title bar caption ends in "Konsole", but only if it's not a dialog window:
title=Konsole$ & !type=dialog
What's the $ doing at the end of Konsole$? It's a regular expression that means "ends with Konsole". ^Adobe Reader is the opposite, meaning "begins with Adobe Reader". ^MPlayer$ means "exactly MPlayer", with nothing before or after it. If you just put Konsole, then the rule would match any window with the word "Konsole" in its title bar caption.
You can group multiple sets of criteria together with ( and ). This will match dialog windows with either "About" or "Configure" in their title bar caption:
type=dialog & (title=About | title=Configure)
If you don't specify a criterion but only a value, then it's assumed that you mean to match by type. For example, the following two lines have the same effect:
dropdownmenu | popupmenu | tooltip | unknown type=dropdownmenu | type=popupmenu | type=tooltip | type=unknown
Finally, there is an any keyword will match every window. This keyword is helpful in situations where you want to match all kinds of windows. Inversely, to match no windows, you can simply clear the match field. For example, focus stealing prevention can be disabled by clearing Focus Prevention Windows window match rule in General Options.
Special Cases
It would be nice if every window belonging to every program identified themselves consistently, but that's not how things actually work. Different programs use different criteria differently, and some of them are very strange exceptions indeed!
Menus, pop-up menus, and drop-down menus are not the same thing. Programs based on Gtk+, for example, use
type=popupmenu
to describe only the context menus that pop up when you right-click and
type=dropdownmenu
to describe only the menus that drop down from a program's menu bar!
The Workarounds plugin fixes most of the following issues automatically.
KDE's menus, tooltips, combo boxes, drag-and-drop icons, and almost anything that isn't a normal window can be matched with this: type=unknown
Firefox and Thunderbird's menus, tooltips, and most other things that aren't normal windows can be matched with this: (class=Firefox-bin | class=Thunderbird-bin) & override_redirect=1
Java windows are all type unknown. Fortunately, they can be distinguished by their class name:
name=sun-awt-X11-XFramePeer for normal Java windows
name=sun-awt-X11-XWindowPeer for Java menus and tooltips
name=sun-awt-X11-XDialogPeer for Java dialog (sub-)windows
Window Opacity
Setting default opacity (translucency) values for different kinds of windows involves editing some options in the CompizConfig Settings Manager. Run ccsm, then click on the item labelled General Options near the top-left corner of the list of plugins. From there, switch to the Opacity Settings tab.
Opacity values and the windows they apply to are listed side-by-side:
|
Clicking either the Add or Edit button allows you to enter a window matching rule and an opacity value in the same dialog:
|
Window Rules |
|
Category |
|
Window Rules
In the Window Rules plugin, you will find 13 attributes that can be applied to any window that match the rules (see Identifying a Window, above).
Here's a short description of each attribute:
Skip taskbar |
These windows will not show up on the task bar (the list of buttons you click on to switch between open windows). |
Skip pager |
These windows will not show up on the desktop pager (the applet you click on to switch to desktops/workspaces/viewports). |
Above |
These windows will always cover other windows, even when inactive. |
Below |
These windows will always be covered by other windows even when active. |
Sticky |
These windows are visible on every desktop/workspace/viewport at once. |
Fullscreen |
These windows will fill the whole screen, leaving no room for docks or borders. |
No ARGB visuals |
These windows will be treated as having no alpha channel. This is useful for some broken legacy applications (such as EagleCAD), which might be always transparent and thus unusable otherwise. |
Non movable windows |
These windows can't be moved. |
Non resizable windows |
These windows can't be resized. |
Non minimizable |
These windows can't be minimized. |
Non maximizable windows |
These windows can't be maximized. |
Non closable windows |
These windows can't be closed (but you can still quit the programs they belong to). |
No focus |
These windows will never be the active window. |
The last two attributes, Height and Width, are a little different. Fixed Size Windows. Windows, widths, and heights are displayed side by side:
|
So if the first row in the Sized windows column says "!title=^About & title=Firefox$ & !override_redirect=1", the first row in the Height column says "800", the first row in the Width column says "600", then new Firefox browser windows will always be created with the size 800x600.
Clicking on either the Add or Edit button allows you to set matching rules and sizes in the same window:
|
Other Plugins Requiring Window Matching Rules
Many other plugins, such as the Blur, ADD helper, Widgets, and Reflection plugins require a window matching rule to tell them about the windows to which their effects should apply.
In the Blur plugin's case, for example, entering
type=dropdownmenu
into the Alpha blur windows field will cause only dropdown menus to be blurred.