Transparency at startup

This is for users who want to use RootTransparent for transparency. Also when running a compositor for X11 (Picom, Compton, etc.). Doesn’t activate by default, and requires a few additional command lines.

Add these two lines in default Fvwm configs, “1: Functions” section, after InitBackground function, line number 90.

Test (x fvwm-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault
Test (x fvwm3-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault

Attach these two lines to SetBG function after line number 128 (not at the end). This activates transparency immediately when changing the wallpaper.

+ I Test (x fvwm-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault
+ I Test (x fvwm3-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault

The lines MUST be in the right place, check this.

DestroyFunc SetBG
AddToFunc   SetBG
+ I Test (f $[FVWM_USERDIR]/images/background/$0) \
    Exec exec fvwm-root $[FVWM_USERDIR]/images/background/$0
+ I TestRc (Match) Exec exec ln -fs images/background/$0 \
    $[FVWM_USERDIR]/.BGdefault

+ I Test (x fvwm-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault
+ I Test (x fvwm3-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault

+ I TestRc (Match) Break
+ I Test (!f $[FVWM_DATADIR]/default-config/images/background/$0) Break
+ I Exec exec fvwm-root $[FVWM_DATADIR]/default-config/images/background/$0
+ I Exec exec ln -fs $[FVWM_DATADIR]/default-config/images/background/$0 \
    $[FVWM_USERDIR]/.BGdefault

Sample colorset code:
ColorSet 15 RootTransparent Buffer, Tint #4a516a 50, fg white, bg black

1 Like

That how it works. Can also be made a read script, without default config change?

There seems to be some contradictory statements with this function.

I can see you’re trying to cater for both fvwm2 and fvwm3. Some downstream package maintainers of fvwm, use --program-transform-name at ./configure time to change the name – I know some use fvwm3-root, others just leave it alone.

+ I Test (x fvwm-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault
+ I Test (x fvwm3-root) Exec exec fvwm-root -r ~/.fvwm/.BGdefault

+ I TestRc (Match) Break

This will always break from the function which means the following lines won’t ever be run:

+ I TestRc (Match) Break
+ I Test (!f $[FVWM_DATADIR]/default-config/images/background/$0) Break
+ I Exec exec fvwm-root $[FVWM_DATADIR]/default-config/images/background/$0
+ I Exec exec ln -fs $[FVWM_DATADIR]/default-config/images/background/$0 \
    $[FVWM_USERDIR]/.BGdefault

So I’m not quite sure what the intent of this function is, but it needs looking at.

I don’t see contradiction, but BUG. @rasat did not add new command but correct fvwm-root option -r (–retain-pixmap), which is missing. Check Fvwm manpage

This option should also be used for the RootTransparent colorset option, refer to the COLORSETS section of fvwm.

Adding -r is ok, but still some more fix for wallpaper to appear on startup. @rasat two lines after InitBackground is ok until fixed.

I am testing OpenBSD (Fvwm 1.0.8 - fvwm3-root) and did the following modification in the Start Function section. To load background and transparency either fvwm-root -r or fvwm3-root -r.

## Check Fvwm version.
Test (x fvwm-root) InfoStoreAdd VER "fvwm-root -r"
Test (x fvwm3-root) InfoStoreAdd VER "fvwm3-root -r"

DestroyFunc InitBackground
AddToFunc InitBackground
+ I Test (f $[FVWM_USERDIR]/.BGdefault) \
    Exec exec $[infostore.VER] $[FVWM_USERDIR]/.BGdefault
+ I TestRc (NoMatch) Exec exec $[infostore.VER] \
    $[FVWM_DATADIR]/default-config/images/background/bg1.png

## Function: SetBG $0
DestroyFunc SetBG
AddToFunc   SetBG
+ I Test (f $[FVWM_USERDIR]/images/background/$0) \
    Exec exec $[infostore.VER] $[FVWM_USERDIR]/images/background/$0
+ I TestRc (Match) Exec exec ln -fs images/background/$0 \
    $[FVWM_USERDIR]/.BGdefault
+ I TestRc (Match) Break
+ I Test (!f $[FVWM_DATADIR]/default-config/images/background/$0) Break
+ I Exec exec $[infostore.VER] $[FVWM_DATADIR]/default-config/images/background/$0
+ I Exec exec ln -fs $[FVWM_DATADIR]/default-config/images/background/$0 \
    $[FVWM_USERDIR]/.BGdefault

For your information – there is also the FVWM_IS_FVWM3 environment variable which is set when fvwm3 is running. From looking at your function, that should help reduce some of its… complexity.

I am not familiar with how this variable works because it gives the same result of “1” regardless of fvwm-root or fvwm3-root. Also, there is now a discussion of using feh which will be added as a third option.

This works on Fvwm2 and Fvwm3 and is tested on a few distro live usb, giving feh priority if it is installed.

Test (x fvwm3-root) InfoStoreAdd VER "fvwm3-root -r"
Test (x fvwm-root) InfoStoreAdd VER "fvwm-root -r"
Test (x feh) InfoStoreAdd VER "feh --bg-tile"

Note, you really shouldn’t need to test for fvwm3-root in most cases. This is a renaming only done on the Debian package (to allow both fvwm and fvwm3 installable at the same time), the name of the binary for both fvwm2 and fvwm3 is fvwm-root. In addition on the Debian package, the alternative system is used to link fvwm-root to fvwm3-root when installing, so even if using the Debian fvwm3 package, the binary fvwm-root exists and works just fine.

Personally, I would just add feh as a dependency to your fvwm based DE, and require users use that and not use fvwm-root at all. This will allow for using more image formats, most notably JPEG, and give you the option to stretch images and not only use tiled images.

Aim of Fvwm Kise is to work on any distro. Currently, Debian-based is “fvwm-root” and OpenBSD is “fvwm3-root” (maybe all BSD-based).

Feh will do it as long as I find a way for users to install it. Maybe one pop-up box at startup.