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

Add shadow blacklist option #29

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@nicklan
Copy link

commented Apr 30, 2012

This adds a -B option that lets you specify window names that should not have shadows draw. Useful for when you have things like launchers that look really back with shadows on them. For example, I use -B synapse to avoid having the synapse window drawn with an ugly shadow.

It uses a hash of the window name to avoid doing strcmps on every draw. There's of course a small risk of collision there, but I figure the trade-off is worth it. The complexity of is_shadow_blacklisted grows linearly in the # of blacklisted windows (I scan the whole array for a match each time). If you're concerned about that, I could switch it to using a proper hashtable with a bit more work, but that felt like overkill at this point.

Regards,

Nick

@nicalpi

This comment has been minimized.

Copy link

commented May 11, 2012

Exactly the option I was looking for! Thanks

richardgv added a commit that referenced this pull request Sep 22, 2012

Feature: Issue #29: Alternative shadow blacklist implementation
- Add shadow blacklist feature, but a different implementation from
  nicklan's. 5 matching modes (exact, starts-with, contains, wildcard,
  PCRE) and 3 matching targets (window name, window class instance,
  window general class). Not extensively tested, bugs to be expected.
  It's slower for exact matching than nicklan's as it uses linear search
  instead of hash table. Also, PCRE's JIT optimization may cause issues
  on PaX kernels.

- Add dependency to libpcre. Could be made optional if we have a
  graceful way to handle that in Makefile.

- Some matching functions are GNU extensions of glibc. So this version
  may have troubles running on platforms not using glibc.

- Fix a bug that access freed memory blocks in set_fade_callcack() and
  check_fade_fin(). valgrind found it out.

- Use WM_CLASS to detect client windows instead of WM_STATE. Some client
  windows (like notification windows) have WM_CLASS but not WM_STATE.

- Mark the extents as damaged if shadow state changed in
  determine_shadow().

- Rewrite wid_get_name(). Code clean-up.

- Two debugging options: DEBUG_WINDATA and DEBUG_WINMATCH.

- As the matching system is ready, it should be rather easy to add other
  kinds of blacklists, like fading blacklist.
@richardgv

This comment has been minimized.

Copy link
Collaborator

commented Sep 22, 2012

I've pushed an alternative shadow blacklist implementation to richardgv-dev branch (0d67243), supporting more features but could be slower on exact matching -- it uses linear search, because there are 4 matching modes and ignore-case flag that make hash table impossible. More info in the commit log. Let chjj decide which one he will pick, or neither. And mine has a very confusing syntax in order to support all the features.

An explanation of the syntax is in the usage() text:

--shadow-exclude condition
  Exclude conditions for shadows.

Format of a condition:

  condition = <target>:<type>[<flags>]:<pattern>

  <target> is one of "n" (window name), "i" (window class
  instance), and "g" (window general class)

  <type> is one of "e" (exact match), "a" (match anywhere),
  "s" (match from start), "w" (wildcard), and "p" (PCRE
  regular expressions, if compiled with the support).

  <flags> could be a series of flags. Currently the only defined
  flag is "i" (ignore case).

  <pattern> is the actual pattern string.

Some examples:

# Don't paint shadow if window name is exactly URxvt
compton -c --shadow-exclude 'n:e:URxvt'

# Don't paint shadow if window general class string starts with
# "Notification", ignore case
compton -c --shadow-exclude 'g:si:Notification'

# Don't paint shadow if window name matches wildcard "*Firefox*"
compton -c --shadow-exclude 'n:w:*Firefox*'

# Don't paint shadow if window instance class string contains "navigator",
# ignore case
compton -c --shadow-exclude 'i:wi:navigator'

# Don't paint shadow if window name matches PCRE regular expression
# "( - )?Mozilla Firefox$", ignore case
compton -c --shadow-exclude 'n:pi:( - )?Mozilla Firefox$'

# Combine them all
compton -c --shadow-exclude 'n:e:URxvt' \
  --shadow-exclude 'g:si:Notification' \
  --shadow-exclude 'n:w:*Firefox*' \
  --shadow-exclude 'i:wi:navigator' \
  --shadow-exclude 'n:pi:( - )?Mozilla Firefox$'

@richardgv richardgv closed this Sep 30, 2012

saulocastelo pushed a commit to saulocastelo/compton that referenced this pull request Jan 9, 2019

Make building the docs optional
Fixes chjj#29

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.