Make windows without focus transparent

Hi I’m searching for a while, but i didn’t find anything usable…

I want to make Windows, they are not focused, transparent, and the window with focux opaque.

So i think FvwmEvent is my choice.

I’ve installed xcompmgr and tansset from Debian wheezy.

I tell FvwmEvent to call a Function on focus_change:

*FvwmEvent: Cmd Function *FvwmEvent: focus_change "TransparencyChangeFocus"

And this function is:

I tried a lot of couples… but I don’t understand how to do this. It seems, that the changing of transparency follows the mood of my girlfriend and not the windows getting or losing focus…

Please be patient, and give me a hint.

scientific

  • I just tried your code with my fvwm-2.6.5 and it doesn’t work for me, either. Did a bit debugging and I found: 1) “Next (!Focused)” almost always incorrectly matches the newly focused window somehow here, but seemingly in rare cases it matches other windows? 2) “All (!Focused) Exec … $[w.id]” doesn’t expand $[w.id] in the desired way.
    The code I use to test is:
DestroyFunc TransparencyChangeFocus
AddToFunc TransparencyChangeFocus
+ I Next (!Focused) PipeRead "(echo -n nofocused; xwininfo -id $[w.id] | grep '^xwininfo') >> /tmp/log"
+ I Current PipeRead "(echo -n focused; xwininfo -id $[w.id] | grep '^xwininfo') >> /tmp/log"

My time is extremely limited today, so I did only a brief test and could be wrong. (I usually would have looked into fvwm source code to figure out what’s wrong.)

  • As a quick and dirty solution, you may wish to choose a X compositor that has this feature built-in. I remember Compiz (which of course can’t work with fvwm) and compton both have the feature. In compton it’s the -i option that enables default opacity on inactive windows (e.g. “-i 0.75”). (This doesn’t sound like advertisement, right? :slight_smile: )

Oh Thanks!

BUT… I have SloppyFocus. Maybe this is the Problem. I get each Window twice in the Log:

nofocusedxwininfo: Window id: 0x1e0001e "jakob@pluto: ~"
focusedxwininfo: Window id: 0x1e0001e "jakob@pluto: ~"
nofocusedxwininfo: Window id: 0x1e0001e "jakob@pluto: ~"
focusedxwininfo: Window id: 0x1e0001e "jakob@pluto: ~"

This Window got the focus. All 4 entries are the same window :-/

So the Events doesn’t work correctly changing the transparenzy at all…

Maybe i’ll try compton… :slight_smile:
Later…

scientific

Ok. I Found the solution. But now I’m not happy… :frowning:

And

If there are 2 windows on one screen, it works perfectly (also with SloppyFocus).
But if there are 3 or more windows… not. The change of the focus and transparency is alway between two of them. if the 3rd window is between (layer), it stays opaque.

So i think i have to look for a solution, working with layers…

Do you have an idea?

scientific

Ok, what i found out in case of Layers… it’s not all.
How can i find out the vertical order of the windows?

What i want:
If a Window is on top (i have SloppyFocus and Windows only raise, if i click to the borders or titlebar), there is no need for any tranparency.
But if i want to copy something from a window behind, ALL windows ABOVE this window should get transparency, so i don’t have to bring it up, to see what i’m copying.

I don’t know how to code this. But i think something similar like:
All (vertical_order > $[w.id]) transset 0.5

Is there a possibility?

scientific

So i installed compton.

Thats nice :slight_smile: Thanx.

BUT… How can i give spezial Windows (i.e. FvwmButton, Menus in Fvwm…) another transparency (for example 1) when default-transparency is 0.55?

the -m 1 option doesn’ work for the menus. and the windowlist is also transparent. even the dropdown in url-field in chromuim. :-/
AND i have root-tail to put some logfiles to the root-window. But the output of the logs is above ALL other windows, when it changes. And this is often… :-/

[edit]
I found: http://bbs.archbang.org/viewtopic.php?id=4265

But the difference ist use compton --config /path/to/configfile

Now it works correctly on Menus, Dropdown in url-field from chromium and menus.

Only root-tail doesn’t work correctly.

[/edit]

scientific

It’s rare that Thomas Adam didn’t come up in time…

I’m using SloppyFocus as well. Not sure if it has something to do with the problem.

If you are still seeking a solution with FvwmEvents, I would recommend you to query the currently focused window via:

xdpyinfo | grep focus

Instead of relying on fvwm’s functionality. You could dump the last focused window ID to a temporary file to avoid calling transset on all inactive windows on focus change.

It isn’t as simple as what you thought, I’m afraid. compton relies on _NET_WM_WINDOW_TYPE to determine window type and fvwm isn’t setting this property correctly on its windows. Nor does Chromium. As a quick and dirty workaround:

compton -i 0.5 --mark-wmwin-focused --mark-ovredir-focused

This depends on how your “root-tail” is implemented – I didn’t find a software named “root-tile”. But there’s one thing: There must be only one application painting to the root window. compton paints to root window either directly or indirectly (–paint-on-overlay), so once there’s another application trying to paint on root window, they will start interfering, and it’s basically ruined. (Pablo Picasso and Vincent van Gogh are both great artists, but imagine them painting two different pictures on the same canvas at the same spot!) If that is the case, you may wish to change its design to paint on an overlay window instead.

Typically:

xwininfo -tree -root

The windows are listed from highest to lowest.

Should be possible with a shell script parsing xwininfo and xdpyinfo’s output and calling transset, but it might be more suitable to use Python + xpyb for this kind of complicated tasks.

Please read my reply above firstly.

Yes, that configuration file has “mark-wmwin-focused” and “mark-ovredir-focused” enabled.

I’ve explained why it may fail in my previous reply.

So now i’m happy with compton.

:slight_smile:

BUT… (there’s always a but)

Libre-Office gets really slow, when compton is on. Scrolling around in Option-Menus from Forms, oder in Output-Lists froms Base… Totally Slow… Okay, maybe this is an Issue of Libre/Openoffice… This was slow before compton. But with compton… deadly slow. :-/

And the thing i want really to get fixed:
I use nedit as my preferred editor. The same is also with Libreoffice:

If i open a search-window, the search-window never becomes transparent, but the main-window is transparent, while the search-window has focus. I need this the other way round. The main-window shouldn’t get transparent, while the search-window has focus, and the searchwindow should get transparent, while the main-window has focus. (so i can see search-results hidden by the searchwindow itself).

This is my compton-config. What to change? How?

[code]# Shadow
shadow = true; # Enabled client-side shadows on windows.
no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
no-dnd-shadow = true; # Don’t draw shadows on DND windows.
clear-shadow = true; # Zero the part of the shadow’s mask behind the window (experimental).
shadow-radius = 7; # The blur radius for shadows. (default 12)
shadow-offset-x = -7; # The left offset for shadows. (default -15)
shadow-offset-y = -7; # The top offset for shadows. (default -15)

shadow-opacity = 0.7; # The translucency for shadows. (default .75)

shadow-red = 0.0; # Red color value of shadow. (0.0 - 1.0, defaults to 0)

shadow-green = 0.0; # Green color value of shadow. (0.0 - 1.0, defaults to 0)

shadow-blue = 0.0; # Blue color value of shadow. (0.0 - 1.0, defaults to 0)

shadow-exclude = [ “n:e:Notification” ]; # Exclude conditions for shadows.

shadow-exclude = “n:e:Notification”;

shadow-ignore-shaped = true;

#Focus
focus-exclude = [ “g:e:FvwmButtons” ];

Opacity

menu-opacity = 1; # The opacity for menus. (default 1.0)
inactive-opacity = 0.3; # Opacity of inactive windows. (0.1 - 1.0)
frame-opacity = 1; # Opacity of window titlebars and borders. (0.1 - 1.0)
inactive-opacity-override = true; # Inactive opacity set by ‘inactive-opacity’ overrides value of _NET_WM_OPACITY.

Fading

fading = true; # Fade windows during opacity changes.

fade-delta = 30; # The time between steps in a fade in milliseconds. (default 10).

fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).

no-fading-openclose = true; # Fade windows in/out when opening/closing.

Other

#inactive-dim = 0.5; # Dim inactive windows. (0.0 - 1.0, defaults to 0).
mark-wmwin-focused = true; # Try to detect WM windows and mark them as active.
mark-ovredir-focused = true;
detect-rounded-corners = true;
#paint-on-overlay = true;

Window type settings

wintypes:
{
tooltip = { fade = false; shadow = false; opacity = 0.75; };
dock = { fade = false; shadow = false; opacity = 1; };
popup_menu = { fade = false; shadow = false; opacity = 1; };
notify = { fade = true; shadow = false; opacity = 1; };
dropdown_menu = { fade = false; shadow = true; opacity = 1; };
combo = { fade = false; shadow = false; opacity = 1; };
desktop = { fade = false; shadow = false; opacity = 1; };
};[/code]

scientific

  • Libreoffice is pretty slow even with my Core i7 3770K…
  • You may wish to look at your CPU usage to check if there’s a clue.
  • I’ve seen no report about problems with LibreOffice so far.
  • You could check if it’s equally slow with, for example, xcompmgr.
  • Sorry, it’s close to midnight, I’m not in the optimal state to diagnose the issue.

By default compton marks dialog windows as always focused, because dialog windows often contains important information that people do not want to miss. To disable it, add this to the “wintypes” section of compton.conf:

wintypes:
{
  dialog = { focus = false; };
};

The result is, main window will get transparent when the search window gets focus, search window gets transparent when main window has focus.

As for your requirement of “The main-window shouldn’t get transparent, while the search-window has focus, and the search window should get transparent, while the main-window has focus.”, the answer is a no, this is not possible with compton right now. Main window and search window will either have only one opaque or both be opaque (–detect-transient --detect-client-leader), all the time. I do not plan to add this feature. There’s no way could we satisfy every weird need our users have.

Oh Thank you. You’re a developer of compton? Good work!!!

I will watch the issues with libreoffice. Maybe there is something for a bugreport for them. I think it’s not the issue of composition, because some dialogs are very slow even with fvwm alone. Scrolling in the dialog rebuilds every line the dialog new… it seems like this. So it gets very slow.

I changed the config for compton. This is ok now. But i will try more.

scientific

OH! I learn