You are not logged in.

#1 2021-04-05 10:49:22

kovac
Member
Registered: 2020-03-14
Posts: 41

[Solved] How to make urxvt selectively transparent?

I have made my urxvt terminal transparent using true transparency with Xcompmgr and it's working well. However, I would like to make it opaque when I'm using vim editor. I tried changing the vim settings like

:highlight Normal ctermfg=white ctermbg=black

but it's not quite doing it right. For example, the part with already existing text is still transparent. I would like the uxrvt to use all the other custom settings I have set in .Xresources except the transparency setting. Is this possible?

Last edited by kovac (2021-04-10 15:27:44)

Offline

#2 2021-04-05 12:30:55

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [Solved] How to make urxvt selectively transparent?

urxvt -depth 32 -bg 'rgba:0000/0000/0000/8888' -fg white &
printf "\033]11;#272727\007"
printf "\033]49;#272727\007"
printf "\033]708;#272727\007"
# marvel in wonder
# return to translucent
printf "\033]11;rgba:0000/0000/0000/8888\007"
printf "\033]49;rgba:0000/0000/0000/8888\007"
printf "\033]708;rgba:0000/0000/0000/8888\007"

Offline

#3 2021-04-05 22:45:27

kovac
Member
Registered: 2020-03-14
Posts: 41

Re: [Solved] How to make urxvt selectively transparent?

Haha it's cool, thanks! Do I need to do this each time before I open the term emulator? I was hoping for some static configuration.

Offline

#4 2021-04-06 06:33:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [Solved] How to make urxvt selectively transparent?

What specifically?
"depth" can be provided as a recource in your xrdb and for the colors, I'd probably wrap vim in a shell function

vim() {
   if [[ $TERM = *rxvt* ]]; then
      printf "\033]11;#272727\007"
      printf "\033]49;#272727\007"
      printf "\033]708;#272727\007"
   fi
   /usr/bin/vim "$@"
   if [[ $TERM = *rxvt* ]]; then
      printf "\033]11;rgba:0000/0000/0000/8888\007"
      printf "\033]49;rgba:0000/0000/0000/8888\007"
      printf "\033]708;rgba:0000/0000/0000/8888\007"
   fi
}

cause I'm  not sure how random terminals or even urxvt would respond to the rgba colors in the termcap variables - but feel free to try.
http://vimdoc.sourceforge.net/htmldoc/term.html

Offline

Board footer

Powered by FluxBB