askvity

How do I change the opacity in Picom?

Published in Picom Configuration 3 mins read

To change the opacity (transparency) of windows in Picom, you'll need to modify your picom.conf file. Here's how:

Editing Your picom.conf File

First, locate and open your picom.conf file. It's typically found in one of the following locations:

  • ~/.config/picom/picom.conf
  • ~/.picom.conf

Use a text editor (like nano, vim, or gedit) to open the file.

Using opacity-rule

The most common way to control opacity is by using the opacity-rule option. This allows you to specify different opacity levels for different windows based on their properties.

Syntax

The basic syntax for an opacity rule is:

opacity-rule = [ "OPACITY:CONDITION" ];
  • OPACITY: The desired opacity value, ranging from 0.0 (completely transparent) to 100.0 (fully opaque). You can also specify opacity as a percentage (e.g., "90" for 90%).
  • CONDITION: A condition that must be met for the rule to apply. This condition uses window properties like class_g, name, and focused.

Examples

Here are a few practical examples:

  • Setting Opacity for Focused and Unfocused Terminals (URxvt):

    opacity-rule = [
      "90:class_g = 'URxvt' && focused",
      "60:class_g = 'URxvt' && !focused"
    ];

    This sets the opacity of URxvt terminals to 90% when focused and 60% when unfocused.

  • Setting Opacity for a Specific Application (e.g., Firefox):

    opacity-rule = [ "80:class_g = 'Firefox'" ];

    This sets the opacity of all Firefox windows to 80%.

  • Setting Opacity for Named Window (e.g., a specific terminal):

    opacity-rule = [ "70:name = 'MySpecialTerminal'" ];

    This sets the opacity of window with name 'MySpecialTerminal' to 70%.

Conditions

Some commonly used conditions:

  • class_g = 'ApplicationName' : Matches windows with the specified application name (case-sensitive). You can find the application name using tools like xprop.
  • name = 'WindowTitle' : Matches windows with the specified title (case-sensitive).
  • focused : Matches the currently focused window.
  • !focused : Matches windows that are not focused.

Applying Changes

After making changes to your picom.conf file, you need to reload Picom for the changes to take effect. You can do this by:

  1. Restarting Picom: killall picom && picom &
  2. Using the --reload option (if your Picom version supports it): picom --reload

Other relevant options

Although opacity-rule is the most flexible option, there are also other general opacity settings that may be useful to you, such as:

  • inactive-opacity = 0.8; Changes opacity of inactive windows.
  • active-opacity = 0.9; Changes opacity of active windows.
  • frame-opacity = 0.7; Changes opacity of window frames.
  • menu-opacity = 0.8; Changes opacity of menus.

Remember to choose values between 0.0 and 1.0 for these options.

By carefully crafting your opacity-rule settings, you can achieve the desired transparency effects for different windows in your Picom configuration.

Related Articles