Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache _NET_WM_STATE property and add rule target wm_state #549

Open
wants to merge 3 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions man/picom.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ With greater-than/less-than operators it looks like:

'NEGATION' (optional) is one or more exclamation marks;

'TARGET' is either a predefined target name, or the name of a window property to match. Supported predefined targets are `id`, `x`, `y`, `x2` (x + widthb), `y2`, `width`, `height`, `widthb` (width + 2 * `border_width`), `heightb`, `override_redirect`, `argb` (whether the window has an ARGB visual), `focused`, `wmwin` (whether the window looks like a WM window, i.e. has no child window with `WM_STATE` and is not override-redirected), `bounding_shaped`, `rounded_corners` (requires *--detect-rounded-corners*), `client` (ID of client window), `window_type` (window type in string), `leader` (ID of window leader), `name`, `class_g` (= `WM_CLASS[1]`), `class_i` (= `WM_CLASS[0]`), and `role`.
'TARGET' is either a predefined target name, or the name of a window property to match. Supported predefined targets are `id`, `x`, `y`, `x2` (`x` + `widthb`), `y2` (like `x2`), `width`, `height`, `widthb` (`width` + 2 * `border_width`), `heightb` (like `widthb`), `border_width`, `fullscreen`, `override_redirect`, `argb` (whether the window has an ARGB visual), `focused`, `wmwin` (whether the window looks like a WM window, i.e. has no child window with `WM_STATE` and is not override-redirected), `bounding_shaped`, `rounded_corners` (requires *--detect-rounded-corners*), `client` (ID of client window), `window_type` (window type in string), `leader` (ID of window leader), `name`, `class_g` (= `WM_CLASS[1]`), `class_i` (= `WM_CLASS[0]`), `role`, and `wm_state` (window manager state hint in string).

'CLIENT/FRAME' is a single `@` if the window attribute should be be looked up on client window, nothing if on frame window;

'INDEX' (optional) is the index number of the property to look up. For example, `[2]` means look at the third value in the property. Do not specify it for predefined targets.
'INDEX' (optional) is the index number of the property to look up. For example, `[2]` means look at the third value in the property. If not specified, matching is performed against all available property values using logical OR. Do not specify it for predefined targets.

'FORMAT' (optional) specifies the format of the property, 8, 16, or 32. On absence we use format X reports. Do not specify it for predefined or string targets.

Expand Down Expand Up @@ -307,6 +307,9 @@ Examples:
# If the window is a menu
window_type *= "menu"
_NET_WM_WINDOW_TYPE@:a *= "MENU"
# If the window is marked hidden
wm_state *= "hidden"
_NET_WM_STATE@:a *= "HIDDEN"
# If the window name contains "Firefox", ignore case
name *?= "Firefox"
_NET_WM_NAME@:s *?= "Firefox"
Expand Down
22 changes: 17 additions & 5 deletions src/atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <xcb/xcb.h>

#include "meta.h"
#include "cache.h"
#include "meta.h"

// clang-format off
// Splitted into 2 lists because of the limitation of our macros
Expand All @@ -23,9 +23,7 @@
WM_CLIENT_MACHINE, \
_NET_ACTIVE_WINDOW, \
_COMPTON_SHADOW, \
_NET_WM_WINDOW_TYPE

#define ATOM_LIST2 \
_NET_WM_WINDOW_TYPE, \
_NET_WM_WINDOW_TYPE_DESKTOP, \
_NET_WM_WINDOW_TYPE_DOCK, \
_NET_WM_WINDOW_TYPE_TOOLBAR, \
Expand All @@ -39,9 +37,23 @@
_NET_WM_WINDOW_TYPE_TOOLTIP, \
_NET_WM_WINDOW_TYPE_NOTIFICATION, \
_NET_WM_WINDOW_TYPE_COMBO, \
_NET_WM_WINDOW_TYPE_DND, \
_NET_WM_WINDOW_TYPE_DND

#define ATOM_LIST2 \
_NET_WM_STATE, \
_NET_WM_STATE_MODAL, \
_NET_WM_STATE_STICKY, \
_NET_WM_STATE_MAXIMIZED_VERT, \
_NET_WM_STATE_MAXIMIZED_HORZ, \
_NET_WM_STATE_SHADED, \
_NET_WM_STATE_SKIP_TASKBAR, \
_NET_WM_STATE_SKIP_PAGER, \
_NET_WM_STATE_HIDDEN, \
_NET_WM_STATE_FULLSCREEN, \
_NET_WM_STATE_ABOVE, \
_NET_WM_STATE_BELOW, \
_NET_WM_STATE_DEMANDS_ATTENTION, \
_NET_WM_STATE_FOCUSED, \
_NET_WM_BYPASS_COMPOSITOR, \
UTF8_STRING, \
C_STRING
Expand Down
Loading