Transparent background in Emacs on Gnome Shell

This question is the continuity of the previous question here: How to make emacs console mode inherit shell colors

On Ubuntu 12.10 and Gnome Shell 3.6.2, I am running Emacs. After http://www.emacswiki.org/emacs/TransparentEmacs I can set alpha transparency in my Emacs X window using:

(set-frame-parameter (selected-frame) 'alpha '(85 50)) (add-to-list 'default-frame-alist '(alpha 85 50)) 

Unfortunately, this sets transparency for all the "elements" in my emacs window, including text containing foreground text. As a result, it becomes difficult to read the contents of Emacs. What I'm looking for is a way to set only the alpha value in the background. This way, I can clearly see the contents of the Emacs window and read the information from the windows behind emacs (I successfully do this with a very nice gnome terminal).

+8
source share
2 answers

It seems like this was asked a while ago, but I don’t see where Manuel got the full solution. I had the same problem and this is what I came up with.

If you set the transparency of your shell and then run emacs -nw -q , Emacs default behavior seems to match your shell settings. If yours does not, then there is a chance that you have set some conflicting settings somewhere. Maybe you are using a theme that sets the default background color? If so, you need to change this setting.

If you use one of the built-in themes (for example, adwaita, tango, wombat, etc.), they set the default background color, which overrides the alpha-frame parameter. One solution is to find this theme file and comment out the line that sets this default value. My topics are at /usr/share/emacs/25.3/etc/themes. If it is not there, then switch to your working buffer and evaluate the value of the data-directory variable. This directory should have a subdirectory of topics. To modify the theme file, you may need administrator rights.

The code Jeff gave earlier should work. See Section 28.4: ELisp Manual Frame Parameters. Also check out 51.1.7: Custom Themes in the Emacs Guide. Jeff code will set the frame transparency only for Emacs. This is good if you want it to be different from the transparency of your shell application. If you just want it to follow the behavior of your shell, as I said, this is the default value.

+1
source

Mina worked fine - the front is visible in the color I set in .Xresources. Perhaps you can try this, for example:

 emacs*foreground: gold emacs*background: black 

can go into ~/.Xresources and then use the command

 $ xrdb ~/.Xresources 

before calling emacs with these two lines that you specified (in ~ / .emacs):

 (set-frame-parameter (selected-frame) 'alpha '(85 50)) (add-to-list 'default-frame-alist '(alpha 85 50)) 

I updated above to include these two lines in ~ / .emacs, because this is what makes transparency work. In addition, I notice that when my emacs window loses focus, the foreground also becomes transparent. Perhaps this is what you had in mind?

0
source

All Articles